Java Code Examples for javax.swing.JSplitPane#getOrientation()
The following examples show how to use
javax.swing.JSplitPane#getOrientation() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DocumentEditor.java From gate-core with GNU Lesser General Public License v3.0 | 6 votes |
/** * TODO: to remove? doesn't seems to be used anywhere. */ protected void updateSplitLocation(JSplitPane split, int foo) { Component left = split.getLeftComponent(); Component right = split.getRightComponent(); if(left == null) { split.setDividerLocation(0); return; } if(right == null) { split.setDividerLocation(1); return; } Dimension leftPS = left.getPreferredSize(); Dimension rightPS = right.getPreferredSize(); double location = split.getOrientation() == JSplitPane.HORIZONTAL_SPLIT ? (double)leftPS.width / (leftPS.width + rightPS.width) : (double)leftPS.height / (leftPS.height + rightPS.height); split.setDividerLocation(location); }
Example 2
Source File: StyledSplitPaneUI.java From stendhal with GNU General Public License v2.0 | 6 votes |
@Override public int getMinimumDividerLocation(JSplitPane pane) { int leftMin = super.getMinimumDividerLocation(pane); Component second = pane.getRightComponent(); if ((second != null) && second.isVisible()) { Dimension paneSize = splitPane.getSize(); Dimension maxSize = second.getMaximumSize(); Insets insets = pane.getInsets(); if (pane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { leftMin = Math.max(leftMin, paneSize.width - insets.right - maxSize.width); } else { leftMin = Math.max(leftMin, paneSize.height - insets.bottom - maxSize.height); } /* * To avoid inconsistency with the maximum location, it would seem * reasonable to do: * * leftMin = Math.min(leftMin, getMaximumDividerLocation(pane)); * * however, the parent already calls getMinimumDividerLocation() * in getMaximumDividerLocation(), so that would be a good way * to get a stack overflow. */ } return leftMin; }
Example 3
Source File: SplitPaneDividerBorder.java From beautyeye with Apache License 2.0 | 5 votes |
public Insets getBorderInsets(Component c) { Insets insets = new Insets(0, 0, 0, 0); if (c instanceof BasicSplitPaneDivider) { BasicSplitPaneUI bspui = ((BasicSplitPaneDivider) c) .getBasicSplitPaneUI(); if (bspui != null) { JSplitPane splitPane = bspui.getSplitPane(); if (splitPane != null) { if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { insets.top = insets.bottom = 0; insets.left = insets.right = 1; return insets; } // VERTICAL_SPLIT insets.top = insets.bottom = 1; insets.left = insets.right = 0; return insets; } } } insets.top = insets.bottom = insets.left = insets.right = 1; return insets; }
Example 4
Source File: MainView.java From HiJson with Apache License 2.0 | 5 votes |
private void changeLayout() { int selIndex = getTabIndex(); if(selIndex < 0){ return; } TabData selTabData = tabDataModel.getTab(selIndex); JSplitPane splitPane = (JSplitPane)selTabData.getComponent(); if (splitPane.getOrientation() == JSplitPane.VERTICAL_SPLIT) { splitPane.setOrientation(JSplitPane.HORIZONTAL_SPLIT); splitPane.setDividerLocation(0.45); } else { splitPane.setOrientation(JSplitPane.VERTICAL_SPLIT); splitPane.setDividerLocation(0.45); } }
Example 5
Source File: JCompoundSplitPane.java From netbeans with Apache License 2.0 | 5 votes |
private Component getFirstComponent(JSplitPane splitPane) { if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { return splitPane.getLeftComponent(); } else { return splitPane.getTopComponent(); } }
Example 6
Source File: JCompoundSplitPane.java From netbeans with Apache License 2.0 | 5 votes |
private Component getSecondComponent(JSplitPane splitPane) { if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { return splitPane.getRightComponent(); } else { return splitPane.getBottomComponent(); } }
Example 7
Source File: ResultWindow.java From netbeans with Apache License 2.0 | 5 votes |
/** * Sets the layout orientation of the contained result pane. * * @param orientation the orientation (see {@link JSplitPane#VERTICAL_SPLIT} * and {@link JSplitPane#HORIZONTAL_SPLIT}) to set. */ public void setOrientation(int orientation) { for(JSplitPane view: viewMap.values()){ if (view.getOrientation() != orientation) { view.setOrientation(orientation); } } }
Example 8
Source File: SeaGlassSplitPaneUI.java From seaglass with Apache License 2.0 | 5 votes |
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); } } }
Example 9
Source File: JCompoundSplitPane.java From visualvm with GNU General Public License v2.0 | 5 votes |
private Component getFirstComponent(JSplitPane splitPane) { if (splitPane.getOrientation() == JSplitPane.HORIZONTAL_SPLIT) { return splitPane.getLeftComponent(); } else { return splitPane.getTopComponent(); } }
Example 10
Source File: javax_swing_JSplitPane.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
protected void validate(JSplitPane before, JSplitPane after) { int orientation = after.getOrientation(); if (orientation != before.getOrientation()) throw new Error("Invalid orientation: " + orientation); }
Example 11
Source File: javax_swing_JSplitPane.java From jdk8u_jdk with GNU General Public License v2.0 | 4 votes |
protected void validate(JSplitPane before, JSplitPane after) { int orientation = after.getOrientation(); if (orientation != before.getOrientation()) throw new Error("Invalid orientation: " + orientation); }
Example 12
Source File: javax_swing_JSplitPane.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected void validate(JSplitPane before, JSplitPane after) { int orientation = after.getOrientation(); if (orientation != before.getOrientation()) throw new Error("Invalid orientation: " + orientation); }
Example 13
Source File: javax_swing_JSplitPane.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
protected void validate(JSplitPane before, JSplitPane after) { int orientation = after.getOrientation(); if (orientation != before.getOrientation()) throw new Error("Invalid orientation: " + orientation); }
Example 14
Source File: javax_swing_JSplitPane.java From jdk8u-jdk with GNU General Public License v2.0 | 4 votes |
protected void validate(JSplitPane before, JSplitPane after) { int orientation = after.getOrientation(); if (orientation != before.getOrientation()) throw new Error("Invalid orientation: " + orientation); }
Example 15
Source File: javax_swing_JSplitPane.java From dragonwell8_jdk with GNU General Public License v2.0 | 4 votes |
protected void validate(JSplitPane before, JSplitPane after) { int orientation = after.getOrientation(); if (orientation != before.getOrientation()) throw new Error("Invalid orientation: " + orientation); }
Example 16
Source File: javax_swing_JSplitPane.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
protected void validate(JSplitPane before, JSplitPane after) { int orientation = after.getOrientation(); if (orientation != before.getOrientation()) throw new Error("Invalid orientation: " + orientation); }
Example 17
Source File: JSplitPaneSupport.java From netbeans with Apache License 2.0 | 4 votes |
/** This method calculates layout constraints for a component dragged * over a container (or just for mouse cursor being moved over container, * without any component). * @param container instance of a real container over/in which the * component is dragged * @param containerDelegate effective container delegate of the container * @param component the real component being dragged, not needed here * @param index position (index) of the component in its container; * not needed here * @param posInCont position of mouse in the container * @param posInComp position of mouse in the dragged component; not needed * @return new LayoutConstraints object corresponding to the position of * the component in the container */ @Override public LayoutConstraints getNewConstraints(Container container, Container containerDelegate, Component component, int index, Point posInCont, Point posInComp) { if (!(container instanceof JSplitPane)) return null; JSplitPane splitPane = (JSplitPane) container; Dimension sz = splitPane.getSize(); int orientation = splitPane.getOrientation(); JButton left = (JButton) splitPane.getClientProperty(LEFT_TOP_BUTTON); JButton right = (JButton) splitPane.getClientProperty(RIGHT_BOTTOM_BUTTON); if ( (left == null && right == null) || (left != null && right != null) ) { String freePosition; if (orientation == JSplitPane.HORIZONTAL_SPLIT) { if (posInCont.x <= sz.width / 2) freePosition = JSplitPane.LEFT; else freePosition = JSplitPane.RIGHT; } else { if (posInCont.y <= sz.height / 2) freePosition = JSplitPane.TOP; else freePosition = JSplitPane.BOTTOM; } assistantParams = freePosition; return new SplitConstraints(freePosition); } assistantParams = findFreePosition(); return new SplitConstraints(assistantParams); }
Example 18
Source File: javax_swing_JSplitPane.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
protected void validate(JSplitPane before, JSplitPane after) { int orientation = after.getOrientation(); if (orientation != before.getOrientation()) throw new Error("Invalid orientation: " + orientation); }
Example 19
Source File: javax_swing_JSplitPane.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
protected void validate(JSplitPane before, JSplitPane after) { int orientation = after.getOrientation(); if (orientation != before.getOrientation()) throw new Error("Invalid orientation: " + orientation); }
Example 20
Source File: javax_swing_JSplitPane.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
protected void validate(JSplitPane before, JSplitPane after) { int orientation = after.getOrientation(); if (orientation != before.getOrientation()) throw new Error("Invalid orientation: " + orientation); }