/**ACTION LISTENER IN JAVA EXAMPLE**/
import java.lang.*;
import java.awt.*;
import java.awt.event.*;
class bb extends Frame implements ActionListener
{
Button b;
TextField t;
public bb()
{
b=new Button("CLICK:");
t=new TextField(20);
setLayout(new FlowLayout());
add(b); add(t);
b.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b)
{
Frame f=new Frame();
{
f.setSize(50,50);
f.setVisible(true);
}
}
}
public static void main(String args[])
{
bb a=new bb();
a.setSize(400,600);
a.setVisible(true);
}
}
import java.lang.*;
import java.awt.*;
import java.awt.event.*;
class bb extends Frame implements ActionListener
{
Button b;
TextField t;
public bb()
{
b=new Button("CLICK:");
t=new TextField(20);
setLayout(new FlowLayout());
add(b); add(t);
b.addActionListener(this);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()==b)
{
Frame f=new Frame();
{
f.setSize(50,50);
f.setVisible(true);
}
}
}
public static void main(String args[])
{
bb a=new bb();
a.setSize(400,600);
a.setVisible(true);
}
}
No comments:
Post a Comment