Java 类javax.swing.plaf.basic.BasicToolBarUI 实例源码

项目:java-swing-tips    文件:MainPanel.java   
@Override public void actionPerformed(ActionEvent e) {
    Component root = null;
    Container parent = SwingUtilities.getUnwrappedParent((Component) e.getSource());
    if (parent instanceof JPopupMenu) {
        JPopupMenu popup = (JPopupMenu) parent;
        root = SwingUtilities.getRoot(popup.getInvoker());
    } else if (parent instanceof JToolBar) {
        JToolBar toolbar = (JToolBar) parent;
        if (((BasicToolBarUI) toolbar.getUI()).isFloating()) {
            root = SwingUtilities.getWindowAncestor(toolbar).getOwner();
        } else {
            root = SwingUtilities.getRoot(toolbar);
        }
    } else {
        root = SwingUtilities.getRoot(parent);
    }
    if (root instanceof Window) {
        Window window = (Window) root;
        window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING));
    }
}
项目:java-swing-tips    文件:MainPanel.java   
@Override public void actionPerformed(ActionEvent e) {
    Component root = null;
    Container parent = SwingUtilities.getUnwrappedParent((Component) e.getSource());
    if (parent instanceof JPopupMenu) {
        JPopupMenu popup = (JPopupMenu) parent;
        root = SwingUtilities.getRoot(popup.getInvoker());
    } else if (parent instanceof JToolBar) {
        JToolBar toolbar = (JToolBar) parent;
        if (((BasicToolBarUI) toolbar.getUI()).isFloating()) {
            root = SwingUtilities.getWindowAncestor(toolbar).getOwner();
        } else {
            root = SwingUtilities.getRoot(toolbar);
        }
    } else {
        root = SwingUtilities.getRoot(parent);
    }
    if (root instanceof Window) {
        Window window = (Window) root;
        window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_CLOSING));
    }
}
项目:oStorybook    文件:SwingUtil.java   
public static void unfloatToolBar(JToolBar tb) {
    ToolBarUI tbUI = tb.getUI();
    if (tbUI instanceof BasicToolBarUI)
        ((BasicToolBarUI) tbUI).setFloating(false, null);
}
项目:oStorybook    文件:SwingUtil.java   
public static void floatToolBar(JToolBar tb, Point p) {
    ToolBarUI tbUI = tb.getUI();
    if (tbUI instanceof BasicToolBarUI)
        ((BasicToolBarUI) tbUI).setFloating(false, p);
}
项目:SE-410-Project    文件:SwingUtil.java   
public static void unfloatToolBar(JToolBar tb) {
    ToolBarUI tbUI = tb.getUI();
    if (tbUI instanceof BasicToolBarUI)
        ((BasicToolBarUI) tbUI).setFloating(false, null);
}
项目:SE-410-Project    文件:SwingUtil.java   
public static void floatToolBar(JToolBar tb, Point p) {
    ToolBarUI tbUI = tb.getUI();
    if (tbUI instanceof BasicToolBarUI)
        ((BasicToolBarUI) tbUI).setFloating(false, p);
}
项目:cn1    文件:JToolBarTest.java   
public void testSetGetUI() {
    BasicToolBarUI ui = new BasicToolBarUI();
    toolBar.setUI(ui);
    assertSame(ui, toolBar.getUI());
}
项目:freeVM    文件:JToolBarTest.java   
public void testSetGetUI() {
    BasicToolBarUI ui = new BasicToolBarUI();
    toolBar.setUI(ui);
    assertSame(ui, toolBar.getUI());
}
项目:freeVM    文件:JToolBarTest.java   
public void testSetGetUI() {
    BasicToolBarUI ui = new BasicToolBarUI();
    toolBar.setUI(ui);
    assertSame(ui, toolBar.getUI());
}