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 is awt and swing?
Why does JComponent have add() and remove() methods but Component does not?
What is the base class for all swing components?
What is difference between jframe and swing?
am searching for the job based on java, swing, currently working small company. they are not giving any salary slip, offer letter. so if i try outside for MNC's they start with previous company details. what should i do..? please help me to get job and make my career.
What is an event handler in swing?
What is awt and swing in java?
In what context should the value of swing components be updated directly?
What is java swing gui?
What is import javax swing in java?
What things to do to make a web browser compatibale for swing components?
1 Answers Tesco, TracFone, Wipro,
What is swing used for?