public void testInitOutsideOfEDT() throws Exception { class MyToolbar extends Toolbar implements Runnable { @Override protected void setUI(ComponentUI newUI) { assertTrue("Can only be called in EDT", EventQueue.isDispatchThread()); super.setUI(newUI); } @Override public void setUI(ToolBarUI ui) { assertTrue("Can only be called in EDT", EventQueue.isDispatchThread()); super.setUI(ui); } private void assertUI() throws Exception { EventQueue.invokeAndWait(this); } @Override public void run() { assertNotNull("UI delegate is specified", getUI()); } } assertFalse("We are not in EDT", EventQueue.isDispatchThread()); MyToolbar mt = new MyToolbar(); assertNotNull("Instance created", mt); mt.assertUI(); }
public void testInitOutsideOfEDT() throws Exception { class MyToolbar extends ToolbarWithOverflow implements Runnable { @Override protected void setUI(ComponentUI newUI) { assertTrue("Can only be called in EDT", EventQueue.isDispatchThread()); super.setUI(newUI); } @Override public void setUI(ToolBarUI ui) { assertTrue("Can only be called in EDT", EventQueue.isDispatchThread()); super.setUI(ui); } private void assertUI() throws Exception { EventQueue.invokeAndWait(this); } @Override public void run() { assertNotNull("UI delegate is specified", getUI()); } } assertFalse("We are not in EDT", EventQueue.isDispatchThread()); MyToolbar mt = new MyToolbar(); assertNotNull("Instance created", mt); mt.assertUI(); }
/** * Notification from the <code>UIFactory</code> that the L&F has changed. * Called to replace the UI with the latest version from the * <code>UIFactory</code>. * * @see JComponent#updateUI */ public void updateUI() { setUI((ToolBarUI) UIManager.getUI(this)); // GTKLookAndFeel installs a different LayoutManager, and sets it // to null after changing the look and feel, so, install the default // if the LayoutManager is null. if (getLayout() == null) { setLayout(new DefaultToolBarLayout(getOrientation())); } invalidate(); }
public @Override void setUI(ToolBarUI ui){ addListener = false; super.setUI(ui); addListener = true; }
/** * This method resets the UI used to the Look and Feel defaults. */ public void updateUI() { setUI((ToolBarUI) UIManager.getUI(this)); }
public static void unfloatToolBar(JToolBar tb) { ToolBarUI tbUI = tb.getUI(); if (tbUI instanceof BasicToolBarUI) ((BasicToolBarUI) tbUI).setFloating(false, null); }
public static void floatToolBar(JToolBar tb, Point p) { ToolBarUI tbUI = tb.getUI(); if (tbUI instanceof BasicToolBarUI) ((BasicToolBarUI) tbUI).setFloating(false, p); }
public void setUI(final ToolBarUI ui) { super.setUI(ui); }
public ToolBarUI getUI() { return (ToolBarUI)ui; }
public void updateUI() { setUI((ToolBarUI)UIManager.getUI(this)); }
/** * Returns the tool bar's current UI. * * @see #setUI */ public ToolBarUI getUI() { return (ToolBarUI) null; }
/** * Sets the L&F object that renders this component. * * @param ui * the <code>ToolBarUI</code> L&F object * @see UIDefaults#getUI * @beaninfo bound: true hidden: true attribute: visualUpdate true * description: The UI object that implements the Component's * LookAndFeel. */ public void setUI(ToolBarUI ui) { super.setUI(ui); }
/** * This method returns the UI class used to paint this JToolBar. * * @return The UI class for this JToolBar. */ public ToolBarUI getUI() { return (ToolBarUI) ui; }
/** * This method sets the UI used with the JToolBar. * * @param ui The UI used with the JToolBar. */ public void setUI(ToolBarUI ui) { super.setUI(ui); }