Example usage for javax.swing JSplitPane setOneTouchExpandable

List of usage examples for javax.swing JSplitPane setOneTouchExpandable

Introduction

In this page you can find the example usage for javax.swing JSplitPane setOneTouchExpandable.

Prototype

@BeanProperty(description = "UI widget on the divider to quickly expand/collapse the divider.")
public void setOneTouchExpandable(boolean newValue) 

Source Link

Document

Sets the value of the oneTouchExpandable property, which must be true for the JSplitPane to provide a UI widget on the divider to quickly expand/collapse the divider.

Usage

From source file:org.lnicholls.galleon.gui.MainFrame.java

public static JSplitPane createSplitPane(int orientation, Component comp1, Component comp2,
        double resizeWeight) {

    JSplitPane split = new JSplitPane(1, false, comp1, comp2);

    split.setBorder(new EmptyBorder(0, 0, 0, 0));

    split.setOneTouchExpandable(false);

    split.setResizeWeight(resizeWeight);

    return split;

}

From source file:org.n52.ifgicopter.spf.gui.FrameworkCorePanel.java

/**
 * default constructor to create the framework core panel.
 *//* w w w  . j  av a  2s.  c o  m*/
public FrameworkCorePanel() {

    /*
     * INPUT PLUGIN LIST
     */
    this.pluginsPanel = new JPanel();
    this.pluginsPanel.setLayout(new GridBagLayout());
    this.pluginsPanel.setBackground(DEFAULT_COLOR);

    this.globalGBC = new GridBagConstraints();
    this.globalGBC.gridx = 0;
    this.globalGBC.gridy = 0;
    this.globalGBC.weightx = 0.0;
    this.globalGBC.weighty = 0.0;
    this.globalGBC.anchor = GridBagConstraints.NORTHWEST;
    this.globalGBC.fill = GridBagConstraints.HORIZONTAL;

    this.pluginsPanel.add(
            new JLabel("<html><body><div><strong>" + "Active Plugins</strong></div></body></html>"),
            this.globalGBC);

    this.globalGBC.gridy++;
    this.globalGBC.gridwidth = GridBagConstraints.REMAINDER;
    this.globalGBC.insets = new Insets(0, 0, 5, 0);
    this.pluginsPanel.add(new JSeparator(), this.globalGBC);
    this.globalGBC.insets = new Insets(0, 0, 0, 0);

    this.globalGBC.weightx = 1.0;
    this.globalGBC.gridy = 0;
    this.globalGBC.gridx = 1;
    this.pluginsPanel.add(Box.createHorizontalGlue(), this.globalGBC);
    this.globalGBC.weightx = 0.0;
    this.globalGBC.gridx = 0;
    this.globalGBC.gridy = 1;

    /*
     * the contentpanel
     */
    this.contentPanel = new JPanel();
    this.contentPanel.setLayout(new CardLayout());
    this.contentPanel.setBorder(BorderFactory.createEtchedBorder());
    this.contentPanel.add(WelcomePanel.getInstance(), WELCOME_PANEL);
    // ((CardLayout) contentPanel.getLayout()).show(contentPanel, WELCOME_PANEL);

    JScrollPane startupS = new JScrollPane(this.contentPanel);
    startupS.setViewportBorder(null);

    /*
     * wrap the plugins to ensure top alignment
     */
    JPanel pluginsPanelWrapper = new JPanel(new BorderLayout());
    pluginsPanelWrapper.add(this.pluginsPanel, BorderLayout.NORTH);
    pluginsPanelWrapper.add(Box.createVerticalGlue(), BorderLayout.CENTER);
    pluginsPanelWrapper.setBorder(BorderFactory.createEtchedBorder());
    pluginsPanelWrapper.setBackground(this.pluginsPanel.getBackground());
    JScrollPane wrapperS = new JScrollPane(pluginsPanelWrapper);
    wrapperS.setViewportBorder(null);

    /*
     * add both scroll panes to the split pane
     */
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, wrapperS, startupS);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(250);
    splitPane.setContinuousLayout(true);

    Dimension minimumSize = new Dimension(100, 100);
    startupS.setMinimumSize(minimumSize);

    this.setLayout(new BorderLayout());
    this.add(splitPane);
}

From source file:org.ngrinder.recorder.Recorder.java

/**
 * Create a split pane with the give left and right components.
 * /*  ww  w  . java  2s  . c  o  m*/
 * @param left
 *            component located in left
 * @param right
 *            component located in right
 * @return JSplitPane instance
 */
protected JSplitPane createSplitPane(final JComponent left, final JComponent right) {
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, true, left, right);
    splitPane.setDividerLocation(
            splitPane.getSize().width - splitPane.getInsets().right - splitPane.getDividerSize() - 200);
    splitPane.setResizeWeight(1);
    splitPane.setMinimumSize(new Dimension(600, 600));
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerSize(10);
    return splitPane;
}

