• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPopupMenu

 
frank braunstein
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • 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
 
Martin Vajsar
Sheriff
Posts: 3752
62
Chrome Netbeans IDE Oracle
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!