3

Alright, so I have a JTabbedPane in an application and it has several panels. Is it possible to assign a JPopupMenu to the actual tabs themselves instead of the JPanel? If it is possible, how would I do this?

  • I click a tab and a popup popsup? – jedierikb Jul 28 '10 at 03:44
  • Yes, when you right-click the tab itself, I want the JPopupMenu to appear. When I tried assigning panel.setComponentPopupMenu(popupmenu);, and went on to right-click the tab, no menu appeared, but when I right-clicked the panel itself, the menu appeared. This leads me to believe that there is some seperate thing for the tab. –  Jul 28 '10 at 03:47

1 Answers1

2

See http://www.java-forums.org/awt-swing/20810-how-can-i-add-popup-menu-tab-tabbedpane.html for an example.

I think you would first call setTabComponentAt([each index], [a label with a popup attached]) then you would need to add a method in to change each of the tabs when they are clicked.

Opal
  • 1,057
  • 8
  • 27