public JMenuPlus(String label) { super(label); enableInputMethods(false); getAccessibleContext().setAccessibleDescription(label); }
boolean isVisible = isPopupMenuVisible(); if (b != isVisible) { if ((b==true) && isShowing()) { JPopupMenu popup = getPopupMenu(); getPopupMenu().show(this, p.x, p.y); } else { Point p = getPopupMenuOrigin(); popup.show(this, p.x, p.y); getPopupMenu().setVisible(false);
int x = 0; int y = 0; JPopupMenu pm = getPopupMenu(); Rectangle screenRect = JPopupMenuUtils.getScreenRect(); Dimension s = getSize(); Dimension pmSize = pm.getSize(); int screenRight = screenRect.x + screenRect.width; pmSize = pm.getPreferredSize(); Point position = getLocationOnScreen(); Container parent = getParent(); if (parent instanceof JPopupMenu) {
public JPopupMenu getPopupMenu() { JPopupMenu popup = super.getPopupMenu(); fillSubmenu(popup); return popup; }
public JMenuItem getPopupPresenter() { JMenu mainItem = new JMenuPlus(); Mnemonics.setLocalizedText(mainItem, getName()); HelpCtx.setHelpIDString (mainItem, ImportAction.class.getName()); mainItem.addMenuListener(new MainItemListener()); return mainItem; }
/** Checks for {@link MouseEvent#isPopupTrigger right click} to ask the acceptor whether * to accept the selection. * @param e the mouse event * @param path used by the superclass * @param manager used by the superclass */ public void processMouseEvent(MouseEvent e, MenuElement[] path, MenuSelectionManager manager) { super.processMouseEvent (e, path, manager); if (e.isPopupTrigger () && action.acceptNodes (new Node[] { node })) { MenuSelectionManager.defaultManager ().clearSelectedPath (); } }
!ks.isOnKeyRelease()); boolean result = super.processKeyBinding (newStroke, newEvent, condition, pressed); return super.processKeyBinding (ks, e, condition, pressed); } else { return false; return super.processKeyBinding (ks, e, condition, pressed);
/** Overriden to finish initialization of the bridge on demand */ public void addNotify() { super.addNotify(); bridge.updateState (null); // Empty SubMenu -> disable if (subModel.getCount() == 0) setEnabled(false); }
public void doClick(int pressTime) { if (!isEnabled ()) { // do nothing if not enabled return; } if (oneItemListener != null) { oneItemListener.actionPerformed (null); } else { super.doClick (pressTime); } } }
boolean isVisible = isPopupMenuVisible(); if (b != isVisible) { if ((b==true) && isShowing()) { JPopupMenu popup = getPopupMenu(); getPopupMenu().show(this, p.x, p.y); } else { Point p = getPopupMenuOrigin(); popup.show(this, p.x, p.y); getPopupMenu().setVisible(false);
int x = 0; int y = 0; JPopupMenu pm = getPopupMenu(); Rectangle screenRect = JPopupMenuUtils.getScreenRect(); Dimension s = getSize(); Dimension pmSize = pm.getSize(); int screenRight = screenRect.x + screenRect.width; pmSize = pm.getPreferredSize(); Point position = getLocationOnScreen(); Container parent = getParent(); if (parent instanceof JPopupMenu) {
/** Overriden to fill the submenu with the real content lazily */ public JPopupMenu getPopupMenu() { final JPopupMenu popup = super.getPopupMenu(); fillSubmenu(popup); return popup; }
public JMenuItem getMenuPresenter () { JMenu mainItem = new JMenuPlus(); Mnemonics.setLocalizedText(mainItem, getName()); mainItem.setIcon (SystemAction.get(ImportAction.class).getIcon()); HelpCtx.setHelpIDString (mainItem, ImportAction.class.getName()); mainItem.addMenuListener(new MainItemListener()); return mainItem; }
/** Checks for {@link MouseEvent#isPopupTrigger right click} to ask the acceptor whether * to accept the selection. * @param e the mouse event * @param path used by the superclass * @param manager used by the superclass */ public void processMouseEvent(MouseEvent e, MenuElement[] path, MenuSelectionManager manager) { super.processMouseEvent (e, path, manager); if (e.isPopupTrigger () && action.acceptNodes (new Node[] { node })) { MenuSelectionManager.defaultManager ().clearSelectedPath (); } }
/** Overrides superclass method. * If it has accelerator delegates processing of it to the first item. */ protected boolean processKeyBinding( KeyStroke ks, KeyEvent e, int condition, boolean pressed) { // If it is as accelerator process the doClick binding to the // first sub-item. if(ks.equals(accelerator)) { // Use first item if there is one. Component[] cs = getMenuComponents(); if(cs.length > 0 && cs[0] instanceof JComponent) { JComponent comp = (JComponent)cs[0]; ActionMap am = comp.getActionMap(); if(am != null && comp.isEnabled()) { Action action = am.get("doClick"); // NOI18N if (action != null) { return SwingUtilities.notifyAction( action, ks, e, comp, e.getModifiers()); } } return false; } } return super.processKeyBinding(ks, e, condition, pressed); }
/** Overriden to finish initialization of the bridge on demand */ public void addNotify() { super.addNotify(); bridge.updateState (null); // Empty SubMenu -> disable if (subModel.getCount() == 0) setEnabled(false); }
public void doClick(int pressTime) { if (!isEnabled ()) { // do nothing if not enabled return; } if (oneItemListener != null) { oneItemListener.actionPerformed (null); } else { super.doClick (pressTime); } } }
public JPopupMenu getPopupMenu() { JPopupMenu popup = super.getPopupMenu(); fillSubmenu(popup); return popup; }
public JMenuPlus(String label) { super(label); enableInputMethods(false); getAccessibleContext().setAccessibleDescription(label); }
JMenu menu = new org.openide.awt.JMenuPlus(); Actions.setMenuText(menu, getName(), true); menu.setHorizontalTextPosition(JMenu.RIGHT);