From source file:org.notebook.gui.MainFrame.java

public void initGui() {
    setLayout(new BorderLayout());
    menu = new MenuToolbar(events);
    this.getRootPane().setJMenuBar(menu.getMenuBar());

    //editor = new DocumentEditor();
    //menu.addExtraToolBar(editor.getToolBar());

    //JScrollPane leftTree = new JScrollPane(tree);
    Dimension minSize = new Dimension(150, 400);

    mainPanel = new SimplePrintPanel();
    events.registerAction(mainPanel.getEventsHandler());
    _panel = new JScrollPane(mainPanel);
    _panel.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);

    JSplitPane splitPanel;
    splitPanel = new JSplitPane();
    splitPanel.setOrientation(JSplitPane.HORIZONTAL_SPLIT);
    //splitPanel.setAutoscrolls(true);
    splitPanel.setDividerLocation(0.35);
    splitPanel.setOneTouchExpandable(true);
    splitPanel.setLeftComponent(getNavigationBar());
    splitPanel.setRightComponent(_panel);

    statusBar = new StatusBar();
    mainPanel.bar = statusBar;//from ww  w.  java 2s. c  o  m

    Container contentPane = getContentPane();
    contentPane.add(menu.getToolBar(), BorderLayout.NORTH);

    contentPane.add(splitPanel, BorderLayout.CENTER);
    //contentPane.add(_panel, BorderLayout.CENTER);

    contentPane.add(statusBar, BorderLayout.SOUTH);

    //controller = createPrivilegedProxy(new DefaultBookController(this));

    //setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    this.setIconImage(appIcon16());

    setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
    final MainFrame mainFrame = this;

    addWindowListener(new WindowAdapter() {
        //?
        public void windowClosing(WindowEvent e) {
            events.fireEvent(MenuToolbar.EXIT, mainFrame);
        }

        //???
        public void windowOpened(WindowEvent e) {
            events.fireEvent(MenuToolbar.LOADED, mainFrame);
        }
    });

    //????????
    events.fireEvent(MenuToolbar.GUI_INITED, this);

    events.registerAction(this);

    pack();
    setSize(670, 548);

}

From source file:org.omegat.gui.scripting.ScriptingWindow.java

private void initWindowLayout() {
    // set default size and position
    frame.setBounds(50, 80, 1150, 650);/*ww  w.  j a  v  a 2  s .c o  m*/
    StaticUIUtils.persistGeometry(frame, Preferences.SCRIPTWINDOW_GEOMETRY_PREFIX);

    frame.getContentPane().setLayout(new BorderLayout(0, 0));

    m_scriptList = new JList<>();
    JScrollPane scrollPaneList = new JScrollPane(m_scriptList);

    m_scriptList.addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent evt) {
            if (!evt.getValueIsAdjusting()) {
                onListSelectionChanged();
            }
        }
    });

    m_scriptList.addMouseMotionListener(new MouseMotionAdapter() {

        @Override
        public void mouseMoved(MouseEvent e) {
            ListModel<ScriptItem> lm = m_scriptList.getModel();
            int index = m_scriptList.locationToIndex(e.getPoint());
            if (index > -1) {
                m_scriptList.setToolTipText(lm.getElementAt(index).getFile().getName());
            }
        }

    });

    m_txtResult = new JEditorPane();
    JScrollPane scrollPaneResults = new JScrollPane(m_txtResult);

    //m_txtScriptEditor = new StandardScriptEditor();
    m_txtScriptEditor = getScriptEditor();

    m_txtScriptEditor.initLayout(this);

    JSplitPane splitPane1 = new JSplitPane(JSplitPane.VERTICAL_SPLIT, m_txtScriptEditor.getPanel(),
            scrollPaneResults);
    splitPane1.setOneTouchExpandable(true);
    splitPane1.setDividerLocation(430);
    Dimension minimumSize1 = new Dimension(100, 50);
    //scrollPaneEditor.setMinimumSize(minimumSize1);
    scrollPaneResults.setMinimumSize(minimumSize1);

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, scrollPaneList, splitPane1);
    splitPane.setOneTouchExpandable(true);
    splitPane.setDividerLocation(250);

    Dimension minimumSize = new Dimension(100, 50);
    scrollPaneList.setMinimumSize(minimumSize);
    scrollPaneResults.setMinimumSize(minimumSize);

    frame.getContentPane().add(splitPane, BorderLayout.CENTER);

    JPanel panelSouth = new JPanel();
    FlowLayout fl_panelSouth = (FlowLayout) panelSouth.getLayout();
    fl_panelSouth.setAlignment(FlowLayout.LEFT);
    frame.getContentPane().add(panelSouth, BorderLayout.SOUTH);
    setupRunButtons(panelSouth);

    frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);

    frame.setJMenuBar(createMenuBar());
}

