本文整理汇总了Java中javax.swing.plaf.basic.BasicToolBarUI类的典型用法代码示例。如果您正苦于以下问题:Java BasicToolBarUI类的具体用法?Java BasicToolBarUI怎么用?Java BasicToolBarUI使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BasicToolBarUI类属于javax.swing.plaf.basic包,在下文中一共展示了BasicToolBarUI类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import javax.swing.plaf.basic.BasicToolBarUI; //导入依赖的package包/类
@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));
}
}
示例2: unfloatToolBar
import javax.swing.plaf.basic.BasicToolBarUI; //导入依赖的package包/类
public static void unfloatToolBar(JToolBar tb) {
ToolBarUI tbUI = tb.getUI();
if (tbUI instanceof BasicToolBarUI)
((BasicToolBarUI) tbUI).setFloating(false, null);
}
示例3: floatToolBar
import javax.swing.plaf.basic.BasicToolBarUI; //导入依赖的package包/类
public static void floatToolBar(JToolBar tb, Point p) {
ToolBarUI tbUI = tb.getUI();
if (tbUI instanceof BasicToolBarUI)
((BasicToolBarUI) tbUI).setFloating(false, p);
}
示例4: testSetGetUI
import javax.swing.plaf.basic.BasicToolBarUI; //导入依赖的package包/类
public void testSetGetUI() {
BasicToolBarUI ui = new BasicToolBarUI();
toolBar.setUI(ui);
assertSame(ui, toolBar.getUI());
}