View Single Post
  #1 (permalink)  
Old 06-13-2007, 10:47 AM
HelloWorld's Avatar
HelloWorld HelloWorld is offline
PT Admin
Awards Showcase
Quality Tutorial 
Total Awards: 1
Join Date: Jun 2007
Location: In front of computer...
Posts: 1,119
iTrader: (0)
HelloWorld is a jewel in the roughHelloWorld is a jewel in the roughHelloWorld is a jewel in the rough
Icon13 Tutorial: How to add Action to your GUI

Hopefully this would help to everybody

PHP Code:
/* this is assuming that you want to add actionListener to button, but applies anywhere */
JButton button = new JButton("ProgrammersTalk");
button.addActionListener(new ActionListener() {
     
public void actionPerformed(ActionEvent ae) {
          
// what do you want to do when the button is clicked
     
}
}); 
as you see, the code is not that much. There's another way to do this, which I think is just adding more line of codes. I like this way better though. the rest are just going to be your logic. Hopefully this help! Add rep pls..

__________________

Digg this Post! Del.Icio.Us this Post! Technorati this Post! Furl this Post! Mister Wong this Post! Newsvine this Post! Spurl this Post! Reddit this Post! Netscape this Post!
Reply With Quote