From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java

/**
 * Initializes and returns a split pane, either vertical or horizontal 
 * depending on the passed parameter.//from   w  w  w .jav  a2  s . c om
 * 
 * @param orientation The orientation of the split pane.
 * @return See above.
 */
private JSplitPane initSplitPane(int orientation) {
    int type;
    switch (orientation) {
    case JSplitPane.HORIZONTAL_SPLIT:
    case JSplitPane.VERTICAL_SPLIT:
        type = orientation;
        break;
    default:
        type = JSplitPane.HORIZONTAL_SPLIT;
    }
    JSplitPane pane = new JSplitPane(type);
    pane.setOneTouchExpandable(true);
    pane.setContinuousLayout(true);
    pane.setDividerLocation(-1);
    pane.setResizeWeight(0.0);
    return pane;
}

From source file:org.optaplanner.mes.common.swingui.SolverAndPersistenceFrame.java

private JComponent createContentPane() {
    // JComponent quickOpenPanel = createQuickOpenPanel();
    JComponent quickOpenPanel = createQuickOpenScorePanel();
    JPanel mainPanel = new JPanel(new BorderLayout());
    mainPanel.add(createToolBar(), BorderLayout.NORTH);
    mainPanel.add(createMiddlePanel(), BorderLayout.CENTER);
    mainPanel.add(createScorePanel(), BorderLayout.SOUTH);
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, quickOpenPanel, mainPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setResizeWeight(0.2);/*  ww w  .j a va  2  s .  c om*/
    return splitPane;
}

From source file:org.pentaho.reporting.engine.classic.demo.util.CompoundDemoFrame.java

protected Container createDefaultContentPane() {

    demoContent = new JPanel();
    demoContent.setLayout(new BorderLayout());
    demoContent.setMinimumSize(new Dimension(100, 100));
    demoContent.add(getNoHandlerInfoPane(), BorderLayout.CENTER);

    JPanel placeHolder = new JPanel();
    placeHolder.setMinimumSize(new Dimension(300, 0));
    placeHolder.setPreferredSize(new Dimension(300, 0));
    placeHolder.setMaximumSize(new Dimension(300, 0));

    JPanel rootContent = new JPanel();
    rootContent.setLayout(new BorderLayout());
    rootContent.add(demoContent, BorderLayout.CENTER);
    rootContent.add(placeHolder, BorderLayout.NORTH);

    final DemoSelectorTreeNode root = new DemoSelectorTreeNode(null, demoSelector);
    final DefaultTreeModel model = new DefaultTreeModel(root);
    final JTree demoTree = new JTree(model);
    demoTree.addTreeSelectionListener(new TreeSelectionHandler());

    JSplitPane rootSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(demoTree),
            rootContent);//from   ww  w  . j a v  a2  s .com
    rootSplitPane.setContinuousLayout(true);
    rootSplitPane.setDividerLocation(200);
    rootSplitPane.setOneTouchExpandable(true);
    return rootSplitPane;
}

From source file:org.pentaho.reporting.engine.classic.demo.util.CompoundDemoFrame.java

protected JComponent createDefaultDemoPane(final InternalDemoHandler demoHandler) {
    final JPanel content = new JPanel(new BorderLayout());
    content.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    final URL url = demoHandler.getDemoDescriptionSource();
    final JComponent scroll = createDescriptionTextPane(url);

    final JButton previewButton = new JButton(getPreviewAction());

    final JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    splitPane.setTopComponent(scroll);/* www . j a  v  a  2  s .  c  o  m*/
    splitPane.setBottomComponent(demoHandler.getPresentationComponent());
    splitPane.setDividerLocation(200);
    splitPane.setOneTouchExpandable(true);
    content.add(splitPane, BorderLayout.CENTER);
    content.add(previewButton, BorderLayout.SOUTH);
    return content;
}

From source file:org.richie.codeGen.ui.CodeGenMainUI.java

private void initlize() {
    setTitle("??");
    setBounds(120, 80, 1024, 550);//from   w  ww  .j  a va  2 s.co m
    setDefaultCloseOperation(3);
    setLayout(new BorderLayout(5, 5));
    // ?MenuBar
    initMenuBar();
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, getWestPanel(), getCenterPanel());
    split.setContinuousLayout(false);
    split.setOneTouchExpandable(true);
    split.setDividerLocation(150);
    add(split, BorderLayout.CENTER);
    //?pdm
    openLastPdmFile();
    addCloseListener();
    this.setIconImage(new ImageIcon(ClassLoader.getSystemResource("resources/images/logo.jpg")).getImage());
}