Friday, 14 June 2013
program in java - windowlistner & draw line with awt
import java.awt.*;
import java.awt.event.*;
class a3 extends Frame
{
public static void main(String args[])
{
a3 d=new a3();
d.setTitle("Draw");
d.setSize(500,500);
d.setVisible(true);
myclass m=new myclass();
d.addWindowListener(m);
}
public void paint(Graphics g)
{
g.drawLine(200,200,100,100);
}
}
class myclass implements WindowListener
{
public void windowClosing(WindowEvent we)
{
System.exit(0);
}
public void windowClosed(WindowEvent we)
{
}
public void windowIconified(WindowEvent we)
{
}
public void windowDeiconified(WindowEvent we)
{
}
public void windowActivated(WindowEvent we)
{
}
public void windowDeactivated(WindowEvent we)
{
}
public void windowOpened(WindowEvent we)
{
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment