Example usage for javax.swing JSplitPane setDividerLocation

List of usage examples for javax.swing JSplitPane setDividerLocation

Introduction

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

Prototype

@BeanProperty(description = "The location of the divider.")
public void setDividerLocation(int location) 

Source Link

Document

Sets the location of the divider.

Usage

From source file:org.apache.jmeter.protocol.amf.visualizers.RenderAsXPathAMF.java

/**
 * @return XPath Tester panel//from w  w  w  .  j  a  v a  2 s.com
 */
private JPanel createXpathExtractorPanel() {

    xmlDataField = new JTextArea();
    xmlDataField.setEditable(false);
    xmlDataField.setLineWrap(true);
    xmlDataField.setWrapStyleWord(true);

    this.xmlDataPane = GuiUtils.makeScrollPane(xmlDataField);
    xmlDataPane.setMinimumSize(new Dimension(0, 400));

    JPanel pane = new JPanel(new BorderLayout(0, 5));

    JSplitPane mainSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, xmlDataPane,
            createXpathExtractorTasksPanel());
    mainSplit.setDividerLocation(400);
    pane.add(mainSplit, BorderLayout.CENTER);
    return pane;
}

From source file:org.ayound.js.debug.ui.DebugMainFrame.java

private void initMainLayout() {
    final JSplitPane bottomSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, createMainPane(),
            createDebugPane());//from   ww  w.  j  av a  2  s .  c o  m
    bottomSplit.setDividerLocation(0.7);
    final JSplitPane totalSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, createDebugContextPane(),
            bottomSplit);
    totalSplit.setDividerLocation(0.25);
    this.addComponentListener(new ComponentAdapter() {
        public void componentResized(ComponentEvent e) {
            bottomSplit.setDividerLocation(0.7);
            totalSplit.setDividerLocation(0.25);
        }

    });

    add(totalSplit);
}

From source file:org.executequery.gui.editor.ManageShortcutsPanel.java

private JSplitPane createSplitPane() {

    JSplitPane splitPane = new FlatSplitPane(JSplitPane.VERTICAL_SPLIT);

    splitPane.setDividerSize(4);/* ww w.  java 2  s.c om*/
    splitPane.setResizeWeight(0.5);
    splitPane.setDividerLocation(0.5);

    return splitPane;
}

From source file:org.executequery.gui.ExecuteProcedurePanel.java

