How can I disable the button after i click Once ?

My program is shown below and hope someone to help me .Thank You Very Much!

import java.awt.*;

import java.awt.event.*;

public class Client {

public static void main(String[] args){

Frame f = new ClientFrame("Client");

f.setSize(150,100);

f.setVisible(true);

}

}

class ClientFrame extends Frame{

public ClientFrame(String title){

super (title);

setLayout (new FlowLayout());

Button GameStart = new Button("Start the Game");

add (GameStart);

GameStart.addActionListener(new ButtonListener());

addWindowListener(new WindowCloser());

}

}

class ButtonListener implements ActionListener {

public void actionPerformed (ActionEvent Evt){

System.out.println("Java rules!");

}

}

class WindowCloser extends WindowAdapter{

public void windowClosing (WindowEvent evt){

System.exit(0);

}

}

[957 byte] By [@@Scottiea] at [2007-11-26 20:15:25]
# 1
inside your actionListener, get hold of the button that generated the event, and setEnabled(false)
georgemca at 2007-7-9 23:22:08 > top of Java-index,Java Essentials,Java Programming...
# 2

//I modified your code so that it easy for me to edit it!!

//This was what georgemc wanted to implemented!!!

import java.awt.*;

import java.awt.event.*;

public class Client {

public static void main(String[] args){

Frame f = new ClientFrame("Client");

f.setSize(150,100);

f.setVisible(true);

}

}

class ClientFrame extends Frame{

Button GameStart = new Button("Start the Game");

public ClientFrame(String title){

super (title);

setLayout (new FlowLayout());

add (GameStart);

GameStart.addActionListener(new ActionListener() {

public void actionPerformed(ActionEvent Evt) {

//You can call a methods here or simply follow what I'm written

GameStart.setEnabled(false);//added this line

System.out.println("Java rules!");

}

});

addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent evt) {

System.exit(0);

}

});

}

}

henyoa at 2007-7-9 23:22:08 > top of Java-index,Java Essentials,Java Programming...
# 3
Hi, use buttonName.setEnabled(false);
techVijaya at 2007-7-9 23:22:09 > top of Java-index,Java Essentials,Java Programming...