javax.swing.plaf.ToolBarUI Java Examples

The following examples show how to use javax.swing.plaf.ToolBarUI. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ToolbarTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example #2
Source File: ToolbarWithOverflowTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
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();
}
 
Example #3
Source File: NbEditorToolBar.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public @Override void setUI(ToolBarUI ui){
    addListener = false;
    super.setUI(ui);
    addListener = true;
}