Java Code Examples for javax.swing.JSplitPane#setMinimumSize()

The following examples show how to use javax.swing.JSplitPane#setMinimumSize() . 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: JCompoundSplitPane.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void configureFirstComponent() {
    JSplitPane firstSplit = (JSplitPane) getFirstComponent();
    int newWidth;
    int newHeight;

    newWidth = firstSplit.getMinimumSize().width;
    newHeight = 0;

    if (getFirstComponent(firstSplit).isVisible() && getSecondComponent(firstSplit).isVisible()) {
        newHeight = getFirstComponent(firstSplit).getSize().height
                    + getSecondComponent(firstSplit).getMinimumSize().height + firstSplit.getDividerSize();
    } else if (getFirstComponent(firstSplit).isVisible()) {
        newHeight = getFirstComponent(firstSplit).getMinimumSize().height;
    } else {
        newHeight = getSecondComponent(firstSplit).getMinimumSize().height;
    }

    firstSplit.setMinimumSize(new Dimension(newWidth, newHeight));
}
 
Example 2
Source File: JCompoundSplitPane.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void configureSecondComponent() {
    JSplitPane secondSplit = (JSplitPane) getSecondComponent();
    int newWidth = secondSplit.getMinimumSize().width;
    int newHeight = 0;

    if (getFirstComponent(secondSplit).isVisible() && getSecondComponent(secondSplit).isVisible()) {
        newHeight = getSecondComponent(secondSplit).getSize().height
                    + (getFirstComponent(secondSplit).isVisible()
                       ? (getFirstComponent(secondSplit).getMinimumSize().height + secondSplit.getDividerSize()) : 0);
    } else if (getFirstComponent(secondSplit).isVisible()) {
        newHeight = getFirstComponent(secondSplit).getMinimumSize().height;
    } else {
        newHeight = getSecondComponent(secondSplit).getMinimumSize().height;
    }

    secondSplit.setMinimumSize(new Dimension(newWidth, newHeight));
}
 
Example 3
Source File: JCompoundSplitPane.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private void configureFirstComponent() {
    JSplitPane firstSplit = (JSplitPane) getFirstComponent();
    int newWidth;
    int newHeight;

    newWidth = firstSplit.getMinimumSize().width;
    newHeight = 0;

    if (getFirstComponent(firstSplit).isVisible() && getSecondComponent(firstSplit).isVisible()) {
        newHeight = getFirstComponent(firstSplit).getSize().height
                    + getSecondComponent(firstSplit).getMinimumSize().height + firstSplit.getDividerSize();
    } else if (getFirstComponent(firstSplit).isVisible()) {
        newHeight = getFirstComponent(firstSplit).getMinimumSize().height;
    } else {
        newHeight = getSecondComponent(firstSplit).getMinimumSize().height;
    }

    firstSplit.setMinimumSize(new Dimension(newWidth, newHeight));
}
 
Example 4
Source File: JCompoundSplitPane.java    From visualvm with GNU General Public License v2.0 6 votes vote down vote up
private void configureSecondComponent() {
    JSplitPane secondSplit = (JSplitPane) getSecondComponent();
    int newWidth = secondSplit.getMinimumSize().width;
    int newHeight = 0;

    if (getFirstComponent(secondSplit).isVisible() && getSecondComponent(secondSplit).isVisible()) {
        newHeight = getSecondComponent(secondSplit).getSize().height
                    + (getFirstComponent(secondSplit).isVisible()
                       ? (getFirstComponent(secondSplit).getMinimumSize().height + secondSplit.getDividerSize()) : 0);
    } else if (getFirstComponent(secondSplit).isVisible()) {
        newHeight = getFirstComponent(secondSplit).getMinimumSize().height;
    } else {
        newHeight = getSecondComponent(secondSplit).getMinimumSize().height;
    }

    secondSplit.setMinimumSize(new Dimension(newWidth, newHeight));
}
 
Example 5
Source File: SarosMainPanelView.java    From saros with GNU General Public License v2.0 6 votes vote down vote up
/**
 * Creates the content of the tool window panel, with {@link SarosToolbar} and the {@link
 * SessionAndContactsTreeView}.
 */
public SarosMainPanelView(@NotNull Project project) throws HeadlessException {
  super(new BorderLayout());
  SessionAndContactsTreeView sarosTree = new SessionAndContactsTreeView(project);
  SarosToolbar sarosToolbar = new SarosToolbar(project);

  JScrollPane treeScrollPane = new JBScrollPane(sarosTree);
  treeScrollPane.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
  treeScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

  // chartPane is empty at the moment
  Container chartPane = new JPanel(new BorderLayout());

  JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, treeScrollPane, chartPane);
  splitPane.setOneTouchExpandable(true);
  splitPane.setDividerLocation(350);

  // Provide minimum sizes for the two components in the split pane
  Dimension minimumSize = new Dimension(300, 50);
  treeScrollPane.setMinimumSize(minimumSize);
  splitPane.setMinimumSize(minimumSize);

  add(splitPane, BorderLayout.CENTER);
  add(sarosToolbar, BorderLayout.NORTH);
}
 
Example 6
Source File: CStandardLeftPanel.java    From binnavi with Apache License 2.0 5 votes vote down vote up
/**
 * Creates a new panel object.
 *
 * @param graph Graph that provides the data for the components in this panel.
 * @param selectionHistory Shows the selection history of the given graph.
 * @param searchField Search field that is used to search through the graph.
 */
public CStandardLeftPanel(final ZyGraph graph, final CSelectionHistory selectionHistory,
    final CGraphSearchField searchField) {
  super(new BorderLayout());

  Preconditions.checkNotNull(searchField, "IE01810: Search field argument can not be null");

  m_undoHistory = new CSelectionHistoryChooser(graph, selectionHistory);

  final JSplitPane bottomSplitter = new JSplitPane(JSplitPane.VERTICAL_SPLIT, true,
      m_nodeChooser = new CNodeChooser(graph, searchField), m_undoHistory);
  final JSplitPane topSplitter = new JSplitPane(
      JSplitPane.VERTICAL_SPLIT, true, new CGraphOverview(graph), bottomSplitter);

  topSplitter.setDividerLocation(200);

  bottomSplitter.setDoubleBuffered(true);
  bottomSplitter.setResizeWeight(0.75);
  bottomSplitter.setOneTouchExpandable(true);
  bottomSplitter.setMinimumSize(new Dimension(0, 0));

  topSplitter.setDoubleBuffered(true);
  topSplitter.setOneTouchExpandable(true);
  topSplitter.setMinimumSize(new Dimension(0, 0));
  topSplitter.setDividerLocation(200);

  add(topSplitter);
}
 
Example 7
Source File: AutomaticFixingWindow.java    From wpcleaner with Apache License 2.0 5 votes vote down vote up
/**
 * @return Window components.
 */
@Override
protected Component createComponents() {
  JPanel panel = new JPanel(new GridBagLayout());

  // Initialize constraints
  GridBagConstraints constraints = new GridBagConstraints();
  constraints.fill = GridBagConstraints.HORIZONTAL;
  constraints.gridheight = 1;
  constraints.gridwidth = 1;
  constraints.gridx = 0;
  constraints.gridy = 0;
  constraints.insets = new Insets(2, 2, 2, 2);
  constraints.ipadx = 0;
  constraints.ipady = 0;
  constraints.weightx = 0;
  constraints.weighty = 0;

  // Contents
  constraints.fill = GridBagConstraints.BOTH;
  constraints.gridwidth = 1;
  constraints.gridx = 0;
  constraints.weightx = 1;
  constraints.weighty = 1;
  JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  split.setLeftComponent(createLinksComponents());
  split.setRightComponent(createAutomaticFixingComponents());
  split.setPreferredSize(new Dimension(1000, 700));
  split.setMinimumSize(new Dimension(200, 200));
  split.setResizeWeight(0.0);
  split.setDividerLocation(200 + split.getInsets().left);
  panel.add(split, constraints);
  constraints.gridy++;

  updateComponentState();
  return panel;
}
 
Example 8
Source File: MainPanel.java    From mzmine2 with GNU General Public License v2.0 4 votes vote down vote up
/**
 */
public MainPanel() {

  super(new BorderLayout());

  // Initialize item selector
  rawDataTree = new ProjectTree();
  peakListTree = new ProjectTree();

  JScrollPane rawDataTreeScroll = new JScrollPane(rawDataTree);
  JScrollPane peakListTreeScroll = new JScrollPane(peakListTree);

  JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  split.add(rawDataTreeScroll);
  split.add(peakListTreeScroll);
  split.setResizeWeight(0.5);

  split.setMinimumSize(new Dimension(200, 200));

  add(split, BorderLayout.CENTER);

  taskTable = new TaskProgressTable();
  add(taskTable, BorderLayout.SOUTH);

}
 
Example 9
Source File: OnePageAnalysisWindow.java    From wpcleaner with Apache License 2.0 4 votes vote down vote up
/**
 * @return Window components.
 */
@Override
protected Component createComponents() {
  JPanel panel = new JPanel(new GridBagLayout());

  // Initialize constraints
  GridBagConstraints constraints = new GridBagConstraints();
  constraints.fill = GridBagConstraints.HORIZONTAL;
  constraints.gridheight = 1;
  constraints.gridwidth = 1;
  constraints.gridx = 0;
  constraints.gridy = 0;
  constraints.insets = new Insets(2, 2, 2, 2);
  constraints.ipadx = 0;
  constraints.ipady = 0;
  constraints.weightx = 0;
  constraints.weighty = 0;

  // Page name
  //constraints.gridwidth = 2;
  panel.add(createPageComponents(), constraints);
  constraints.gridy++;

  // Contents
  constraints.fill = GridBagConstraints.BOTH;
  constraints.gridwidth = 1;
  constraints.gridx = 0;
  constraints.weightx = 1;
  constraints.weighty = 1;
  JSplitPane splitLinks = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
  splitLinks.setLeftComponent(createLinksComponents());
  splitLinks.setRightComponent(createCheckWikiComponents());
  splitLinks.setResizeWeight(1.0);
  splitLinks.setDividerLocation(0.9);
  JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  split.setLeftComponent(splitLinks);
  split.setRightComponent(createContentsComponents());
  split.setPreferredSize(new Dimension(1200, 700));
  split.setMinimumSize(new Dimension(200, 200));
  split.setResizeWeight(0.0);
  split.setDividerLocation(200 + split.getInsets().left);
  panel.add(split, constraints);
  constraints.gridy++;

  updateComponentState();
  return panel;
}
 
Example 10
Source File: DisambiguationWindow.java    From wpcleaner with Apache License 2.0 4 votes vote down vote up
/**
 * @return Window components.
 */
@Override
protected Component createComponents() {
  createElements();
  JPanel panel = new JPanel(new GridBagLayout());

  // Initialize constraints
  GridBagConstraints constraints = new GridBagConstraints();
  constraints.fill = GridBagConstraints.HORIZONTAL;
  constraints.gridheight = 1;
  constraints.gridwidth = 1;
  constraints.gridx = 0;
  constraints.gridy = 0;
  constraints.insets = new Insets(2, 2, 2, 2);
  constraints.ipadx = 0;
  constraints.ipady = 0;
  constraints.weightx = 0;
  constraints.weighty = 0;

  // Page name
  //constraints.gridwidth = 2;
  panel.add(createPageComponents(), constraints);
  constraints.gridy++;

  // Contents
  constraints.fill = GridBagConstraints.BOTH;
  constraints.gridwidth = 1;
  constraints.gridx = 0;
  constraints.weightx = 1;
  constraints.weighty = 1;
  JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
  split.setLeftComponent(createLinksComponents());
  split.setRightComponent(createContentsComponents());
  split.setPreferredSize(new Dimension(1200, 700));
  split.setMinimumSize(new Dimension(200, 200));
  split.setResizeWeight(0.0);
  split.setDividerLocation(200 + split.getInsets().left);
  panel.add(split, constraints);
  constraints.gridy++;

  updateComponentState();
  return panel;
}