• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How Dynamic JPopupMenu in swing?

 
Ranch Hand
Posts: 223
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have swing JPopupMenu like

protected JPopupMenu remoteTreePopup;

remoteTreePopup.add(createFolderAction);
remoteTreePopup.add(editItemAction);
remoteTreePopup.add(removeItemAction);
remoteTreePopup.addSeparator();

according to the above code,
if i right click the swing jpopupmenu, all the 4 label actions will be default actions.

how can I allow/view createFolderAction only.

Please give some ideas.

Thanks and Regards,
Edward
 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

if i right click the swing jpopupmenu, all the 4 label actions will be default actions.


Not really. A "default" action is usually the action fired on specific triggers like double click or hitting return. e.g. In Windows explorer, if you right click on a drive (c:,d: etc) the "default" action is "explore". The visual clue associated with the default action, is that the text is bold.


how can I allow/view createFolderAction only.



1) Disable all other actions.
2) Don't add them to the popup.
3) If already added, remove them from the popup.

The way it usually done is using #1 above.
 
reply
    Bookmark Topic Watch Topic
  • New Topic