/** * Returns the index of the divider. For example, the index of the first divider is 0, the index of the second is 1. * Notes: Pane is not counted * * @param divider divider to get index * @return index of the divider. -1 if comp doesn't exist in this container */ public int indexOfDivider(JideSplitPaneDivider divider) { int index = indexOf(divider); if (index == -1) return index; else { if (index % 2 == 0) //noinspection UseOfSystemOutOrSystemErr System.err.println("Warning: divider's index is even. (index = " + index + ")"); return (index - 1) / 2; } }
/** * Returns the index of the pane. For example, the index of the first pane is 0, the index of the second is 1. * Notes: divider is not counted * * @param pane pane to get index * @return index of the pane. -1 if comp doesn't exist in this container */ public int indexOfPane(Component pane) { int index = indexOf(pane); if (index == -1) return -1; else { if (index % 2 != 0) //noinspection UseOfSystemOutOrSystemErr System.err.println("Warning: pane's index is odd. (index = " + index + ")"); return index >> 1; } }
/** * Gets the first component. This divider is installed between two components. The first component is usually the * one on the left or on the top. * * @param ignoreVisibility true to not check if the component is visible. * @return the first component */ public Component getFirstComponent(boolean ignoreVisibility) { int index = _jideSplitPane.indexOf(this); if (index - 1 >= 0) { for (int i = (index - 1); i >= 0; i--) { if (ignoreVisibility || _jideSplitPane.getComponent(i).isVisible()) { return _jideSplitPane.getComponent(i); } } // return an invisible component in lieu of null return _jideSplitPane.getComponent(index - 1); } else { throw new IndexOutOfBoundsException("There is no component before divider " + index); } }
/** * Gets the second component. This divider is installed between two components. The second component is usually the * one on the right or on the bottom. * * @param ignoreVisibility true to not check if the component is visible. * @return the first component */ public Component getSecondComponent(boolean ignoreVisibility) { int index = _jideSplitPane.indexOf(this); if (index + 1 < _jideSplitPane.getComponentCount()) { for (int i = (index + 1); i >= 0; i++) { if (ignoreVisibility || _jideSplitPane.getComponent(i).isVisible()) { return _jideSplitPane.getComponent(i); } } // return an invisible component in lieu of null return _jideSplitPane.getComponent(index + 1); } else { throw new IndexOutOfBoundsException("There is no component before divider " + index); } }
int index = _jideSplitPane.indexOf(JideSplitPaneDivider.this); int modelUpHeight = 0; int modelDownHeight = 0;
int index = _jideSplitPane.indexOf(JideSplitPaneDivider.this); int modelLeftWidth = 0; int modelRightWidth = 0;