01: /*
02: * WbMenu.java
03: *
04: * This file is part of SQL Workbench/J, http://www.sql-workbench.net
05: *
06: * Copyright 2002-2008, Thomas Kellerer
07: * No part of this code maybe reused without the permission of the author
08: *
09: * To contact the author please send an email to: support@sql-workbench.net
10: *
11: */
12: package workbench.gui.components;
13:
14: import javax.swing.Action;
15: import javax.swing.JMenu;
16:
17: /**
18: *
19: * @author support@sql-workbench.net
20: */
21: public class WbMenu extends JMenu {
22: private String parentMenuId = null;
23: private boolean createSeparator = false;
24:
25: public WbMenu() {
26: super ();
27: }
28:
29: public WbMenu(String aText) {
30: super (aText);
31: }
32:
33: public WbMenu(String aText, boolean b) {
34: super (aText, b);
35: }
36:
37: public WbMenu(Action anAction) {
38: super (anAction);
39: }
40:
41: public void setParentMenuId(String id) {
42: this .parentMenuId = id;
43: }
44:
45: public String getParentMenuId() {
46: return this .parentMenuId;
47: }
48:
49: public void setCreateMenuSeparator(boolean aFlag) {
50: this .createSeparator = aFlag;
51: }
52:
53: public boolean getCreateMenuSeparator() {
54: return this .createSeparator;
55: }
56:
57: public void setText(String aText) {
58: int pos = aText.indexOf('&');
59: if (pos > -1) {
60: char mnemonic = aText.charAt(pos + 1);
61: aText = aText.substring(0, pos) + aText.substring(pos + 1);
62: this.setMnemonic(mnemonic);
63: }
64: super.setText(aText);
65: }
66:
67: }
|