本文整理了Java中javax.swing.JToolBar.getParent()
方法的一些代码示例,展示了JToolBar.getParent()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JToolBar.getParent()
方法的具体详情如下:
包路径:javax.swing.JToolBar
类名称:JToolBar
方法名:getParent
暂无
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-swingapp
public void setToolBar(JToolBar toolBar) {
Container contentPane = getContentPane();
if (this.toolBar != null && this.toolBar.getParent() == contentPane) {
contentPane.remove(this.toolBar);
}
this.toolBar = toolBar;
if (toolBar != null) {
contentPane.add(toolBar, BorderLayout.PAGE_START);
}
}
代码示例来源:origin: abbot/abbot
/** @return whether the bar is currently floating. */
public boolean isFloating(JToolBar bar) {
ToolBarUI ui = bar.getUI();
if (ui instanceof BasicToolBarUI)
return ((BasicToolBarUI)ui).isFloating();
// Have to guess; probably ought to check for sibling components
Window w = SwingUtilities.getWindowAncestor(bar);
return !(w instanceof Frame)
&& bar.getParent().getComponentCount() == 1;
}
/** Drag the tool bar to the given location, causing it to float.
代码示例来源:origin: com.github.houbie/rhino-mod
public void componentAdded(ContainerEvent e) {
Component thisParent = finalThis.getParent();
JSplitPane split = (JSplitPane)thisParent;
if (e.getChild() == finalT1) {
if (finalT2.getParent() == finalP2) {
// both docked
finalSplit.setDividerLocation(0.5);
} else {
// left docked only
finalSplit.setDividerLocation(1.0);
}
split.setDividerLocation(0.66);
}
}
public void componentRemoved(ContainerEvent e) {
代码示例来源:origin: com.github.tntim96/rhino
public void componentRemoved(ContainerEvent e) {
Component thisParent = finalThis.getParent();
JSplitPane split = (JSplitPane)thisParent;
if (e.getChild() == finalT1) {
if (finalT2.getParent() == finalP2) {
// right docked only
finalSplit.setDividerLocation(0.0);
split.setDividerLocation(0.66);
} else {
// both undocked
split.setDividerLocation(1.0);
}
}
}
});
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
public void componentRemoved(ContainerEvent e) {
Component thisParent = finalThis.getParent();
JSplitPane split = (JSplitPane)thisParent;
if (e.getChild() == finalT1) {
if (finalT2.getParent() == finalP2) {
// right docked only
finalSplit.setDividerLocation(0.0);
split.setDividerLocation(0.66);
} else {
// both undocked
split.setDividerLocation(1.0);
}
}
}
});
代码示例来源:origin: com.github.houbie/rhino-mod
public void componentRemoved(ContainerEvent e) {
Component thisParent = finalThis.getParent();
JSplitPane split = (JSplitPane)thisParent;
if (e.getChild() == finalT1) {
if (finalT2.getParent() == finalP2) {
// right docked only
finalSplit.setDividerLocation(0.0);
split.setDividerLocation(0.66);
} else {
// both undocked
split.setDividerLocation(1.0);
}
}
}
});
代码示例来源:origin: org.jvnet.hudson/embedded-rhino-debugger
public void componentAdded(ContainerEvent e) {
Component thisParent = finalThis.getParent();
JSplitPane split = (JSplitPane)thisParent;
if (e.getChild() == finalT1) {
if (finalT2.getParent() == finalP2) {
// both docked
finalSplit.setDividerLocation(0.5);
} else {
// left docked only
finalSplit.setDividerLocation(1.0);
}
split.setDividerLocation(0.66);
}
}
public void componentRemoved(ContainerEvent e) {
代码示例来源:origin: com.github.tntim96/rhino
public void componentAdded(ContainerEvent e) {
Component thisParent = finalThis.getParent();
JSplitPane split = (JSplitPane)thisParent;
if (e.getChild() == finalT1) {
if (finalT2.getParent() == finalP2) {
// both docked
finalSplit.setDividerLocation(0.5);
} else {
// left docked only
finalSplit.setDividerLocation(1.0);
}
split.setDividerLocation(0.66);
}
}
public void componentRemoved(ContainerEvent e) {
代码示例来源:origin: ro.isdc.wro4j/rhino
public void componentAdded(ContainerEvent e) {
Component thisParent = finalThis.getParent();
JSplitPane split = (JSplitPane)thisParent;
if (e.getChild() == finalT1) {
if (finalT2.getParent() == finalP2) {
// both docked
finalSplit.setDividerLocation(0.5);
} else {
// left docked only
finalSplit.setDividerLocation(1.0);
}
split.setDividerLocation(0.66);
}
}
public void componentRemoved(ContainerEvent e) {
代码示例来源:origin: ro.isdc.wro4j/rhino
public void componentRemoved(ContainerEvent e) {
Component thisParent = finalThis.getParent();
JSplitPane split = (JSplitPane)thisParent;
if (e.getChild() == finalT1) {
if (finalT2.getParent() == finalP2) {
// right docked only
finalSplit.setDividerLocation(0.0);
split.setDividerLocation(0.66);
} else {
// both undocked
split.setDividerLocation(1.0);
}
}
}
});
代码示例来源:origin: joel-costigliola/assertj-swing
@RunsInCurrentThread
static boolean isJToolBarFloating(@Nonnull JToolBar toolBar) {
ToolBarUI ui = toolBar.getUI();
if (ui instanceof BasicToolBarUI) {
return ((BasicToolBarUI) ui).isFloating();
}
// Have to guess; probably ought to check for sibling components
Window w = getWindowAncestor(toolBar);
return !(w instanceof Frame) && toolBar.getParent().getComponentCount() == 1;
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
public ToolBarPrefsHandler(JToolBar toolbar, String prefsPrefix, Preferences prefs) {
this.toolbar = toolbar;
this.prefsPrefix = prefsPrefix;
this.prefs = prefs;
String constraint = prefs.get(prefsPrefix+".constraint", BorderLayout.NORTH);
int orientation = (constraint.equals(BorderLayout.NORTH) || constraint.equals(BorderLayout.SOUTH)) ? JToolBar.HORIZONTAL : JToolBar.VERTICAL;
toolbar.setOrientation(orientation);
toolbar.getParent().add(constraint, toolbar);
toolbar.setVisible(prefs.getBoolean(prefsPrefix+".visible", true));
/*
if (prefs.getBoolean(prefsPrefix+".isFloating", false)) {
makeToolBarFloat();
}*/
toolbar.addComponentListener(this);
toolbar.addAncestorListener(this);
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
protected DragWindow createMyDragWindow(JToolBar toolbar)
{
Window frame= null;
if (toolBar != null)
{
Container p;
for (p= toolBar.getParent();
p != null && !(p instanceof Window);
p= p.getParent());
if (p != null && p instanceof Window)
frame= (Window) p;
}
if (floatingToolBar == null)
{
floatingToolBar= createFloatingWindow(toolBar);
}
if (floatingToolBar instanceof Window)
frame= (Window) floatingToolBar;
DragWindow dragWindow= new DragWindow(frame);
return dragWindow;
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setTop(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustTop(this, aValue);
}
super.setLocation(getLeft(), aValue);
}
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction
@Override
public void setLeft(int aValue) {
if (super.getParent() != null && super.getParent().getLayout() instanceof MarginLayout) {
MarginLayout.ajustLeft(this, aValue);
}
super.setLocation(aValue, getTop());
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
protected DragWindow createDragWindow(JToolBar toolbar) {
Window frame = null;
if (toolBar != null) {
Container p;
for (p = toolBar.getParent(); p != null && !(p instanceof Window); p = p.getParent()) {
}
frame = (Window) p;
}
if (floatingToolBar == null) {
floatingToolBar = createFloatingWindow(toolBar);
}
if (floatingToolBar instanceof Window) {
frame = (Window) floatingToolBar;
}
DragWindow w = new DragWindow(frame);
JRootPane rp = ((RootPaneContainer) w).getRootPane();
rp.putClientProperty("Window.alpha", new Float(0.6f));
return w;
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
prefs.putInt(prefsPrefix+".floatingX", window.getX());
prefs.putInt(prefsPrefix+".floatingY", window.getY());
} else if (toolbar.getParent() != null) {
int x = toolbar.getX();
int y = toolbar.getY();
Insets insets = toolbar.getParent().getInsets();
String constraint;
if (x == insets.left && y == insets.top) {
if (toolbar.getParent() != null) {
int x = toolbar.getX();
int y = toolbar.getY();
Insets insets = toolbar.getParent().getInsets();
String constraint;
if (x == insets.left && y == insets.top) {
代码示例来源:origin: pentaho/pentaho-reporting
private void closeToolbar() {
if ( toolBar == null ) {
return;
}
if ( toolBar.getParent() != toolbarHolder ) {
// ha!, we detected that the toolbar is floating ...
// Log.debug (currentToolbar.getParent());
final Window w = SwingUtilities.windowForComponent( toolBar );
if ( w != null ) {
w.setVisible( false );
w.dispose();
}
}
toolBar.setVisible( false );
}
代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw
Integer constraint = constraintBeforeFloating;
if (dockingSource == null) {
dockingSource = toolBar.getParent();
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/toniclf
public void windowClosing(WindowEvent w)
{
if (toolBar.isFloatable() == true)
{
if (dragWindow != null)
dragWindow.setVisible(false);
floating= false;
if (floatingToolBar == null)
floatingToolBar= createFloatingWindow(toolBar);
if (floatingToolBar instanceof Window)
((Window) floatingToolBar).setVisible(false);
floatingToolBar.getContentPane().remove(toolBar);
String constraint= constraintBeforeFloating;
int orientation= mapConstraintToOrientation(constraint);
setOrientation(orientation);
if (dockingSource == null)
dockingSource= toolBar.getParent();
if (propertyListener != null)
UIManager.removePropertyChangeListener(propertyListener);
dockingSource.add(constraint, toolBar);
dockingSource.invalidate();
Container dockingSourceParent= dockingSource.getParent();
if (dockingSourceParent != null)
dockingSourceParent.validate();
dockingSource.repaint();
setFloating(false, null);
}
}
内容来源于网络,如有侵权,请联系作者删除!