本文整理了Java中javax.swing.JSplitPane.getHeight()
方法的一些代码示例,展示了JSplitPane.getHeight()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSplitPane.getHeight()
方法的具体详情如下:
包路径:javax.swing.JSplitPane
类名称:JSplitPane
方法名:getHeight
暂无
代码示例来源:origin: com.eas.platypus/platypus-js-forms
@ScriptFunction(jsDoc = HEIGHT_JSDOC)
@Override
public int getHeight() {
return super.getHeight();
}
代码示例来源:origin: net.sf.squirrel-sql.plugins/graph
private void onShow(JPanel panel, int lastHeight)
{
_split.setBottomComponent(panel);
_split.setDividerLocation(_split.getHeight() - lastHeight - _standardDividerSize - 1);
_split.setDividerSize(_standardDividerSize);
}
代码示例来源:origin: joel-costigliola/assertj-swing
@RunsInCurrentThread
@Nonnull private static GenericRange<Point> whereToMoveDividerHorizontally(@Nonnull JSplitPane splitPane, int location) {
int y = splitPane.getHeight() / 2;
int dividerLocation = splitPane.getDividerLocation();
return new GenericRange<Point>(new Point(dividerLocation, y), new Point(location, y));
}
代码示例来源:origin: de.richtercloud/flexdock-core
public static int getSplitPaneSize(JSplitPane splitPane) {
if(splitPane==null) {
return 0;
}
boolean horiz = splitPane.getOrientation()==JSplitPane.HORIZONTAL_SPLIT? true: false;
return horiz? splitPane.getWidth(): splitPane.getHeight();
}
代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf
break;
case BOTTOM:
splitPane.setDividerLocation(splitPane.getHeight() - animatingHeight);
break;
代码示例来源:origin: nativelibs4java/JNAerator
void switchOrientation() {
boolean hor = sp.getOrientation() == JSplitPane.HORIZONTAL_SPLIT;
int l = sp.getDividerLocation(), d = hor ? sp.getWidth() : sp.getHeight();
sp.setOrientation(hor ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);
if (d != 0) {
sp.setDividerLocation(l / (double) d);
}
}
Action switchOrientationAction = new AbstractAction("Switch Orientation") {
代码示例来源:origin: com.nativelibs4java/jnaerator
void switchOrientation() {
boolean hor = sp.getOrientation() == JSplitPane.HORIZONTAL_SPLIT;
int l = sp.getDividerLocation(), d = hor ? sp.getWidth() : sp.getHeight();
sp.setOrientation(hor ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);
if (d != 0) {
sp.setDividerLocation(l / (double) d);
}
}
Action switchOrientationAction = new AbstractAction("Switch Orientation") {
代码示例来源:origin: freeplane/freeplane
public void layoutContainer(Container parent) {
final JSplitPane splitPane = (JSplitPane) parent;
if(isDividerRequired(splitPane)){
lm.layoutContainer(parent);
return;
}
final Component leftComponent = splitPane.getLeftComponent();
for(int i = 0; i < splitPane.getComponentCount(); i++){
final Component component = splitPane.getComponent(i);
if(component.equals(leftComponent)){
component.setBounds(0, 0, splitPane.getWidth(), splitPane.getHeight());
}
else{
component.setBounds(0, 0, 0, 0);
}
}
}
代码示例来源:origin: nativelibs4java/JNAerator
protected static double getProportionalDividerLocation(JSplitPane sp) {
boolean hor = sp.getOrientation() == JSplitPane.HORIZONTAL_SPLIT;
int l = sp.getDividerLocation(), d = hor ? sp.getWidth() : sp.getHeight();
sp.setOrientation(hor ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);
return d != 0 ? l / (double) d : 0.5;
}
}
代码示例来源:origin: dhale/jtk
public void paintToRect(Graphics2D g2d, int x, int y, int w, int h) {
if (_split==null) {
_panelTL.paintToRect(g2d,x,y,w,h);
} else {
double ws = (double)w/(double)_splitPane.getWidth();
double hs = (double)h/(double)_splitPane.getHeight();
int nc = _splitPane.getComponentCount();
for (int ic=0; ic<nc; ++ic) {
Component c = _splitPane.getComponent(ic);
int xc = c.getX();
int yc = c.getY();
int wc = c.getWidth();
int hc = c.getHeight();
xc = (int)round(xc*ws);
yc = (int)round(yc*hs);
wc = (int)round(wc*ws);
hc = (int)round(hc*hs);
if (c instanceof IPanel) {
IPanel ip = (IPanel)c;
ip.paintToRect(g2d,xc,yc,wc,hc);
}
}
}
}
}
代码示例来源:origin: com.nativelibs4java/jnaerator
protected static double getProportionalDividerLocation(JSplitPane sp) {
boolean hor = sp.getOrientation() == JSplitPane.HORIZONTAL_SPLIT;
int l = sp.getDividerLocation(), d = hor ? sp.getWidth() : sp.getHeight();
sp.setOrientation(hor ? JSplitPane.VERTICAL_SPLIT : JSplitPane.HORIZONTAL_SPLIT);
return d != 0 ? l / (double) d : 0.5;
}
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf
/**
* Gets the PreferredSize attribute of the GtkSplitPane object
*
* @param splitpane Description of Parameter
* @return The PreferredSize value
*/
public Dimension getPreferredSize(JSplitPane splitpane) {
Insets insets = splitpane.getInsets();
int width = 0;
int height = 0;
if (splitpane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
width = Math.max(Math.max(up.getWidth(), down.getWidth()), 10);
height = splitpane.getHeight() + insets.top + insets.bottom;
}
else {
height = Math.max(Math.max(left.getHeight(), right.getHeight()), 10);
width = splitpane.getWidth() + insets.left + insets.right;
}
Dimension d = new Dimension(width, height);
return (d);
//return (splitpane.getOrientation() == JSplitPane.VERTICAL_SPLIT)
// ? new Dimension(Math.max(10, Math.min(up.getWidth(), v_thumb.getWidth())), 48)
// : new Dimension(48, Math.max(10, Math.min(left.getHeight(), h_thumb.getHeight())));
}
代码示例来源:origin: de.richtercloud/flexdock-core
public static float getDividerProportion(JSplitPane splitPane) {
if(splitPane==null) {
return 0;
}
int size = splitPane.getOrientation()==JSplitPane.HORIZONTAL_SPLIT? splitPane.getWidth(): splitPane.getHeight();
int divLoc = splitPane.getDividerLocation();
return size==0? 0: divLoc/((float)size - splitPane.getDividerSize());
}
代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf
protected int getSplitDividerLocation() {
int dividerLocation = 0;
switch (anchor) {
case LEFT:
case TOP:
dividerLocation = splitPane.getDividerLocation();
break;
case RIGHT:
dividerLocation = splitPane.getWidth() - splitPane.getDividerLocation();
break;
case BOTTOM:
dividerLocation = splitPane.getHeight() - splitPane.getDividerLocation();
}
return dividerLocation;
}
代码示例来源:origin: mikaelhg/openblocks
/**
* Adds the specified widget to this Workspace
* @param widget the desired widget to add
* @param floatOverCanvas if true, the Workspace will add and render this widget such that it "floats"
* above the canvas and its set of blocks. If false, the widget will be laid out beside the canvas. This feature
* only applies if the specified widget is added graphically to the workspace (addGraphically = true)
* @param addGraphically a Swing dependent parameter to tell the Workspace whether or not to add
* the specified widget as a child component. This parameter should be false for widgets that have a
* parent already specified
*/
public void addWidget(WorkspaceWidget widget, boolean addGraphically, boolean floatOverCanvas) {
if (addGraphically) {
if (floatOverCanvas) {
this.add((JComponent) widget, WIDGET_LAYER);
widget.getJComponent().setVisible(true);
revalidate();
repaint();
} else {
blockCanvas.getJComponent().setPreferredSize(new Dimension(
blockCanvas.getWidth() - widget.getJComponent().getWidth(),
blockCanvasLayer.getHeight()));
}
}
boolean success = workspaceWidgets.add(widget);
if (!success) {
System.err.println("not able to add: " + widget);
}
}
代码示例来源:origin: org.protege/protege-editor-core-application
public void splitHorizontally(View rightView) {
rightView.setSyncronizing(false);
JSplitPane sp = createSplitPane(JSplitPane.VERTICAL_SPLIT);
View view = (View) getComponent(0);
remove(view);
add(sp);
validate();
sp.setTopComponent(new ViewContainer(view));
sp.setBottomComponent(new ViewContainer(rightView));
sp.setDividerLocation(sp.getHeight() / 2);
}
代码示例来源:origin: protegeproject/protege
public void splitHorizontally(View rightView) {
rightView.setSyncronizing(false);
JSplitPane sp = createSplitPane(JSplitPane.VERTICAL_SPLIT);
View view = (View) getComponent(0);
remove(view);
add(sp);
validate();
sp.setTopComponent(new ViewContainer(view));
sp.setBottomComponent(new ViewContainer(rightView));
sp.setDividerLocation(sp.getHeight() / 2);
}
代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application
public void splitHorizontally(View rightView) {
rightView.setSyncronizing(false);
JSplitPane sp = createSplitPane(JSplitPane.VERTICAL_SPLIT);
View view = (View) getComponent(0);
remove(view);
add(sp);
validate();
sp.setTopComponent(new ViewContainer(view));
sp.setBottomComponent(new ViewContainer(rightView));
sp.setDividerLocation(sp.getHeight() / 2);
}
代码示例来源:origin: khuxtable/seaglass
public void finishedPaintingChildren(JSplitPane jc, Graphics g) {
if (jc == splitPane && getLastDragLocation() != -1 && !isContinuousLayout() && !draggingHW) {
if (jc.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) {
paintDragDivider(g, getLastDragLocation(), 0, dividerSize - 1, splitPane.getHeight() - 1);
} else {
paintDragDivider(g, 0, getLastDragLocation(), splitPane.getWidth() - 1, dividerSize - 1);
}
}
}
}
代码示例来源:origin: de.richtercloud/flexdock-core
private static SplitNode createNode(DockingPort port, JSplitPane split) {
int orientation = split.getOrientation();
boolean topLeft = split.getLeftComponent()==port? true: false;
int region = 0;
String siblingId = null;
if(topLeft) {
region = orientation==JSplitPane.VERTICAL_SPLIT? TOP: LEFT;
siblingId = getSiblingId(split.getRightComponent());
} else {
region = orientation==JSplitPane.VERTICAL_SPLIT? BOTTOM: RIGHT;
siblingId = getSiblingId(split.getLeftComponent());
}
int size = orientation==JSplitPane.VERTICAL_SPLIT? split.getHeight(): split.getWidth();
int divLoc = split.getDividerLocation();
int testSize = 0;
if (orientation == JSplitPane.VERTICAL_SPLIT) {
testSize += split.getTopComponent().getHeight() + split.getBottomComponent().getHeight() + split.getDividerSize();
} else {
testSize += split.getLeftComponent().getWidth() + split.getRightComponent().getWidth() + split.getDividerSize();
}
float percentage;
if (split instanceof DockingSplitPane && ((DockingSplitPane) split).getPercent() != -1) {
percentage = (float) ((DockingSplitPane) split).getPercent();
} else {
percentage = divLoc / (float)size;
}
return new SplitNode(orientation, region, percentage, siblingId);
}
内容来源于网络,如有侵权,请联系作者删除!