Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


How can you draw using Swing components?



How can you draw using Swing components?..

Answer / chandra rekha

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

Post New Answer

More Swing Interview Questions

What is swing api?

0 Answers  


What is pane in swing?

0 Answers  


I want to change the appearance of Frame in Runtime, what class can be used to do this?

2 Answers   TCS, Wipro,


Which method of the Component class is used to set the position and size of a component?

0 Answers  


What are the advantages of swing over awt?

0 Answers  






What is swing?

0 Answers  


What is the difference between applications and applets?

0 Answers  


When we should go for codebase in applet?

0 Answers  


What are the different types of layout managers used in swing?

0 Answers  


What are the benefits of using Swing over AWT?

5 Answers  


How to align components in java swing?

0 Answers  


Why are swings considered lightweight?

0 Answers  






Categories