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 |
What are the swing components in java?
Difference between AWT and Swing compenents?
What is the difference between a scrollbar and a jscrollpane ?
What are the two key features of swing?
How to reload a jframe in java swing?
What is difference between awt and swing?
Is javafx better than swing?
What is pane in swing?
Write a program to include the internal frame in swing.
Hello Everyone.. I m trying to develop a java swing application where i can display a doc file Jeditorpane or Jtextpane.
What is container in java swing?
Name the borders provided by Swing?