本文整理汇总了Java中javax.swing.JSplitPane.getDividerLocation方法的典型用法代码示例。如果您正苦于以下问题:Java JSplitPane.getDividerLocation方法的具体用法?Java JSplitPane.getDividerLocation怎么用?Java JSplitPane.getDividerLocation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JSplitPane
的用法示例。
在下文中一共展示了JSplitPane.getDividerLocation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mouseButton1Pressed
import javax.swing.JSplitPane; //导入方法依赖的package包/类
@Override protected void mouseButton1Pressed(MouseEvent me) {
JSplitPane c = (JSplitPane) (component instanceof JSplitPane ? component
: SwingUtilities.getAncestorOfClass(JSplitPane.class, component));
if (c == null) {
return;
}
dividerLocation = c.getDividerLocation();
}
示例2: mouseReleased
import javax.swing.JSplitPane; //导入方法依赖的package包/类
@Override protected void mouseReleased(MouseEvent me) {
JSplitPane c = (JSplitPane) (component instanceof JSplitPane ? component
: SwingUtilities.getAncestorOfClass(JSplitPane.class, component));
if (c == null || dividerLocation == c.getDividerLocation()) {
return;
}
RComponent rComponent = new RComponentFactory(omapConfig).findRComponent(c, null, recorder);
recorder.recordSelect(rComponent, "" + c.getDividerLocation());
}
示例3: buildInfoPanel
import javax.swing.JSplitPane; //导入方法依赖的package包/类
/** Adjust the info panel by retrieving upper and lower info subpanels from the selected tab. */
protected void buildInfoPanel() {
JComponent upperInfoPanel = null;
JComponent lowerInfoPanel = null;
ResourceTab tab = getSelectedTab();
if (tab != null) {
upperInfoPanel = tab.getUpperInfoPanel();
lowerInfoPanel = tab.getLowerInfoPanel();
}
JPanel infoPanel = (JPanel) getInfoPanel();
String key;
if (lowerInfoPanel == null || !lowerInfoPanel.isEnabled()) {
// if we switch from split to single, freeze the divider location
if (upperInfoPanel != null && upperInfoPanel.getParent() == getSplitInfoPanel()) {
this.frozenDividerPos = getSplitInfoPanel().getDividerLocation();
}
getSingleInfoPanel().removeAll();
if (upperInfoPanel != null) {
getSingleInfoPanel().add(upperInfoPanel, BorderLayout.CENTER);
getSingleInfoPanel().validate();
getSingleInfoPanel().repaint();
}
key = this.SINGLE_INFO_KEY;
} else {
JSplitPane splitInfoPanel = getSplitInfoPanel();
int dividerPos = this.frozenDividerPos;
this.frozenDividerPos = 0;
if (dividerPos == 0) {
dividerPos = splitInfoPanel.getDividerLocation();
}
splitInfoPanel.setTopComponent(upperInfoPanel);
splitInfoPanel.setBottomComponent(lowerInfoPanel);
splitInfoPanel.setDividerLocation(dividerPos);
key = this.SPLIT_INFO_KEY;
}
((CardLayout) infoPanel.getLayout()).show(infoPanel, key);
}
示例4: test
import javax.swing.JSplitPane; //导入方法依赖的package包/类
private static void test(JSplitPane pane, String action, int expected) {
ActionEvent event = new ActionEvent(pane, expected, action);
pane.getActionMap().get(action).actionPerformed(event);
int actual = pane.getDividerLocation();
if (actual != expected) {
throw new Error(actual + ", but expected " + expected);
}
}