Thursday, February 24, 2005

ActionListener and Swing Example

///
/// DefaultListener()
///
public ActionListener defaultListener() {

return new ActionListener() {
/// On action
public void actionPerformed(ActionEvent e){

} /// end of method

};

} /// end of the method //



One of my java swing examples doesnt include a action listener, I always forget the exact code I need so here it is,there function returns an action listener.

For example to add to a JButton:

_c.gridwidth=2;
_default.addActionListener(defaultListenter());
_panel.add(_default, _c);

0 Comments:

Post a Comment

<< Home