本文整理汇总了Java中javax.swing.JToolBar.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java JToolBar.getParent方法的具体用法?Java JToolBar.getParent怎么用?Java JToolBar.getParent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JToolBar
的用法示例。
在下文中一共展示了JToolBar.getParent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: stealJToolBarFromOntologyClassEditorJPanel
import javax.swing.JToolBar; //导入方法依赖的package包/类
/**
* Steal the components of a JToolBar for a {@link OntologyClassEditorJPanel}.
* @param ocep the OntologyClassEditorJPanel
*/
private void stealJToolBarFromOntologyClassEditorJPanel(OntologyClassEditorJPanel ocep) {
if (ocep==null) return;
if (this.jToolBar4UserFunction==null) return;
JToolBar jToolBarUserFunctions = ocep.getJToolBarUserFunctions();
if (jToolBarUserFunctions!=null) {
Container containerUserFunctions = jToolBarUserFunctions.getParent();
while (jToolBarUserFunctions.getComponentCount()>0) {
Component comp = jToolBarUserFunctions.getComponent(0);
this.getStolenComponentsFromJToolBarOfOntologyClassEditorJPanel().add(comp);
jToolBarUserFunctions.remove(comp);
}
if (containerUserFunctions!=null) {
containerUserFunctions.remove(jToolBarUserFunctions);
}
ocep.validate();
ocep.repaint();
}
}
示例2: resolveToolbarConstraint
import javax.swing.JToolBar; //导入方法依赖的package包/类
/**
* Package private method which returns either BorderLayout.NORTH,
* BorderLayout.SOUTH, BorderLayout.EAST, or BorderLayout.WEST depending
* on the location of the toolbar in its parent. The toolbar might be
* in PAGE_START, PAGE_END, CENTER, or some other position, but will be
* resolved to either NORTH,SOUTH,EAST, or WEST based on where the toolbar
* actually IS, with CENTER being NORTH.
*
* This code is used to determine where the border line should be drawn
* by the custom toolbar states, and also used by NimbusIcon to determine
* whether the handle icon needs to be shifted to look correct.
*
* Toollbars are unfortunately odd in the way these things are handled,
* and so this code exists to unify the logic related to toolbars so it can
* be shared among the static files such as NimbusIcon and generated files
* such as the ToolBar state classes.
*/
static Object resolveToolbarConstraint(JToolBar toolbar) {
//NOTE: we don't worry about component orientation or PAGE_END etc
//because the BasicToolBarUI always uses an absolute position of
//NORTH/SOUTH/EAST/WEST.
if (toolbar != null) {
Container parent = toolbar.getParent();
if (parent != null) {
LayoutManager m = parent.getLayout();
if (m instanceof BorderLayout) {
BorderLayout b = (BorderLayout)m;
Object con = b.getConstraints(toolbar);
if (con == SOUTH || con == EAST || con == WEST) {
return con;
}
return NORTH;
}
}
}
return NORTH;
}