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 are Swing and AWT be differentiated?
What is double buffering ?
What is container in java swing?
What are the two key features of swing?
Is javafx better than swing?
What is import javax swing * used for?
Who created the swing?
what is the diff's between swing and applet?
Which types of components are used in designing swing based gui?
Is swing better than awt?
What is sling swing?
Why is model-view-controller architecture used in swing?