How can you draw using Swing components?
use the getGraphics method to get an object of the graphics
class and with that object we can perform draw methods.
for example
public class myclass extends...implements ActionListener
{
...
...
....
public void actionPerformed(ActionEvent ae)
{
if(ae==....)
{
Graphics g=getGraphics();
g.drawLine(100,200,150,250);
}
}
.....
Is This Answer Correct ? | 2 Yes | 0 No |
How to add and delete nodes in Jtree?
What is the function of abstractaction class?
What is swing package in java?
Explain how to render an html page using only swing.
Why are swing components called lightweight components?
Why should any swing call back implementation execute quickly?
What is pane in swing?
What is the difference between a scrollbar and a jscrollpane ?
What is sling swing?
What is container in java swing?
What is the relationship between clipping and repainting?
What class is at the top of the AWT event hierarchy?