A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Swing / AWT / SWT
Designing menu item State
Joined: Feb 18, 2008
Oct 25, 2011 09:57:25
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
to achieve this.?
Ranganathan Kaliyur Mannar
Joined: Oct 16, 2003
Oct 27, 2011 00:10:39
GoF's Strategy Pattern sounds to suit your problem - or State pattern should also be checked.
If you could post a
, that would make it easier to help too.
SCJP 1.4, OCMJEA/SCEA 5.0.
It is sorta covered in the
JavaRanch Style Guide
subject: Designing menu item State
Role Based Menu in a JSP Page.
Swing Menu item with no children?
enable and disable a menu item in a menu bar
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014