|
-
problems wiith JMenu
I'm having problems with the ActionEvent on jMenuItems. I want that when you click on the menuitem, a form window opens. The problem with my code is that when you click for the first time it dosen't do anything, for the second time it does open the window. But, then if you click for a third time it opens two instances of the window, and so on.
For example:
this is the code for an action performed on a menu item:
[/B]
private void MenuAltaEmpleadoActionPerformed(java.awt.event.ActionEvent evt) {
AltaEmpleadoAction aea = new AltaEmpleadoAction("Alta Empleado",null, new String("Da de alta un empleado en el sistema"),new Integer(3));
MenuAltaEmpleado.addActionListener(aea);
}
[B]
and this is the AltaEmpladoAction class:
public class AltaEmpleadoAction extends AbstractAction {
/** Creates a new instance of AltaEmpleadoAction */
public AltaEmpleadoAction(String text, ImageIcon icon,
String desc, Integer mnemonic) {
super(text, icon);
putValue(SHORT_DESCRIPTION, desc);
putValue(MNEMONIC_KEY, mnemonic);
}
public void actionPerformed(ActionEvent e) {
AltaEmpleado a = new AltaEmpleado();
a.show();
}
}
thanks
PD: sorry about my english
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks