Example usage for javax.swing JSplitPane add

List of usage examples for javax.swing JSplitPane add

Introduction

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

Prototype

public Component add(String name, Component comp) 

Source Link

Document

Adds the specified component to this container.

Usage

From source file:eu.cassandra.platform.gui.GUI.java

public GUI() {
    //redirectSystemStreams();
    a = new ListenInstallationComboBox();
    installationCombo.setPreferredSize(new Dimension(300, 20));

    startButton.addActionListener(new ListenStartButton());
    exitButton.addActionListener(new ListenExitButton());
    projectFileField.addMouseListener(new ListenProjectFileField());

    logTextAreaScrollPane.setPreferredSize(new Dimension(400, 500));

    projectFileField.setPreferredSize(new Dimension(600, 20));
    //      projectFileField.setText(new File(Params.SIM_PROPS).getAbsolutePath());
    projectFileField.setText("");
    projectFileField.setEditable(false);

    f.setJMenuBar(menuBar);/* ww  w. j  a v  a2  s.  c om*/

    menuFile.add(menuItemQuit);
    menuHelp.add(menuItemAbout);
    menuBar.add(menuFile);
    menuBar.add(menuHelp);

    statsTextArea.setFont(new Font("Tahoma", Font.BOLD, 12));

    TimeSeries series = new TimeSeries("");
    dataset = new TimeSeriesCollection(series);
    JFreeChart chart = createChart("Consumption", dataset);
    ChartPanel chartPanel = new ChartPanel(chart);
    graphScrollPane = new JScrollPane(chartPanel);

    buttonPanel.add(projectFileField);
    buttonPanel.add(startButton);
    buttonPanel.add(holdButton);
    buttonPanel.add(installationCombo);
    buttonPanel.add(exitButton);

    statsTextArea.setText("Statistics:\n");
    logTextArea.setText("Logs:\n");

    JSplitPane textAreaSplitPanel = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

    textAreaSplitPanel.setDividerLocation((int) (Toolkit.getDefaultToolkit().getScreenSize().getHeight() / 2));
    textAreaSplitPanel.add(statsTextAreaScrollPane, JSplitPane.TOP);
    textAreaSplitPanel.add(logTextAreaScrollPane, JSplitPane.BOTTOM);

    JSplitPane mainSplitPanel = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    mainSplitPanel.add(graphScrollPane, JSplitPane.LEFT);
    mainSplitPanel.add(textAreaSplitPanel, JSplitPane.RIGHT);
    mainSplitPanel.setDividerLocation((int) (Toolkit.getDefaultToolkit().getScreenSize().getWidth() / 1.5));

    f.getContentPane().setLayout(new BorderLayout());
    f.getContentPane().add(mainSplitPanel, BorderLayout.CENTER);
    f.getContentPane().add(buttonScrollPane, BorderLayout.SOUTH);

    f.addWindowListener(new ListenCloseWdw());
    menuItemQuit.addActionListener(new ListenMenuQuit());
}

From source file:hermes.browser.actions.AbstractFIXBrowserDocumentComponent.java

protected void init() {
    headerScrollPane.setViewportView(getHeaderComponent());

    bottomPanel.add(new FilterablePanel(), BorderLayout.NORTH);
    bottomPanel.add(getStatusPanel(), BorderLayout.SOUTH);

    getTopPanel().setLayout(new BorderLayout());

    JSplitPane splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

    splitPane.setDividerLocation(200);/*from  www .j a va2s . c  o  m*/
    splitPane.setOneTouchExpandable(false);
    splitPane.setContinuousLayout(false);
    splitPane.add(headerScrollPane, "top");
    splitPane.add(messageTabbedPane, "bottom");

    messageTabbedPane.setTabPlacement(JTabbedPane.BOTTOM);

    getTopPanel().add(splitPane, BorderLayout.CENTER);
    getTopPanel().add(getBottomComponent(), BorderLayout.SOUTH);

    HermesBrowser.getBrowser().addDocumentComponent(this);

    addDocumentComponentListener(this);

    updateTableRows(true);
}

From source file:org.ash.history.detail.DetailsPanelH.java

/**
 * Add ChartPanel to mainPanel/*from   w ww  .  j  a v  a2 s .  co m*/
 * @param waitClass
 */
private void addChartPanelT(String waitClass) {

    JSplitPane splitPaneMainDetail = new JSplitPane();

    StackedChartDetail stackedChartMainObjectDetail = new StackedChartDetail(database, waitClass);

    ChartPanel chartDetailPanel = stackedChartMainObjectDetail.createChartPanel();
    stackedChartMainObjectDetail.setThresholdMaxCpu(this.maxCpu);

    GanttDetailsH sqlsAndSessions = new GanttDetailsH(database, waitClass);
    chartDetailPanel.addListenerReleaseMouse(sqlsAndSessions);

    database.clearStackedXYAreaChartDetail();
    database.saveStackedXYAreaChartDetail(stackedChartMainObjectDetail, waitClass);
    database.initialLoadingDataToChartPanelDataSetDetail(waitClass, this.beginTime, this.endTime);

    stackedChartMainObjectDetail.setTitle();

    this.mainPanel.removeAll();

    splitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPaneMainDetail.add(chartDetailPanel, "top");
    splitPaneMainDetail.add(sqlsAndSessions, "bottom");
    splitPaneMainDetail.setDividerLocation(215);
    splitPaneMainDetail.setOneTouchExpandable(true);

    this.mainPanel.add(splitPaneMainDetail, BorderLayout.CENTER);
    this.validate();
    this.repaint();
}

From source file:com.zigabyte.stock.stratplot.StrategyPlotter.java

private void initLayout() {
    Container content = this.getContentPane();
    JComponent controls = Box.createVerticalBox();
    {//from www .j  a v  a2  s .c o m
        JPanel filePanel = new JPanel(new BorderLayout());
        {
            filePanel.setBorder(BorderFactory.createTitledBorder("Stock Market Trading Data"));
            JPanel dataButtons = new JPanel(new GridLayout(2, 1));
            {
                dataButtons.add(this.loadFileButton);
                dataButtons.add(this.viewDataButton);
            }
            filePanel.add(dataButtons, BorderLayout.EAST);
            JPanel fileControls = new JPanel(new FlowLayout());
            {
                fileControls.add(new JLabel("Stock data File:"));
                fileControls.add(this.fileField);
                fileControls.add(this.fileBrowseButton);
                fileControls.add(new JLabel("  Stock data format:"));
                fileControls.add(this.fileFormatCombo);
            }
            filePanel.add(fileControls, BorderLayout.CENTER);
        }
        controls.add(filePanel);
        JComponent simPanel = new JPanel(new BorderLayout());
        {
            simPanel.setBorder(BorderFactory.createTitledBorder("Simulation Run"));
            simPanel.add(this.runButton, BorderLayout.EAST);
            JComponent simControlsPanel = Box.createVerticalBox();
            {
                JPanel accountControls = new JPanel(new FlowLayout());
                {
                    accountControls.add(new JLabel("Initial Cash:"));
                    accountControls.add(this.initialCashField);
                    accountControls.add(new JLabel("  Per Trade Fee:"));
                    accountControls.add(this.perTradeFeeField);
                    accountControls.add(new JLabel("  Per Share Trade Commission:"));
                    accountControls.add(this.perShareTradeCommissionField);
                    accountControls.add(new JLabel("  Compare:"));
                    accountControls.add(this.compareIndexSymbolField);
                }
                simControlsPanel.add(accountControls);
                JPanel runControls = new JPanel(new FlowLayout());
                {
                    runControls.add(this.strategyField);
                    runControls.add(new JLabel("Start Date:"));
                    runControls.add(this.startDateField);
                    runControls.add(new JLabel("  End Date:"));
                    runControls.add(this.endDateField);
                    runControls.add(new JLabel("  Strategy:"));
                    runControls.add(this.strategyField);
                    runControls.add(this.editButton);
                    runControls.add(this.compileButton);
                }
                simControlsPanel.add(runControls);
            }
            simPanel.add(simControlsPanel, BorderLayout.CENTER);
        }
        controls.add(simPanel);
    }
    content.add(controls, BorderLayout.NORTH);
    JSplitPane vSplit = this.vSplit;
    {
        vSplit.setResizeWeight(0.5);
        vSplit.add(this.chartPanel, JSplitPane.TOP);
        JSplitPane hSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
        {
            hSplit.setResizeWeight(0.5); // enough for no hscrollbar in 1024 width
            JSplitPane reportSplit = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
            {
                reportSplit.setResizeWeight(0.5);
                JScrollPane reportScroll = new JScrollPane(this.reportArea);
                {
                    reportScroll.setBorder(BorderFactory.createTitledBorder("Report"));
                }
                reportSplit.add(reportScroll, JSplitPane.TOP);
                JScrollPane monthScroll = new JScrollPane(this.monthlyLogArea);
                {
                    monthScroll.setBorder(BorderFactory.createTitledBorder("Monthly Log"));
                }
                reportSplit.add(monthScroll, JSplitPane.BOTTOM);
            }
            hSplit.add(reportSplit, JSplitPane.LEFT);
            JScrollPane tradeScroll = new JScrollPane(this.tradeLogArea);
            {
                tradeScroll.setBorder(BorderFactory.createTitledBorder("Trade Log"));
            }
            hSplit.add(tradeScroll, JSplitPane.RIGHT);
        }
        vSplit.add(hSplit, JSplitPane.BOTTOM);
    }
    content.add(vSplit, BorderLayout.CENTER);
}

From source file:org.ash.history.detail.DetailsPanelH.java

/**
 * Initialize DetailFrame/* w  w w .  ja va 2  s . c o m*/
 */
private void initialize() {

    this.setLayout(new BorderLayout());
    JSplitPane splitPaneMainDetail = new JSplitPane();

    this.cpuRadioButton.setText(Options.getInstance().getResource("cpuLabel.text"));
    this.cpuRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.cpuRadioButton);
    this.schedulerRadioButton.setText(Options.getInstance().getResource("schedulerLabel.text"));
    this.schedulerRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.schedulerRadioButton);
    this.userIORadioButton.setText(Options.getInstance().getResource("userIOLabel.text"));
    this.userIORadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.userIORadioButton);
    this.systemIORadioButton.setText(Options.getInstance().getResource("systemIOLabel.text"));
    this.systemIORadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.systemIORadioButton);
    this.concurrencyRadioButton.setText(Options.getInstance().getResource("concurrencyLabel.text"));
    this.concurrencyRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.concurrencyRadioButton);
    this.applicationRadioButton.setText(Options.getInstance().getResource("applicationsLabel.text"));
    this.applicationRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.applicationRadioButton);
    this.commitRadioButton.setText(Options.getInstance().getResource("commitLabel.text"));
    this.commitRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.commitRadioButton);
    this.configurationRadioButton.setText(Options.getInstance().getResource("configurationLabel.text"));
    this.configurationRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.configurationRadioButton);
    this.administrativeRadioButton.setText(Options.getInstance().getResource("administrativeLabel.text"));
    this.administrativeRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.administrativeRadioButton);
    this.networkRadioButton.setText(Options.getInstance().getResource("networkLabel.text"));
    this.networkRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.networkRadioButton);
    this.queuningRadioButton.setText(Options.getInstance().getResource("queueningLabel.text"));
    this.queuningRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.queuningRadioButton);
    this.clusterRadioButton.setText(Options.getInstance().getResource("clusterLabel.text"));
    this.clusterRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.clusterRadioButton);
    this.otherRadioButton.setText(Options.getInstance().getResource("otherLabel.text"));
    this.otherRadioButton.addItemListener(new SelectItemListenerRadioButton());
    this.setFont(this.otherRadioButton);

    this.buttonGroup.add(cpuRadioButton);
    this.buttonGroup.add(schedulerRadioButton);
    this.buttonGroup.add(userIORadioButton);
    this.buttonGroup.add(systemIORadioButton);
    this.buttonGroup.add(concurrencyRadioButton);
    this.buttonGroup.add(applicationRadioButton);
    this.buttonGroup.add(commitRadioButton);
    this.buttonGroup.add(configurationRadioButton);
    this.buttonGroup.add(administrativeRadioButton);
    this.buttonGroup.add(networkRadioButton);
    this.buttonGroup.add(queuningRadioButton);
    this.buttonGroup.add(clusterRadioButton);
    this.buttonGroup.add(otherRadioButton);

    /** Button panel fot buttons */
    this.buttonPanel = new JToolBar("PanelButton");
    this.buttonPanel.setFloatable(false);
    this.buttonPanel.setBorder(new EtchedBorder());

    this.buttonPanel.add(this.cpuRadioButton);
    this.buttonPanel.add(this.schedulerRadioButton);
    this.buttonPanel.add(this.userIORadioButton);
    this.buttonPanel.add(this.systemIORadioButton);
    this.buttonPanel.add(this.concurrencyRadioButton);
    this.buttonPanel.add(this.applicationRadioButton);
    this.buttonPanel.add(this.commitRadioButton);
    this.buttonPanel.add(this.configurationRadioButton);
    this.buttonPanel.add(this.administrativeRadioButton);
    this.buttonPanel.add(this.networkRadioButton);
    this.buttonPanel.add(this.queuningRadioButton);
    this.buttonPanel.add(this.clusterRadioButton);
    this.buttonPanel.add(this.otherRadioButton);

    splitPaneMainDetail.setOrientation(JSplitPane.VERTICAL_SPLIT);
    splitPaneMainDetail.add(new JPanel(), "top");
    splitPaneMainDetail.add(new JPanel(), "bottom");
    splitPaneMainDetail.setDividerLocation(230);
    splitPaneMainDetail.setOneTouchExpandable(true);

    this.mainPanel = new JPanel();
    this.mainPanel.setLayout(new BorderLayout());
    this.mainPanel.setVisible(true);
    this.mainPanel.add(splitPaneMainDetail, BorderLayout.CENTER);

    this.add(this.buttonPanel, BorderLayout.NORTH);
    this.add(this.mainPanel, BorderLayout.CENTER);
}

