Lines 12-19
Link Here
|
12 |
*/ |
12 |
*/ |
13 |
package org.openide.awt; |
13 |
package org.openide.awt; |
14 |
|
14 |
|
|
|
15 |
import java.util.List; |
15 |
import org.openide.ErrorManager; |
16 |
import org.openide.ErrorManager; |
16 |
import org.openide.awt.Mnemonics; |
|
|
17 |
import org.openide.util.HelpCtx; |
17 |
import org.openide.util.HelpCtx; |
18 |
import org.openide.util.Lookup; |
18 |
import org.openide.util.Lookup; |
19 |
import org.openide.util.Utilities; |
19 |
import org.openide.util.Utilities; |
Lines 26-33
Link Here
|
26 |
import java.beans.*; |
26 |
import java.beans.*; |
27 |
|
27 |
|
28 |
import java.lang.ref.WeakReference; |
28 |
import java.lang.ref.WeakReference; |
29 |
|
29 |
import java.util.ArrayList; |
30 |
import java.util.HashMap; |
|
|
31 |
import java.util.Hashtable; |
30 |
import java.util.Hashtable; |
32 |
import java.util.Iterator; |
31 |
import java.util.Iterator; |
33 |
import java.util.Map; |
32 |
import java.util.Map; |
Lines 126-135
Link Here
|
126 |
public static void connect(JMenuItem item, Action action, boolean popup) { |
125 |
public static void connect(JMenuItem item, Action action, boolean popup) { |
127 |
Bridge b = new MenuBridge(item, action, popup); |
126 |
Bridge b = new MenuBridge(item, action, popup); |
128 |
|
127 |
|
129 |
// Would make more sense to defer this until addNotify, but for some reason (why?) |
128 |
if (item instanceof Actions.MenuItem) { |
130 |
// if you do that, various menus start out compacted and poorly painted. |
129 |
((Actions.MenuItem)item).setBridge(b); |
|
|
130 |
} |
131 |
b.updateState(null); |
131 |
b.updateState(null); |
132 |
|
|
|
133 |
if (!popup) { |
132 |
if (!popup) { |
134 |
// #39508 fix. |
133 |
// #39508 fix. |
135 |
setMenuActionConnection(item, action); |
134 |
setMenuActionConnection(item, action); |
Lines 349-360
Link Here
|
349 |
* @param action the action to update |
348 |
* @param action the action to update |
350 |
*/ |
349 |
*/ |
351 |
static void updateKey(JMenuItem item, Action action) { |
350 |
static void updateKey(JMenuItem item, Action action) { |
352 |
if (item instanceof SubMenu || !(item instanceof JMenu)) { |
351 |
if (!(item instanceof JMenu)) { |
353 |
if (item instanceof SubMenu && !((SubMenu) item).useAccel()) { |
352 |
item.setAccelerator((KeyStroke) action.getValue(Action.ACCELERATOR_KEY)); |
354 |
item.setAccelerator(null); |
|
|
355 |
} else { |
356 |
item.setAccelerator((KeyStroke) action.getValue(Action.ACCELERATOR_KEY)); |
357 |
} |
358 |
} |
353 |
} |
359 |
} |
354 |
} |
360 |
|
355 |
|
Lines 937-970
Link Here
|
937 |
} |
932 |
} |
938 |
} |
933 |
} |
939 |
|
934 |
|
940 |
/** Sub menu bridge. |
935 |
|
|
|
936 |
/** The class that listens to the menu item selections and forwards it to the |
937 |
* action class via the performAction() method. |
938 |
*/ |
939 |
private static class ISubActionListener implements java.awt.event.ActionListener { |
940 |
int index; |
941 |
SubMenuModel support; |
942 |
|
943 |
public ISubActionListener(int index, SubMenuModel support) { |
944 |
this.index = index; |
945 |
this.support = support; |
946 |
} |
947 |
|
948 |
/** called when a user clicks on this menu item */ |
949 |
public void actionPerformed(ActionEvent e) { |
950 |
support.performActionAt(index); |
951 |
} |
952 |
} |
953 |
|
954 |
/** Sub menu bridge 2. |
941 |
*/ |
955 |
*/ |
942 |
private static final class SubMenuBridge extends MenuBridge implements ChangeListener { |
956 |
private static final class SubMenuBridge extends MenuBridge implements ChangeListener, DynamicMenuContent { |
943 |
/** model to obtain subitems from */ |
957 |
/** model to obtain subitems from */ |
944 |
private SubMenuModel model; |
958 |
private SubMenuModel model; |
945 |
|
959 |
private List currentOnes; |
946 |
/** submenu */ |
960 |
private JMenuItem single; |
947 |
private SubMenu menu; |
961 |
private JMenu multi; |
948 |
|
|
|
949 |
/** Constructor. |
962 |
/** Constructor. |
950 |
*/ |
963 |
*/ |
951 |
public SubMenuBridge(SubMenu item, Action action, SubMenuModel model, boolean popup) { |
964 |
public SubMenuBridge(JMenuItem one, JMenu more, Action action, SubMenuModel model, boolean popup) { |
952 |
super(item, action, popup); |
965 |
super(one, action, popup); |
953 |
prepareMargins(item, action); |
966 |
single = one; |
954 |
|
967 |
multi = more; |
955 |
menu = item; |
968 |
setMenuText(multi, (String)action.getValue(Action.NAME), popup); |
|
|
969 |
prepareMargins(one, action); |
970 |
prepareMargins(more, action); |
971 |
currentOnes = new ArrayList(); |
956 |
this.model = model; |
972 |
this.model = model; |
957 |
} |
973 |
single.addActionListener(new ISubActionListener(0, model)); |
958 |
|
974 |
// model.addChangeListener(this); |
959 |
public void addNotify() { |
975 |
// checkVisibility(); |
960 |
super.addNotify(); |
|
|
961 |
model.addChangeListener(this); |
962 |
generateSubMenu(); |
963 |
} |
964 |
|
965 |
public void removeNotify() { |
966 |
model.removeChangeListener(this); |
967 |
super.removeNotify(); |
968 |
} |
976 |
} |
969 |
|
977 |
|
970 |
/** Called when model changes. Regenerates the model. |
978 |
/** Called when model changes. Regenerates the model. |
Lines 974-1070
Link Here
|
974 |
if (!EventQueue.isDispatchThread()) { |
982 |
if (!EventQueue.isDispatchThread()) { |
975 |
new IllegalStateException("This must happen in the event thread!").printStackTrace(); |
983 |
new IllegalStateException("This must happen in the event thread!").printStackTrace(); |
976 |
} |
984 |
} |
977 |
|
|
|
978 |
// change in keys or in submenu model |
985 |
// change in keys or in submenu model |
979 |
generateSubMenu(); |
986 |
// checkVisibility(); |
980 |
} |
987 |
} |
|
|
988 |
|
989 |
public void updateState(String changedProperty) { |
990 |
super.updateState(changedProperty); |
991 |
// checkVisibility(); |
992 |
} |
981 |
|
993 |
|
982 |
/** Regenerates the menu |
994 |
|
983 |
*/ |
995 |
|
984 |
private void generateSubMenu() { |
996 |
public JComponent[] getMenuPresenters() { |
985 |
boolean shouldUpdate = false; |
997 |
return synchMenuPresenters(null); |
986 |
|
998 |
} |
987 |
try { |
999 |
|
988 |
menu.removeAll(); |
1000 |
public JComponent[] synchMenuPresenters(JComponent[] items) { |
989 |
|
1001 |
currentOnes.clear(); |
990 |
int cnt = model.getCount(); |
1002 |
int cnt = model.getCount(); |
991 |
|
1003 |
|
992 |
if (cnt != menu.previousCount) { |
1004 |
if (cnt == 0) { |
993 |
// update UI |
1005 |
updateState(null); |
994 |
shouldUpdate = true; |
1006 |
currentOnes.add(single); |
995 |
} |
1007 |
// menu disabled |
996 |
|
1008 |
single.setEnabled(false); |
997 |
// in all cases remeber the previous |
1009 |
} else if (cnt == 1) { |
998 |
menu.previousCount = cnt; |
1010 |
updateState(null); |
999 |
|
1011 |
currentOnes.add(single); |
1000 |
// remove if there is an previous listener |
1012 |
single.setEnabled(true); |
1001 |
if (menu.oneItemListener != null) { |
1013 |
// generate without submenu |
1002 |
menu.removeActionListener(menu.oneItemListener); |
1014 |
HelpCtx help = model.getHelpCtx(0); |
1003 |
} |
1015 |
associateHelp(single, (help == null) ? findHelp(action) : help); |
1004 |
|
1016 |
} else { |
1005 |
if (cnt == 0) { |
1017 |
currentOnes.add(multi); |
1006 |
// menu disabled |
1018 |
multi.removeAll(); |
1007 |
menu.setEnabled(false); |
1019 |
//TODO |
1008 |
|
1020 |
Mnemonics.setLocalizedText(multi, (String)action.getValue(Action.NAME)); |
1009 |
if (menu.oneItemListener != null) { |
1021 |
|
1010 |
menu.removeActionListener(menu.oneItemListener); |
1022 |
boolean addSeparator = false; |
1011 |
menu.oneItemListener = null; |
1023 |
int count = model.getCount(); |
1012 |
} |
1024 |
|
1013 |
|
1025 |
for (int i = 0; i < count; i++) { |
1014 |
return; |
1026 |
String label = model.getLabel(i); |
1015 |
} else { |
1027 |
|
1016 |
menu.setEnabled(true); |
1028 |
// MenuShortcut shortcut = support.getMenuShortcut(i); |
1017 |
|
1029 |
if (label == null) { |
1018 |
// go on |
1030 |
addSeparator = multi.getItemCount() > 0; |
1019 |
} |
1031 |
} else { |
1020 |
|
1032 |
if (addSeparator) { |
1021 |
if (cnt == 1) { |
1033 |
multi.addSeparator(); |
1022 |
// generate without submenu |
1034 |
addSeparator = false; |
1023 |
menu.addActionListener(menu.oneItemListener = new ISubActionListener(0, model)); |
1035 |
} |
1024 |
|
1036 |
|
1025 |
HelpCtx help = model.getHelpCtx(0); |
1037 |
// if (shortcut == null) |
1026 |
associateHelp(menu, (help == null) ? findHelp(action) : help); |
1038 |
// (Dafe) changed to support mnemonics in item labels |
1027 |
} else { |
1039 |
JMenuItem item = new JMenuItem(); |
1028 |
boolean addSeparator = false; |
1040 |
Mnemonics.setLocalizedText(item, label); |
1029 |
int count = model.getCount(); |
1041 |
|
1030 |
|
1042 |
// attach the shortcut to the first item |
1031 |
for (int i = 0; i < count; i++) { |
1043 |
if (i == 0) { |
1032 |
String label = model.getLabel(i); |
1044 |
updateKey(item, action); |
1033 |
|
|
|
1034 |
// MenuShortcut shortcut = support.getMenuShortcut(i); |
1035 |
if (label == null) { |
1036 |
addSeparator = menu.getItemCount() > 0; |
1037 |
} else { |
1038 |
if (addSeparator) { |
1039 |
menu.addSeparator(); |
1040 |
addSeparator = false; |
1041 |
} |
1042 |
|
1043 |
// if (shortcut == null) |
1044 |
// (Dafe) changed to support mnemonics in item labels |
1045 |
JMenuItem item = new JMenuItem(); |
1046 |
Mnemonics.setLocalizedText(item, label); |
1047 |
|
1048 |
// attach the shortcut to the first item |
1049 |
if (i == 0) { |
1050 |
updateKey(item, action); |
1051 |
} |
1052 |
|
1053 |
item.addActionListener(new ISubActionListener(i, model)); |
1054 |
|
1055 |
HelpCtx help = model.getHelpCtx(i); |
1056 |
associateHelp(item, (help == null) ? findHelp(action) : help); |
1057 |
menu.add(item); |
1058 |
} |
1045 |
} |
|
|
1046 |
|
1047 |
item.addActionListener(new ISubActionListener(i, model)); |
1048 |
|
1049 |
HelpCtx help = model.getHelpCtx(i); |
1050 |
associateHelp(item, (help == null) ? findHelp(action) : help); |
1051 |
multi.add(item); |
1059 |
} |
1052 |
} |
1060 |
|
1053 |
|
1061 |
associateHelp(menu, findHelp(action)); |
1054 |
associateHelp(multi, findHelp(action)); |
1062 |
} |
|
|
1063 |
} finally { |
1064 |
if (shouldUpdate) { |
1065 |
menu.updateUI(); |
1066 |
} |
1055 |
} |
|
|
1056 |
multi.setEnabled(true); |
1067 |
} |
1057 |
} |
|
|
1058 |
return (JMenuItem[])currentOnes.toArray(new JMenuItem[currentOnes.size()]); |
1059 |
|
1068 |
} |
1060 |
} |
1069 |
|
1061 |
|
1070 |
private void associateHelp(JComponent comp, HelpCtx help) { |
1062 |
private void associateHelp(JComponent comp, HelpCtx help) { |
Lines 1074-1099
Link Here
|
1074 |
HelpCtx.setHelpIDString(comp, null); |
1066 |
HelpCtx.setHelpIDString(comp, null); |
1075 |
} |
1067 |
} |
1076 |
} |
1068 |
} |
1077 |
|
|
|
1078 |
/** The class that listens to the menu item selections and forwards it to the |
1079 |
* action class via the performAction() method. |
1080 |
*/ |
1081 |
private static class ISubActionListener implements java.awt.event.ActionListener { |
1082 |
int index; |
1083 |
SubMenuModel support; |
1084 |
|
1085 |
public ISubActionListener(int index, SubMenuModel support) { |
1086 |
this.index = index; |
1087 |
this.support = support; |
1088 |
} |
1089 |
|
1090 |
/** called when a user clicks on this menu item */ |
1091 |
public void actionPerformed(ActionEvent e) { |
1092 |
support.performActionAt(index); |
1093 |
} |
1094 |
} |
1095 |
} |
1069 |
} |
1096 |
|
|
|
1097 |
// |
1070 |
// |
1098 |
// |
1071 |
// |
1099 |
// The presenter classes |
1072 |
// The presenter classes |
Lines 1104-1112
Link Here
|
1104 |
* Extension of Swing menu item with connection to |
1077 |
* Extension of Swing menu item with connection to |
1105 |
* system actions. |
1078 |
* system actions. |
1106 |
*/ |
1079 |
*/ |
1107 |
public static class MenuItem extends javax.swing.JMenuItem { |
1080 |
public static class MenuItem extends javax.swing.JMenuItem implements DynamicMenuContent { |
1108 |
static final long serialVersionUID = -21757335363267194L; |
1081 |
static final long serialVersionUID = -21757335363267194L; |
1109 |
|
1082 |
private Actions.Bridge bridge; |
1110 |
/** Constructs a new menu item with the specified label |
1083 |
/** Constructs a new menu item with the specified label |
1111 |
* and no keyboard shortcut and connects it to the given SystemAction. |
1084 |
* and no keyboard shortcut and connects it to the given SystemAction. |
1112 |
* @param aAction the action to which this menu item should be connected |
1085 |
* @param aAction the action to which this menu item should be connected |
Lines 1124-1129
Link Here
|
1124 |
public MenuItem(Action aAction, boolean useMnemonic) { |
1097 |
public MenuItem(Action aAction, boolean useMnemonic) { |
1125 |
Actions.connect(this, aAction, !useMnemonic); |
1098 |
Actions.connect(this, aAction, !useMnemonic); |
1126 |
} |
1099 |
} |
|
|
1100 |
|
1101 |
void setBridge(Actions.Bridge br) { |
1102 |
bridge = br; |
1103 |
} |
1104 |
|
1105 |
public JComponent[] synchMenuPresenters(JComponent[] items) { |
1106 |
return getMenuPresenters(); |
1107 |
} |
1108 |
|
1109 |
public JComponent[] getMenuPresenters() { |
1110 |
if (bridge != null) { |
1111 |
bridge.updateState(null); |
1112 |
} |
1113 |
return new JComponent[] {this}; |
1114 |
} |
1115 |
|
1127 |
} |
1116 |
} |
1128 |
|
1117 |
|
1129 |
/** CheckboxMenuItem extends the java.awt.CheckboxMenuItem and adds |
1118 |
/** CheckboxMenuItem extends the java.awt.CheckboxMenuItem and adds |
Lines 1207-1231
Link Here
|
1207 |
return this.getPreferredSize(); |
1196 |
return this.getPreferredSize(); |
1208 |
} |
1197 |
} |
1209 |
} |
1198 |
} |
|
|
1199 |
|
1210 |
|
1200 |
|
1211 |
/** SubMenu provides easy way of displaying submenu items based on |
1201 |
/** SubMenu provides easy way of displaying submenu items based on |
1212 |
* SubMenuModel. |
1202 |
* SubMenuModel. |
1213 |
*/ |
1203 |
*/ |
1214 |
public static class SubMenu extends org.openide.awt.JMenuPlus { |
1204 |
public static class SubMenu extends JMenu implements DynamicMenuContent { |
1215 |
static final long serialVersionUID = -4446966671302959091L; |
1205 |
static final long serialVersionUID = -4446966671302959091L; |
1216 |
|
1206 |
|
1217 |
/** number of previous sub items */ |
|
|
1218 |
int previousCount = -1; |
1219 |
|
1220 |
/** listener to remove from this menu or <CODE>null</CODE> */ |
1221 |
ActionListener oneItemListener; |
1222 |
|
1223 |
/** The keystroke which acts as the menu's accelerator. |
1224 |
* This menu can have an accelerator! */ |
1225 |
private KeyStroke accelerator; |
1226 |
|
1227 |
/** The model of the submenu used in menuitem generation */ |
1228 |
private SubMenuModel subModel; |
1229 |
private SubMenuBridge bridge; |
1207 |
private SubMenuBridge bridge; |
1230 |
|
1208 |
|
1231 |
/** Constructs a new ActMenuItem with the specified label |
1209 |
/** Constructs a new ActMenuItem with the specified label |
Lines 1257-1416
Link Here
|
1257 |
* @param popup whether this is a popup menu |
1235 |
* @param popup whether this is a popup menu |
1258 |
*/ |
1236 |
*/ |
1259 |
public SubMenu(Action aAction, SubMenuModel model, boolean popup) { |
1237 |
public SubMenu(Action aAction, SubMenuModel model, boolean popup) { |
1260 |
subModel = model; |
1238 |
bridge = new SubMenuBridge(new JMenuItem(), this, aAction, model, popup); |
1261 |
bridge = new SubMenuBridge(this, aAction, model, popup); |
|
|
1262 |
|
1239 |
|
1263 |
// set at least the name to have reasonable bounds |
1240 |
// set at least the name to have reasonable bounds |
1264 |
bridge.updateState(Action.NAME); |
1241 |
bridge.updateState(Action.NAME); |
1265 |
} |
1242 |
} |
1266 |
|
1243 |
|
1267 |
// Fixes #26619 |
1244 |
public JComponent[] getMenuPresenters() { |
1268 |
|
1245 |
return bridge.getMenuPresenters(); |
1269 |
/** Overriden to finish initialization of the bridge on demand |
1246 |
} |
1270 |
*/ |
1247 |
|
1271 |
public void addNotify() { |
1248 |
public JComponent[] synchMenuPresenters(JComponent[] items) { |
1272 |
super.addNotify(); |
1249 |
return bridge.synchMenuPresenters(items); |
1273 |
bridge.updateState(null); |
|
|
1274 |
|
1275 |
// Empty SubMenu -> disable |
1276 |
if (subModel.getCount() == 0) { |
1277 |
setEnabled(false); |
1278 |
} |
1279 |
} |
1280 |
|
1281 |
// XXX Overriding processKeyBinding is not a nice solution, used as |
1282 |
// a last resort here to fix the bug. |
1283 |
// #9331. Missed accelerator for Paste action. |
1284 |
|
1285 |
/** Overrides superclass method. |
1286 |
* If it has accelerator delegates processing of it to the first item. */ |
1287 |
protected boolean processKeyBinding(KeyStroke ks, KeyEvent e, int condition, boolean pressed) { |
1288 |
// If it is as accelerator process the doClick binding to the |
1289 |
// first sub-item. |
1290 |
if (ks.equals(accelerator)) { |
1291 |
// Use first item if there is one. |
1292 |
Component[] cs = getMenuComponents(); |
1293 |
|
1294 |
if ((cs.length > 0) && cs[0] instanceof JComponent) { |
1295 |
JComponent comp = (JComponent) cs[0]; |
1296 |
|
1297 |
ActionMap am = comp.getActionMap(); |
1298 |
|
1299 |
if ((am != null) && comp.isEnabled()) { |
1300 |
Action action = am.get("doClick"); // NOI18N |
1301 |
|
1302 |
if (action != null) { |
1303 |
return SwingUtilities.notifyAction(action, ks, e, comp, e.getModifiers()); |
1304 |
} |
1305 |
} |
1306 |
|
1307 |
return false; |
1308 |
} |
1309 |
} |
1310 |
|
1311 |
return super.processKeyBinding(ks, e, condition, pressed); |
1312 |
} |
1313 |
|
1314 |
// XXX #11048. Ugly patch. |
1315 |
// This works for the cases when this menu is in 'menu' |
1316 |
// (not popup), the popup is handled by NbPopupMenuUI hack. This same |
1317 |
// method for popup wouldn't work since NbPopupMenuUI automatically |
1318 |
// passes focus to sub-menu. |
1319 |
|
1320 |
/** Overrides superclass method. Adds a hack for KB menu invokation |
1321 |
* when this <code>JMenu</code> needs to act like <code>JMenuItem</code>. */ |
1322 |
public void processKeyEvent(KeyEvent e, MenuElement[] path, MenuSelectionManager m) { |
1323 |
if ( |
1324 |
(getMenuComponentCount() <= 1) && |
1325 |
java.util.Arrays.equals(path, MenuSelectionManager.defaultManager().getSelectedPath()) && |
1326 |
((e.getKeyCode() == KeyEvent.VK_ENTER) || (e.getKeyCode() == KeyEvent.VK_SPACE)) |
1327 |
) { |
1328 |
ActionListener ac = oneItemListener; |
1329 |
|
1330 |
if (ac != null) { |
1331 |
m.setSelectedPath(new MenuElement[0]); |
1332 |
ac.actionPerformed(new ActionEvent(e.getSource(), 0, null)); |
1333 |
|
1334 |
return; |
1335 |
} |
1336 |
} |
1337 |
|
1338 |
super.processKeyEvent(e, path, m); |
1339 |
} |
1340 |
|
1341 |
/** Request for either MenuUI or MenuItemUI if the only one subitem should not |
1342 |
* use submenu. |
1343 |
*/ |
1344 |
public String getUIClassID() { |
1345 |
if (previousCount == 0) { |
1346 |
return "MenuItemUI"; // NOI18N |
1347 |
} |
1348 |
|
1349 |
return (previousCount == 1) ? "MenuItemUI" : "MenuUI"; // NOI18N |
1350 |
} |
1351 |
|
1352 |
boolean useAccel() { |
1353 |
return subModel.getCount() <= 1; |
1354 |
} |
1355 |
|
1356 |
/** Overrides superclass method to be able to have an accelerator. */ |
1357 |
public void setAccelerator(KeyStroke keyStroke) { |
1358 |
KeyStroke oldAccelerator = accelerator; |
1359 |
this.accelerator = keyStroke; |
1360 |
|
1361 |
// Note: "accelerator" for the bean prop, not Action.ACCELERATOR_KEY == "AcceleratorKey" |
1362 |
firePropertyChange("accelerator", oldAccelerator, accelerator); // NOI18N |
1363 |
} |
1364 |
|
1365 |
/** Overrides superclass method to be able to have an accelerator. */ |
1366 |
public KeyStroke getAccelerator() { |
1367 |
return this.accelerator; |
1368 |
} |
1369 |
|
1370 |
public void menuSelectionChanged(boolean isIncluded) { |
1371 |
if (previousCount <= 1) { |
1372 |
setArmed(isIncluded); // JMenuItem behaviour |
1373 |
} else { |
1374 |
if (isArmed() && !isIncluded) { |
1375 |
setArmed(false); |
1376 |
} |
1377 |
|
1378 |
super.menuSelectionChanged(isIncluded); |
1379 |
} |
1380 |
} |
1381 |
|
1382 |
/** Menu cannot be selected when it represents MenuItem. |
1383 |
*/ |
1384 |
public void setSelected(boolean s) { |
1385 |
// disabled menu cannot be selected |
1386 |
if (isEnabled() || !s) { |
1387 |
super.setSelected(s); |
1388 |
} |
1389 |
} |
1390 |
|
1391 |
/** Seting menu to disabled also sets the item as not selected |
1392 |
*/ |
1393 |
public void setEnabled(boolean e) { |
1394 |
super.setEnabled(e); |
1395 |
|
1396 |
if (!e) { |
1397 |
super.setSelected(false); |
1398 |
} |
1399 |
} |
1400 |
|
1401 |
public void doClick(int pressTime) { |
1402 |
if (!isEnabled()) { |
1403 |
// do nothing if not enabled |
1404 |
return; |
1405 |
} |
1406 |
|
1407 |
if (oneItemListener != null) { |
1408 |
oneItemListener.actionPerformed(null); |
1409 |
} else { |
1410 |
super.doClick(pressTime); |
1411 |
} |
1412 |
} |
1250 |
} |
|
|
1251 |
|
1413 |
} |
1252 |
} |
|
|
1253 |
|
1414 |
|
1254 |
|
1415 |
private static class DisabledButtonFilter extends RGBImageFilter { |
1255 |
private static class DisabledButtonFilter extends RGBImageFilter { |
1416 |
DisabledButtonFilter() { |
1256 |
DisabledButtonFilter() { |