public MenuBar getMenuBar() { final ImageJ ij1 = hasInstance() ? IJ.getInstance() : null; return ij1 == null ? null : ij1.getMenuBar(); }
static Runnable getX11Opener() throws NoSuchMethodException { @SuppressWarnings("deprecation") final Method method = IJ.getInstance().getMenuBar() .getPeer().getClass() .getDeclaredMethod("handleF10KeyPress", new Class[] { KeyEvent.class }); method.setAccessible(true); return new Runnable() { @SuppressWarnings("deprecation") @Override public void run() { final ImageJ ij = IJ.getInstance(); if (ij == null ||!ij.isFocused()) return; KeyEvent event = new KeyEvent(IJ.getInstance(), KeyEvent.VK_F10, System.currentTimeMillis(), 0, KeyEvent.VK_F10, KeyEvent.CHAR_UNDEFINED); try { method.invoke(ij.getMenuBar().getPeer(), new Object[] { event }); } catch (Exception e) { /* ignore */ } } }; }
@SuppressWarnings("deprecation") @Override public void run() { final ImageJ ij = IJ.getInstance(); if (ij == null ||!ij.isFocused()) return; KeyEvent event = new KeyEvent(IJ.getInstance(), KeyEvent.VK_F10, System.currentTimeMillis(), 0, KeyEvent.VK_F10, KeyEvent.CHAR_UNDEFINED); try { method.invoke(ij.getMenuBar().getPeer(), new Object[] { event }); } catch (Exception e) { /* ignore */ } } };
public void windowActivated(WindowEvent e) { if (IJ.isMacintosh() && !quitting) { IJ.wait(10); // may be needed for Java 1.4 on OS X MenuBar mb = Menus.getMenuBar(); if (mb!=null && mb!=getMenuBar()) { setMenuBar(mb); Menus.setMenuBarCount++; if (IJ.debugMode) IJ.log("setMenuBar: "+Menus.setMenuBarCount); } } }
public void windowActivated(WindowEvent e) { if (IJ.isMacintosh() && !quitting) { IJ.wait(10); // may be needed for Java 1.4 on OS X MenuBar mb = Menus.getMenuBar(); if (mb!=null && mb!=getMenuBar()) { setMenuBar(mb); Menus.setMenuBarCount++; if (IJ.debugMode) IJ.log("setMenuBar: "+Menus.setMenuBarCount); } } }