/** * Inserts the specified pane to this container at the given position. Note: Divider is not counted. * * @param pane the pane to be added * @param index the position at which to insert the component. * @return the component <code>pane</code> */ public Component insertPane(Component pane, int index) { return insertPane(pane, null, index); }
/** * Replaces the pane at the position specified by index. * * @param pane new pane * @param constraint an object expressing layout constraints for this component * @param index position */ public void setPaneAt(Component pane, Object constraint, int index) { double[] proportions = _proportions; _proportions = null; // Just turn them off temporarily removePane(index); insertPane(pane, constraint, index); _proportions = proportions; validate(); }
/** * Add a new data panel set */ public synchronized TrackPanelScrollPane addDataPanel(String name) { final TrackPanel trackPanel = new TrackPanel(name, this); final TrackPanelScrollPane sp = new TrackPanelScrollPane(); Runnable runnable = () -> { sp.setViewportView(trackPanel); for (TrackPanel tp : getTrackPanels()) { tp.getScrollPane().minimizeHeight(); } // Insert the new panel just before the feature panel, or at the end if there is no feature panel. int featurePaneIdx = centerSplitPane.indexOfPane(featureTrackScrollPane); if (featurePaneIdx > 0) { centerSplitPane.insertPane(sp, featurePaneIdx); } else { centerSplitPane.add(sp); } if (!PreferencesManager.getPreferences().getAsBoolean(SHOW_SINGLE_TRACK_PANE_KEY)) { if (sp.getTrackPanel().getTracks().size() == 0) { //If the igv window is too small the divider won't exist and this causes an exception //We solved by setting a minimum size centerSplitPane.setDividerLocation(0, 3); } } }; UIUtilities.invokeAndWaitOnEventThread(runnable); return sp; }