public void testIsPopupTrigger() { class MyPopupMenuUI extends PopupMenuUI { public boolean value = false; @Override public boolean isPopupTrigger(final MouseEvent event) { return value; } } ; MyPopupMenuUI fakeUI = new MyPopupMenuUI(); popup.setUI(fakeUI); assertSame(fakeUI, popup.getUI()); fakeUI.value = true; assertEquals(fakeUI.value, popup.isPopupTrigger(null)); fakeUI.value = false; assertEquals(fakeUI.value, popup.isPopupTrigger(null)); }
/** * Invokes the <code>isPopupTrigger</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> * @since 1.3 */ public boolean isPopupTrigger(MouseEvent a) { boolean returnValue = ((PopupMenuUI) (uis.elementAt(0))).isPopupTrigger(a); for (int i = 1; i < uis.size(); i++) { ((PopupMenuUI) (uis.elementAt(i))).isPopupTrigger(a); } return returnValue; }
/** * Invokes the <code>getPopup</code> method on each UI handled by this object. * * @return the value obtained from the first UI, which is * the UI obtained from the default <code>LookAndFeel</code> * @since 1.4 */ public Popup getPopup(JPopupMenu a, int b, int c) { Popup returnValue = ((PopupMenuUI) (uis.elementAt(0))).getPopup(a,b,c); for (int i = 1; i < uis.size(); i++) { ((PopupMenuUI) (uis.elementAt(i))).getPopup(a,b,c); } return returnValue; }
/** * Maps {@code JPopupMenu.getUI()} through queue */ public PopupMenuUI getUI() { return (runMapping(new MapAction<PopupMenuUI>("getUI") { @Override public PopupMenuUI map() { return ((JPopupMenu) getSource()).getUI(); } })); }
/** * Maps {@code JPopupMenu.setUI(PopupMenuUI)} through queue */ public void setUI(final PopupMenuUI popupMenuUI) { runMapping(new MapVoidAction("setUI") { @Override public void map() { ((JPopupMenu) getSource()).setUI(popupMenuUI); } }); }
@Override public void updateUI() { setUI((MenuItemUI) UIManager.getUI(this)); if(popupMenu != null) { popupMenu.setUI((PopupMenuUI) UIManager.getUI(popupMenu)); } }
@Override public void updateUI() { setUI((MenuItemUI) UIManager.getUI(this)); if (popupMenu != null) { popupMenu.setUI((PopupMenuUI) UIManager.getUI(popupMenu)); } }
public TiledImageJMenu(String text, ImageInfoReader imageInfoReader) { super(text); tileImage = getTiledImage(imageInfoReader); getPopupMenu().setUI(new PopupMenuUI() { @Override public void paint(Graphics g, JComponent c) { TiledImagePainter.paintComponent(c, g, tileImage); super.paint(g, c); } }); }
@Override public Popup getPopup(JPopupMenu popup, int x, int y) { for (int i = 1; i < numberOfUIs; i++) { ((PopupMenuUI) uis.get(i)).getPopup(popup, x, y); } return ((PopupMenuUI) uis.firstElement()).getPopup(popup, x, y); }
@Override public boolean isPopupTrigger(MouseEvent event) { for (int i = 1; i < numberOfUIs; i++) { ((PopupMenuUI) uis.get(i)).isPopupTrigger(event); } return ((PopupMenuUI) uis.firstElement()).isPopupTrigger(event); }