• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

JPopupMenu

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi guys (not meant in chauvinistic fashion),

I got something like a "dynamic JPopupMenu" (i call it dynamic because it changes its size depending on the size of a Jlist). My problem is that, the JList it gets its data from is empty in the beginning, thus the Jpopupmenu is not displayed (or just a small fraction of it), when right clicking. Is there a EASY way to set the "inital size".
Please it should be EASY and not super-tricky.
Thanks

Edit1:
myJPopupMenu.setSize(100,100) doesn't work
 
Sheriff
Posts: 3837
66
Netbeans IDE Oracle Firefox Browser
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure I understand you correctly. Do you want to display an empty popup menu, so that the user knows his right-click (or whatever action that brings up the popup menu) has been processed? If this is the case, I'd put a single disabled menu item onto the popup menu with text like "no action available" or something similar.
 
frank braunstein
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Martin Vajsar wrote:I'm not sure I understand you correctly. Do you want to display an empty popup menu, so that the user knows his right-click (or whatever action that brings up the popup menu) has been processed? If this is the case, I'd put a single disabled menu item onto the popup menu with text like "no action available" or something similar.



Actually, yes I've done something similar:
the right click checks the "data JList" first, if its empty no JPopupMenu is opened, else it shows the JPopupMenu with all contents.
 
moose poop looks like football shaped elk poop. About the size of this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic