/** * Adds a proportion at the given pane index, taking a proportional amount from each of the existing proportions. * * @param paneIndex the pane index. */ protected void addProportion(int paneIndex) { double[] oldProportions = _proportions; if (oldProportions == null) return; double[] newProportions = new double[oldProportions.length + 1]; double p = 1.0 / (newProportions.length + 1); double total = 1.0 - p; for (int i = 0; i < newProportions.length; ++i) { if (i == paneIndex) newProportions[i] = p; else { int j = (i < paneIndex) ? i : i - 1; if (j < oldProportions.length) newProportions[i] = oldProportions[j] * total; else newProportions[i] = p; } } setProportions(newProportions); }
return; if (oldProportions.length <= 1) { setProportions(null); return; setProportions(newProportions);
/** * Uses the component sizes to generate a new array of proportions, and replaces the existing one. */ private void replaceProportions() { ((JideSplitPane) _target).setProportions(deduceProportions()); }
/** * Sets this split pane to lay its constituents out proportionally if the given flag is true, or by preferred sizes * otherwise. * * @param proportionalLayout true or false. */ public void setProportionalLayout(boolean proportionalLayout) { if (proportionalLayout == _proportionalLayout) return; _proportionalLayout = proportionalLayout; revalidate(); firePropertyChange(PROPORTIONAL_LAYOUT_PROPERTY, !proportionalLayout, proportionalLayout); if (!proportionalLayout) setProportions(null); }
private JComponent createAggregatorsAndVariablesPanel() { JideSplitPane splitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT); splitPane.add(createAggregatorsPanel()); splitPane.add(createVariablesPanel()); splitPane.setShowGripper(true); splitPane.setProportionalLayout(true); splitPane.setProportions(new double[]{0.6}); return splitPane; }
private JComponent createAggregatorsAndVariablesPanel() { JideSplitPane splitPane = new JideSplitPane(JideSplitPane.VERTICAL_SPLIT); splitPane.add(createAggregatorsPanel()); splitPane.add(createVariablesPanel()); splitPane.setShowGripper(true); splitPane.setProportionalLayout(true); splitPane.setProportions(new double[]{0.6}); return splitPane; }
setProportions(null); return false;