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 |
Why should any swing call back implementation execute quickly?
What is java swing application?
What is the purpose of action interface in swing?
What is swing in java with example?
Name the method, to expand & collapse nodes in a Jtree?
What is swing package in java?
How to move from one page to another in java swing?
What are the benefits of using Swing over AWT?
Which swing methods are thread-safe?
Where is java swing used?
What are the differences between Swing and AWT?
What is a component in swing?