private void init() throws Exception {

    tableModel = new ParameterTableModel();
    table = new DefaultTable(tableModel);
    table.getTableHeader().setReorderingAllowed(false);
    table.setCellSelectionEnabled(true);
    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(false);

    connectionsCombo = WidgetFactory.createComboBox();
    schemaCombo = WidgetFactory.createComboBox();

    combosGroup = new TableSelectionCombosGroup(connectionsCombo, schemaCombo, null);
    combosGroup.addItemSelectionListener(this);

    objectTypeCombo = WidgetFactory.createComboBox(createAvailableObjectTypes());
    objectTypeCombo.setToolTipText("Select the database object type");
    objectTypeCombo.addItemListener(this);

    proceduresModel = new DynamicComboBoxModel();
    procedureCombo = WidgetFactory.createComboBox(proceduresModel);
    procedureCombo.setActionCommand("procedureSelectionChanged");
    procedureCombo.setToolTipText("Select the database object name");
    procedureCombo.addActionListener(this);

    JPanel base = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(5, 7, 5, 8);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridy++;/* ww w  .j  a va2  s  . c  o m*/
    base.add(new JLabel("Connection:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.left = 0;
    base.add(connectionsCombo, gbc);
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridy++;
    gbc.insets.left = 7;
    gbc.insets.top = 0;
    base.add(new JLabel("Schema:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.left = 0;
    base.add(schemaCombo, gbc);
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridy++;
    gbc.insets.left = 7;
    gbc.insets.top = 0;
    base.add(new JLabel("Object Type:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.left = 0;
    base.add(objectTypeCombo, gbc);
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridy++;
    gbc.insets.left = 7;
    base.add(new JLabel("Object Name:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.left = 0;
    base.add(procedureCombo, gbc);

    resultsPanel = new QueryEditorResultsPanel();
    JPanel resultsBase = new JPanel(new BorderLayout());
    resultsBase.add(resultsPanel, BorderLayout.CENTER);

    JSplitPane splitPane = new SplitPaneFactory().create(JSplitPane.VERTICAL_SPLIT, new JScrollPane(table),
            resultsBase);
    splitPane.setResizeWeight(0.5);
    splitPane.setDividerLocation(0.75);
    splitPane.setDividerSize(5);

    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weighty = 1.0;
    gbc.insets.left = 7;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    base.add(splitPane, gbc);

    JButton executeButton = ActionUtilities.createButton(this, "Execute", "execute");

    gbc.gridy++;
    gbc.weighty = 0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets.top = 0;
    gbc.insets.bottom = 20;
    base.add(executeButton, gbc);

    base.setBorder(BorderFactory.createEtchedBorder());
    setBorder(BorderFactory.createEmptyBorder(5, 5, 7, 5));

    add(base, BorderLayout.CENTER);

    EventMediator.registerListener(this);

    connectionSelectionMade();
}

From source file:org.intermine.install.swing.ProjectEditor.java

/**
 * Common initialisation: lays out the child components and wires up the necessary
 * event listeners. //from  ww  w . j a  v  a  2 s  .c o m
 */
private void init() {

    setName("Project Editor Frame");
    setTitle(Messages.getMessage("projecteditor.title"));
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    addWindowListener(new MyWindowListener());

    modelViewerFrame = new JFrame();
    modelViewerFrame.setName("Model Viewer Frame");

    modelViewer = new ModelViewer();
    modelViewerFrame.setContentPane(modelViewer);
    modelViewerFrame.setTitle(Messages.getMessage("modelviewer.title"));
    modelViewerFrame.setSize(800, 600);

    newMineDialog = new NewMineDialog(this);
    createDatabaseDialog = new CreateDatabaseDialog(this);
    newMineDialog.setCreateDatabaseDialog(createDatabaseDialog);
    createPropertiesDialog = new CreatePropertiesDialog(this);
    createDatabaseDialog.setCreatePropertiesDialog(createPropertiesDialog);
    makeMineDialog = new MakeMineDialog(this);
    createPropertiesDialog.setMakeMineDialog(makeMineDialog);

    addSourceDialog = new AddSourceDialog(this);
    newDerivedSourceDialog = new NewDerivedTypeDialog(this);
    addSourceDialog.setNewDerivedDialog(newDerivedSourceDialog);

    postProcessorDialog = new PostProcessorDialog(this);

    buildProjectDialog = new BuildProjectDialog(this);

    preferencesDialog = new PreferencesDialog(this);

    ProjectListener projectListener = new MyProjectListener();
    addSourceDialog.addProjectListener(projectListener);
    newDerivedSourceDialog.addProjectListener(projectListener);
    postProcessorDialog.addProjectListener(projectListener);
    sourcePanel.addProjectListener(projectListener);
    makeMineDialog.addProjectListener(projectListener);
    addProjectListener(projectListener);

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    JMenu fileMenu = new JMenu(Messages.getMessage("file"));
    fileMenu.setMnemonic(KeyEvent.VK_P);
    menuBar.add(fileMenu);

    fileMenu.add(new NewMineAction());
    fileMenu.add(new OpenAction());
    fileMenu.addSeparator();
    fileMenu.add(saveAction);
    fileMenu.addSeparator();
    fileMenu.add(buildProjectAction);

    JMenu editMenu = new JMenu(Messages.getMessage("edit"));
    editMenu.setMnemonic(KeyEvent.VK_E);
    menuBar.add(editMenu);

    editMenu.add(addSourceAction);
    editMenu.add(deleteSourceAction);
    editMenu.addSeparator();
    editMenu.add(postProcessorAction);

    JMenu viewMenu = new JMenu(Messages.getMessage("view"));
    viewMenu.setMnemonic(KeyEvent.VK_M);
    menuBar.add(viewMenu);

    viewMenu.add(new ViewModelAction());

    JMenu toolsMenu = new JMenu(Messages.getMessage("tools"));
    toolsMenu.setMnemonic(KeyEvent.VK_T);
    menuBar.add(toolsMenu);

    toolsMenu.add(new PreferencesAction());

    sourceListModel = new SourceListModel();
    sourceList = new JList(sourceListModel);

    Container cp = getContentPane();
    cp.setLayout(new BorderLayout());

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    cp.add(splitPane, BorderLayout.CENTER);

    initButtonPanel();

    Box vbox = Box.createVerticalBox();
    vbox.add(sourcePanel);
    vbox.add(buttonPanel);

    splitPane.setLeftComponent(new JScrollPane(sourceList));
    splitPane.setRightComponent(vbox);

    splitPane.setDividerLocation(200);

    initStatusPanel();
    cp.add(statusPanel, BorderLayout.SOUTH);

    sourceList.setCellRenderer(new SourceListRenderer());
    sourceList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    sourceList.addListSelectionListener(new SourceListSelectionListener());

    statusMessageClearTimer = new Timer(4000, new StatusMessageClearer());
    statusMessageClearTimer.setInitialDelay(4000);
    statusMessageClearTimer.setRepeats(false);

    setSize(800, 600);
}

From source file:org.intermine.modelviewer.swing.ModelViewer.java

/**
 * Lays out the components within this panel and wires up the relevant
 * event listeners.//from   w  w  w  .j  a  v  a 2s .c  o  m
 */
private void init() {

    FileFilter xmlFilter = new XmlFileFilter();
    projectFileChooser = new JFileChooser();
    projectFileChooser.addChoosableFileFilter(xmlFilter);
    projectFileChooser.setAcceptAllFileFilterUsed(false);
    projectFileChooser.setFileFilter(xmlFilter);

    File lastProjectFile = MineManagerBackingStore.getInstance().getLastProjectFile();
    if (lastProjectFile != null) {
        projectFileChooser.setSelectedFile(lastProjectFile);
    }

    initButtonPanel();

    classTreeModel = new ClassTreeModel();
    classTree = new JTree(classTreeModel);
    classTree.setCellRenderer(new ClassTreeCellRenderer());
    classTree.setRootVisible(false);
    classTree.setShowsRootHandles(true);

    Box vbox = Box.createVerticalBox();
    vbox.add(new JScrollPane(classTree));
    vbox.add(buttonPanel);

    DefaultTreeSelectionModel selectionModel = new DefaultTreeSelectionModel();
    selectionModel.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    classTree.setSelectionModel(selectionModel);

    classTree.addTreeSelectionListener(new ClassTreeSelectionListener());

    attributeTableModel = new AttributeTableModel();
    attributeTable = new AttributeTable(attributeTableModel);

    referenceTableModel = new ReferenceTableModel();
    referenceTable = new ReferenceTable(referenceTableModel);

    graphModel = new mxGraphModel();
    graph = new CustomisedMxGraph(graphModel);

    graphComponent = new mxGraphComponent(graph);
    graphComponent.setEscapeEnabled(true);

    JTabbedPane tableTab = new JTabbedPane(SwingConstants.TOP, JTabbedPane.SCROLL_TAB_LAYOUT);
    tableTab.add(Messages.getMessage("tab.attributes"), new JScrollPane(attributeTable));
    tableTab.add(Messages.getMessage("tab.references"), new JScrollPane(referenceTable));

    JSplitPane rightSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT, tableTab, graphComponent);

    JSplitPane mainSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, vbox, rightSplit);

    setOpaque(true);
    setLayout(new BorderLayout());
    add(mainSplit, BorderLayout.CENTER);

    rightSplit.setDividerLocation(150);
    mainSplit.setDividerLocation(200);

}

From source file:org.javaswift.cloudie.CloudiePanel.java

/**
 * creates Cloudie and does not login.//w ww . j a v  a 2  s. c o m
 */
public CloudiePanel() {
    super(new BorderLayout());
    //
    ops = createCloudieOperations();
    callback = GuiTreadingUtils.guiThreadSafe(CloudieCallback.class, this);
    //
    statusPanel = new StatusPanel(ops, callback);
    //
    JScrollPane left = new JScrollPane(containersList);
    //
    storedObjectsList.setMinimumSize(new Dimension(420, 320));
    JSplitPane center = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(storedObjectsList),
            new JScrollPane(previewPanel));
    center.setDividerLocation(450);
    //
    JSplitPane main = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, center);
    main.setDividerLocation(272);
    add(main, BorderLayout.CENTER);
    //
    add(statusPanel, BorderLayout.SOUTH);
    //
    searchTextField.setAction(searchAction);
    //
    createLists();
    //
    storedObjectsList.addMouseListener(new PopupTrigger<CloudiePanel>(createStoredObjectPopupMenu(), this,
            "enableDisableStoredObjectMenu"));
    storedObjectsList.addMouseListener(new DoubleClickListener(storedObjectPreviewAction));
    containersList.addMouseListener(
            new PopupTrigger<CloudiePanel>(createContainerPopupMenu(), this, "enableDisableContainerMenu"));
    //
    bind();
    //
    enableDisable();
}

From source file:org.jreversepro.gui.ClassEditPanel.java

/**
 * Constructor.//from  ww  w  .jav  a2 s. c om
 **/
public ClassEditPanel() {
    mTxtJava = new EditorJavaDocument();
    mAppFont = new Font(DEFAULT_FONT, Font.PLAIN, 12);

    // initTree
    mRoot = new DefaultMutableTreeNode(TREE_ROOT);
    mTreeFieldMethod = new JTree(mRoot);

    JScrollPane ScrDocument = new JScrollPane(mTxtJava);
    JScrollPane ScrTree = new JScrollPane(mTreeFieldMethod);

    ScrDocument.setPreferredSize(new Dimension(500, 200));
    ScrTree.setPreferredSize(new Dimension(500, 200));

    setSize(500, 200);

    // arrange Components
    JSplitPane mSplitter = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, false, ScrTree, ScrDocument);
    mSplitter.setDividerLocation(0.5);
    setLayout(new GridLayout(1, 1));
    add(mSplitter);
}

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

/**
 * default constructor to create the framework core panel.
 *///www.  j  a va  2 s . 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.
 * /*from  w w w  .  j  a v a2  s .c om*/
 * @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;
}