File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Designing menu item State Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Designing menu item State" Watch "Designing menu item State" New topic
Author

Designing menu item State

Chiranjeevi Kanthraj
Ranch Hand

Joined: Feb 18, 2008
Posts: 288

Hi all

i have added a Popup menu on a Jtable.
i have to enable or disable based on selection or rows.

like i have to enable or disable some menu item if selection is only one row.
and the menu item's state is different if selection is multiple.

and also based on different parameter.

i am tiered of adding logical operations checking conditions. every time new menu is added.

is any design pattern to achieve this.?

Thanks


-Chiru
Ranganathan Kaliyur Mannar
Bartender

Joined: Oct 16, 2003
Posts: 1075
    
  10

GoF's Strategy Pattern sounds to suit your problem - or State pattern should also be checked.
If you could post a SSCCE, that would make it easier to help too.


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Designing menu item State
 
Similar Threads
adding listeners
clipboard events?
Role Based Menu in a JSP Page.
enable and disable a menu item in a menu bar
Swing Menu item with no children?