From source file:net.sourceforge.squirrel_sql.client.gui.HelpViewerWindow.java

/**
 * Create user interface./*from w  w w. j a  v  a 2  s.co m*/
 */
private void createGUI() throws IOException {
    setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    final SquirrelResources rsrc = _app.getResources();
    final ImageIcon icon = rsrc.getIcon(SquirrelResources.IImageNames.VIEW);
    if (icon != null) {
        setIconImage(icon.getImage());
    }

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

    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    splitPane.setBorder(BorderFactory.createEmptyBorder());
    splitPane.setOneTouchExpandable(true);
    splitPane.setContinuousLayout(true);
    splitPane.add(createContentsTree(), JSplitPane.LEFT);
    splitPane.add(createDetailsPanel(), JSplitPane.RIGHT);
    contentPane.add(splitPane, BorderLayout.CENTER);
    splitPane.setDividerLocation(200);

    contentPane.add(new HtmlViewerPanelToolBar(_app, _detailPnl), BorderLayout.NORTH);

    Font fn = _app.getFontInfoStore().getStatusBarFontInfo().createFont();
    _statusBar.setFont(fn);
    contentPane.add(_statusBar, BorderLayout.SOUTH);

    pack();

    SwingUtilities.invokeLater(new Runnable() {
        public void run() {
            _detailPnl.setHomeURL(_homeURL);
            _tree.expandRow(0);
            _tree.expandRow(2);
            if (_app.getSquirrelPreferences().isFirstRun()) {
                _tree.setSelectionRow(1);
            } else {
                _tree.setSelectionRow(3);
            }
            _tree.setRootVisible(false);
        }
    });

    _detailPnl.addListener(new IHtmlViewerPanelListener() {
        public void currentURLHasChanged(HtmlViewerPanelListenerEvent evt) {
            selectTreeNodeForURL(evt.getHtmlViewerPanel().getURL());
        }

        public void homeURLHasChanged(HtmlViewerPanelListenerEvent evt) {
            // Nothing to do.
        }
    });
}

From source file:org.jcurl.demo.smack.JCurlSmackClient.java

@Override
protected void startup() {
    getMainFrame().setJMenuBar(createMenuBar());
    miRoster.setSelected(true);//  w ww  .  ja  v a  2  s . co m

    final JComponent pv = new JPanel();
    pv.setLayout(new BorderLayout());
    final Box conversation = Box.createVerticalBox();
    pv.add(new JScrollPane(conversation, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED), BorderLayout.CENTER);
    pv.add(new JScrollPane(sca, ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER,
            ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS), BorderLayout.SOUTH);

    final JSplitPane ph = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    ph.setResizeWeight(0.8);
    ph.add(pv, JSplitPane.LEFT);
    ph.add(new JScrollPane(sro), JSplitPane.RIGHT);

    xmppRoster();
    show(ph);

    // connect the jabber account
    new Thread(new Runnable() {
        public void run() {
            try {
                // get uid + pwd from a .properties file
                final Properties p = loadClassProps(JCurlSmackClient.class, null);
                acc.setUid(XmppAddress.parse(p.getProperty("acc_uid")));
                acc.setPwd(p.getProperty("acc_pwd"));
                // login and get the present buddies
                acc.login(resource);
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        sro.setConn(acc.getConn());
                        // Wire up xmpp stuff:
                        final ChatManager cm = sro.getChatManager();
                        cm.addChatListener(sca);
                        cm.addChatListener(slo);
                    }
                });
            } catch (final IOException e) {
                throw new RuntimeException("Unhandled", e);
            } catch (final XMPPException e) {
                throw new RuntimeException("Unhandled", e);
            }
        }
    }).start();
}