File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes AbstractAction Not Working With JMenu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "AbstractAction Not Working With JMenu" Watch "AbstractAction Not Working With JMenu" New topic
Author

AbstractAction Not Working With JMenu

Suresh Bansal
Ranch Hand

Joined: Jul 23, 2001
Posts: 91
Hello Friends,
I am using jdk 1.4 and AbstractAction to link button and menu to the same action class.
While buttons are working fine, the menu is giving ClassCastException:String when i run my program
My code is something like
JMenu file = new JMenu("File");
Action action = new AbstractAction("New") {
public void actionPerformed(ActionEvent e) {
System.out.println("Hello ...");
}
};
JMenuItem book = file.add(action);
JMenuItem search = file.add(new SearchAction("Search"));
mBar.add(file);
While action is working properly with menu, SearchAction is not.
Search action declared like - public class SearchAction extends AbstractAction
If any body could give pointers to what i might be doing wrong ... It would be a great help ...
Thanks,
Suresh


Journey is as important as the Destination.<br /> <br />PMP, SCJP, SCJD, SCEA (Part 1), SCMAD, SCDJWS
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: AbstractAction Not Working With JMenu
 
Similar Threads
Implementing function in new dialog
JMenuItem.setMargin
actions performed
JMenu – exit application problem!
Things arn't showing up...