本文整理了Java中javax.swing.JSplitPane.getDividerSize()
方法的一些代码示例,展示了JSplitPane.getDividerSize()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSplitPane.getDividerSize()
方法的具体详情如下:
包路径:javax.swing.JSplitPane
类名称:JSplitPane
方法名:getDividerSize
暂无
代码示例来源:origin: magefree/mage
@Override
public void actionPerformed(ActionEvent actionEvent) {
imagePanelState = !imagePanelState;
if (!imagePanelState) {
jSplitPane0.resetToPreferredSizes();
jSplitPane0.setDividerLocation(jSplitPane0.getSize().width - jSplitPane0.getInsets().right - jSplitPane0.getDividerSize() - 260);
} else {
jSplitPane0.setDividerLocation(1.0);
}
}
});
代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf
public void propertyChange(PropertyChangeEvent evt) {
if (splitPane.getDividerSize() > 0)
splitPane.setDividerSize((Integer) evt.getNewValue());
}
代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/skinlf
/**
* Update the divider size to contain the appropriate dimension.
*
* @param d Description of Parameter
*/
protected void updateDividerSize(Dimension d) {
int buttonSize;
if (orientation == JSplitPane.HORIZONTAL_SPLIT) {
buttonSize = d.width;
}
else {
buttonSize = d.height;
}
int sbSize = splitPane.getDividerSize();
if (sbSize < buttonSize) {
splitPane.setDividerSize(buttonSize);
}
}
代码示例来源:origin: org.appdapter/org.appdapter.lib.gui
public void setDividerLocation(double proportionalLocation) {
myBrowserSplitPane.setDividerLocation(Math.max((int) ((double) (myBrowserSplitPane.getWidth() - myBrowserSplitPane.getDividerSize()) * proportionalLocation), 100));
invalidate();
}
代码示例来源:origin: net.sf.squirrel-sql/squirrel-sql
public OverviewPanel(SquirrelResources rsrc, JScrollPane pnlChartConfig)
{
setLayout(new GridBagLayout());
GridBagConstraints gbc;
gbc = new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL, new Insets(5,5,5,5),0,0);
add(createButtonPanel(rsrc), gbc);
gbc = new GridBagConstraints(0,1,1,1,1,1,GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0);
split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
add(split, gbc);
split.setLeftComponent(scrollPane);
split.setRightComponent(pnlChartConfig);
standardDividerSize = split.getDividerSize();
split.setDividerSize(0);
split.setDividerLocation(Integer.MAX_VALUE);
}
代码示例来源:origin: realXuJiang/bigtable-sql
public OverviewPanel(SquirrelResources rsrc, JScrollPane pnlChartConfig)
{
setLayout(new GridBagLayout());
GridBagConstraints gbc;
gbc = new GridBagConstraints(0,0,1,1,0,0,GridBagConstraints.NORTHEAST, GridBagConstraints.HORIZONTAL, new Insets(5,5,5,5),0,0);
add(createButtonPanel(rsrc), gbc);
gbc = new GridBagConstraints(0,1,1,1,1,1,GridBagConstraints.NORTHEAST, GridBagConstraints.BOTH, new Insets(5,5,5,5),0,0);
split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
add(split, gbc);
split.setLeftComponent(scrollPane);
split.setRightComponent(pnlChartConfig);
standardDividerSize = split.getDividerSize();
split.setDividerSize(0);
split.setDividerLocation(Integer.MAX_VALUE);
}
代码示例来源:origin: khuxtable/seaglass
/**
* Creates the default divider.
*/
public BasicSplitPaneDivider createDefaultDivider() {
SeaGlassSplitPaneDivider divider = new SeaGlassSplitPaneDivider(this);
divider.setDividerSize(splitPane.getDividerSize());
return divider;
}
代码示例来源:origin: stackoverflow.com
- split.getDividerSize());
代码示例来源:origin: MegaMek/mekhq
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if ((splitUnit.getSize().width - splitUnit.getDividerLocation() + splitUnit
.getDividerSize()) < HangarTab.UNIT_VIEW_WIDTH) {
// expand
splitUnit.resetToPreferredSizes();
} else {
// collapse
splitUnit.setDividerLocation(1.0);
}
}
}
});
代码示例来源:origin: javax.help/javahelp
public void run() {
// The first time, arrange for the split size...
// This should be customizable
// setting a ratio at this point doesn't really work.
// instead we will set the point based on the ratio and the
// preferred sizes
if (dividerLocation == 0d) {
Dimension dem = splitPane.getSize();
// if there is a size then perform the estimate
// otherwise use the default sizes
if (dem.width != 0) {
splitPane.setDividerLocation((int)
((double)(dem.width -
splitPane.getDividerSize())
* dividerLocationRatio));
}
dividerLocation = splitPane.getDividerLocation();
}
}
});
代码示例来源:origin: stackoverflow.com
if (getDividerLocation() < getWidth() - getDividerSize() - BUGCLICKONETOUCH) {
restoreWidth = getWidth() - getDividerSize() - getDividerLocation();
setDividerLocation(1.0d);
} else {
setDividerLocation(getWidth() - getDividerSize() - restoreWidth);
代码示例来源:origin: MegaMek/mekhq
@Override
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2) {
if ((splitPersonnel.getSize().width
- splitPersonnel.getDividerLocation() + splitPersonnel
.getDividerSize()) < PersonnelTab.PERSONNEL_VIEW_WIDTH) {
// expand
splitPersonnel.resetToPreferredSizes();
} else {
// collapse
splitPersonnel.setDividerLocation(1.0);
}
}
}
});
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
private void configureSecondComponent() {
JSplitPane secondSplit = (JSplitPane) getSecondComponent();
int newWidth = secondSplit.getMinimumSize().width;
int newHeight = 0;
if (getFirstComponent(secondSplit).isVisible() && getSecondComponent(secondSplit).isVisible()) {
newHeight = getSecondComponent(secondSplit).getSize().height
+ (getFirstComponent(secondSplit).isVisible()
? (getFirstComponent(secondSplit).getMinimumSize().height + secondSplit.getDividerSize()) : 0);
} else if (getFirstComponent(secondSplit).isVisible()) {
newHeight = getFirstComponent(secondSplit).getMinimumSize().height;
} else {
newHeight = getSecondComponent(secondSplit).getMinimumSize().height;
}
secondSplit.setMinimumSize(new Dimension(newWidth, newHeight));
}
}
代码示例来源:origin: org.netbeans.modules/org-netbeans-lib-profiler-ui
private void configureFirstComponent() {
JSplitPane firstSplit = (JSplitPane) getFirstComponent();
int newWidth;
int newHeight;
newWidth = firstSplit.getMinimumSize().width;
newHeight = 0;
if (getFirstComponent(firstSplit).isVisible() && getSecondComponent(firstSplit).isVisible()) {
newHeight = getFirstComponent(firstSplit).getSize().height
+ getSecondComponent(firstSplit).getMinimumSize().height + firstSplit.getDividerSize();
} else if (getFirstComponent(firstSplit).isVisible()) {
newHeight = getFirstComponent(firstSplit).getMinimumSize().height;
} else {
newHeight = getSecondComponent(firstSplit).getMinimumSize().height;
}
firstSplit.setMinimumSize(new Dimension(newWidth, newHeight));
}
代码示例来源:origin: joel-costigliola/assertj-swing
@RunsInCurrentThread
private int calculateMaximum(@Nonnull JSplitPane splitPane) {
Component rightComponent = splitPane.getRightComponent();
if (splitPane.getLeftComponent() == null || rightComponent == null) {
return -1; // Don't allow dragging.
}
Insets insets = splitPane.getInsets();
int dividerSize = splitPane.getDividerSize();
int bottom = (insets != null) ? insets.bottom : 0;
int splitPaneHeight = splitPane.getSize().height;
if (!rightComponent.isVisible()) {
return max(0, splitPaneHeight - (dividerSize + bottom));
}
return max(0, splitPaneHeight - (dividerSize + bottom) - rightComponent.getMinimumSize().height);
}
代码示例来源:origin: joel-costigliola/assertj-swing
@RunsInCurrentThread
private int calculateMaximum(@Nonnull JSplitPane splitPane) {
Component rightComponent = splitPane.getRightComponent();
if (splitPane.getLeftComponent() == null || rightComponent == null) {
return -1; // Don't allow dragging.
}
Insets insets = splitPane.getInsets();
int dividerSize = splitPane.getDividerSize();
int right = (insets != null) ? insets.right : 0;
int splitPaneWidth = splitPane.getSize().width;
if (!rightComponent.isVisible()) {
return max(0, splitPaneWidth - (dividerSize + right));
}
return max(0, splitPaneWidth - (dividerSize + right) - rightComponent.getMinimumSize().width);
}
代码示例来源: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.sf.taverna.t2.ui-impl/zaria
private double getDividerRatio() {
// total size would be the height if oriented vertically, or the width
// if horizontally
double total = splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? (double) splitPane
.getBounds().getWidth()
: (double) splitPane.getBounds().getHeight();
total = total - splitPane.getDividerSize();
double ratio;
if (getWidth() == 0) {
ratio = this.dividerLocation;
} else {
double dividerLocation = splitPane.getDividerLocation();
if (dividerLocation < 0)
dividerLocation = 0; // when the divider is far to one side,
// it
// the dividerlocation results in being
// negative (?!), setting to 0 prevents an
// error on reload it gives the correct
// approximate location
if (total <= 0)
ratio = 0;
else
ratio = dividerLocation / total;
}
return ratio;
}
代码示例来源:origin: net.sourceforge.mydoggy/mydoggy-plaf
protected void onFinishAnimation() {
if (splitPane.getDividerSize() == 0) {
setSplitPaneContent(null);
} else {
if (getAnimationDirection() == Direction.OUTGOING) {
vsdValueAdjusting = true;
setSplitDividerLocation(0);
vsdValueAdjusting = false;
} else {
setSplitDividerLocation(sheetLen);
SwingUtil.repaintNow(splitPane);
}
}
}
代码示例来源: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);
}
内容来源于网络,如有侵权,请联系作者删除!