本文整理匯總了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);
}
}