Questions tagged [jpopupmenu]

JPopupMenu is the Java Swing implementation of a popup menu, a small window that pops up and displays a series of choices. A JPopupMenu is used for the menu that appears when the user selects an item on the menu bar. It is also used for "pull-right" menu that appears when the selects a menu item that activates it. Finally, a JPopupMenu can also be used anywhere else you want a menu to appear.

JPopupMenu is the Java Swing implementation of a popup menu, a small window that pops up and displays a series of choices. A JPopupMenu is used for the menu that appears when the user selects an item on the menu bar. It is also used for "pull-right" menu that appears when the selects a menu item that activates it. Finally, a JPopupMenu can also be used anywhere else you want a menu to appear.

For information and examples of using popup menus, see How to Use Menus in The Java Tutorial.

255 questions
4
votes
1 answer

Adding custom elements to a JPopupMenu

The problem can be stated in two different ways: 1. I have a JPopupMenu where I want to insert a component which is not a JMenuItem (a custom JTree)... but I dont know how to do it or 2. I have a different Popup (JPopupPanel) and I want to add…
spuas
  • 1,683
  • 1
  • 16
  • 26
4
votes
3 answers

Cannot hide SystemTray JPopupMenu when it loses focus

This question is similar to this one. What I have is a JPopupMenu that pops up from an icon on the system tray. At this point, the system tray is the only manifestation of the program. That is, there are no other windows open, the icon in the…
Michael Plautz
  • 3,578
  • 4
  • 27
  • 40
4
votes
3 answers

Java JPopupMenu bug

Seems like I've found a bug in Java: I need to create the JFrame with a transparent background and now I need to show the JPopupMenu for some user actions. It works fine when JPopupMenu is housed fully inside a JFrame. But when the JPopupMenu is…
SeniorJD
  • 6,946
  • 4
  • 36
  • 53
4
votes
1 answer

Hotkey for JMenuItem of JPopupMenu

I have added a JPopupMenu with certain JMenuItems to a JTable in my java application. I then set accelerators for those JMenuitems. Now my problem is that when I try to use those hotkeys, they don't work until I open that JPopupMenu. When that popup…
user2067787
  • 130
  • 8
4
votes
3 answers

Make JPopupMenu Display with a Certain Bottom Left Coordinate

Say that I want to make a button in Java in such a way so that when you click on it, a JPopupMenu appears. The relevant code for it appearing is menu.show(button, button.getWidth()/2, button.getHeight()/2);, which makes the JPopupMenu be displayed…
Thunderforge
  • 19,637
  • 18
  • 83
  • 130
4
votes
1 answer

Java JPopupMenu Mac OS X

i have three problems with a JPopupmenu on Mac, all can be reproduced by the enclosed java program or e.g. the netbeans java application. The first thing is that Java applications don't block the dock when a popup menu is shown. So when i right…
coder
  • 1,415
  • 2
  • 12
  • 15
4
votes
3 answers

JPopupMenu on JTable -> Get the cell the menu was created on

I have a situation where I have a popup menu created when a JTable is right clicked on. Standard way of creating the popup menu: aJTable.setComponentPopupMenu(rightClickMenu); Now afterwards in the action that gets registered, I am unable to find…
Ramo
  • 283
  • 1
  • 5
  • 15
4
votes
2 answers

JPopupMenu in Java3d applet does not receive mouse or keyboard input

I have a a Java application that uses Java3D and JPopupMenus filled with JMenuItems. Everything works fine when it runs as a regular application-- the JPopupMenus and everything else behave as expected. However, when I make an applet out of the…
mahercbeaucoup
  • 597
  • 5
  • 15
4
votes
3 answers

Adding JPopupMenu to JPanel

My code: class PanelGlowny extends JPanel implements ActionListener{} public class Formatka extends JFrame implements ActionListener{ private JMenuItem klienciMenuItem = new JMenuItem("Klienci"); private JPopupMenu menuPopup = new…
user1304098
  • 71
  • 1
  • 3
  • 10
3
votes
2 answers

Java Popup Button

Note: You may have to compile and run my example to fully understand my question. If this is not kosher, I apologize in advance. I am trying to create a Swing control that is based on a JToggleButton and a JPopupMenu. The toggle button is selected…
lifelongcoug
  • 678
  • 6
  • 12
3
votes
2 answers

JPopupMenu only for entries of JList, not all space of the JList

I want to display a JPopupMenu on right click on elements of a JList. jList.setComponentPopupMenu(...) works fine and displays the context menu (JPopupMenu) if I right click the JList. But my JList often is larger (taller) than needed for its…
MrSnrub
  • 1,123
  • 1
  • 11
  • 19
3
votes
2 answers

Java: submenu in jpopupmenu with separators and shortcut keys that appear?

how do you go about adding submenu's to an existing jpopupmenu? when you right click the jpopupmenu appears, I want to access submenus under another menu. how do you add separators in the jpopupmenu? what about shortcut keys? Below image describes…
KJW
  • 15,035
  • 47
  • 137
  • 243
3
votes
2 answers

Is there a way to detect current selection in JPopupMenu (SelectionModel ChangeListener doesn't work)

I want to detect when selection changes inside a JPopupMenu. Not when a menu item is clicked, but when a menu item is selected (armed). With simpler words, I want to detect this: The thing that should work is to add a ChangeListener to its…
George Z.
  • 6,643
  • 4
  • 27
  • 47
3
votes
0 answers

Right click multiple selection in JTable popup menu

I want to apply my popup menu for multiple rows that I select with the mouse. When I drag the mouse it selects the rows, but when I right click for popup menu it selects only 1 row. As it shows on the picture: from 1 to 2. I want the popup menu to…
Davis8988
  • 298
  • 4
  • 16
3
votes
2 answers

JPopupMenu bug/glitch(?) when showing submenu

I have this strange bug with my popup menu. It happens rarely and seemingly randomly. The problem is when I have a submenu in my JPopupMenu - when I select the submenu, main menu disappears and the submenu is painted incorrectly (it's like the…
Denis Tulskiy
  • 19,012
  • 6
  • 50
  • 68
1 2
3
16 17