diff options
author | Jonathan Bauer | 2015-08-05 17:43:19 +0200 |
---|---|---|
committer | Jonathan Bauer | 2015-08-05 17:43:19 +0200 |
commit | 4c5525fd946b21e73734197ad8f4b58b118ecb3d (patch) | |
tree | c7e9de7f704a9ecda1ba1186678bb8d85fe20b7b /dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper | |
parent | [client] search user text field actually filters (diff) | |
download | tutor-module-4c5525fd946b21e73734197ad8f4b58b118ecb3d.tar.gz tutor-module-4c5525fd946b21e73734197ad8f4b58b118ecb3d.tar.xz tutor-module-4c5525fd946b21e73734197ad8f4b58b118ecb3d.zip |
[client] first buggy popup menu
TODO fix the highlighting of the row when right-clicking it!
Diffstat (limited to 'dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper')
-rw-r--r-- | dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/PopupMenu.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/PopupMenu.java b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/PopupMenu.java new file mode 100644 index 00000000..ae6b7b2b --- /dev/null +++ b/dozentenmodul/src/main/java/org/openslx/dozmod/gui/helper/PopupMenu.java @@ -0,0 +1,26 @@ +package org.openslx.dozmod.gui.helper; + +import java.awt.event.ActionListener; + +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.border.BevelBorder; + +public class PopupMenu extends JPopupMenu { + + private ActionListener menuListener = null; + + public PopupMenu(final ActionListener menuListener) { + super(); + this.menuListener = menuListener; + setBorder(new BevelBorder(BevelBorder.RAISED)); + } + + public void addMenuItem(JMenuItem newItem, String newItemCommand) { + newItem.setHorizontalTextPosition(JMenuItem.RIGHT); + newItem.setActionCommand(newItemCommand); + if (menuListener != null) + newItem.addActionListener(menuListener); + add(newItem); + } +} |