1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
// A Button Events Application
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class InterfaceClient extends Applet implements ActionListener
{
private Button button1, button2, button3;
private TextField status;
public void init()
{
status = new TextField(20);
this.button1 = new Button("1");
this.button2 = new Button("2");
this.button3 = new Button("3");
this.button1.addActionListener(this);
this.button2.addActionListener(this);
this.button3.addActionListener(this);
this.add(status);
this.add(button1);
this.add(button2);
this.add(button3);
}
public void actionPerformed(ActionEvent e)
{
if (e.getActionCommand().equals("1"))
{
status.setText("1");
}
else if (e.getActionCommand().equals("2"))
{
status.setText("2");
}
else
{ |
Partager