• 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
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Popup menu not showing when JTable cell clicked

 
Ranch Hand
Posts: 455
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a JTable that I want to popup a menu by right clicking on a certain cell. I have created a PopupMenu class that takes a component argument, and that component gets the mouse listener in the PopupMenu class added to it. I also made a method to set the component in the PopupMenu class.
I create an instance of the PopupMenu class passing it a null for component.
Then after I've populated my table with data, I set the component in the PopupMenu class by calling the getTableCellRendererComponent() method in the selectTableRow() method (See below). However, the popup menu never comes up. Could someone tell me what I'm doing wrong?
Here's some code I'm using:


Thanks for any help!
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you tried setting the setLightWeightPopupEnabled(false)
for the JPopupMenu instance after creating the popup menu?
The default is true and may be behind your table.
popup.setLightWeightPopupEnabled(false);
reply
    Bookmark Topic Watch Topic
  • New Topic