Example usage for javax.swing BoxLayout BoxLayout

List of usage examples for javax.swing BoxLayout BoxLayout

Introduction

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

Prototype

@ConstructorProperties({ "target", "axis" })
public BoxLayout(Container target, int axis) 

Source Link

Document

Creates a layout manager that will lay out components along the given axis.

Usage

From source file:diet.gridr.g5k.gui.GanttChart.java

/**
 * Method returning the TablePanel//  w  w  w. j a va2s  .  co  m
 *
 * @return the table panel
 */
private JPanel getTablePanel() {
    tablePanel = new JPanel();
    tablePanel.setLayout(new BoxLayout(tablePanel, BoxLayout.Y_AXIS));
    tablePanel.setBorder(BorderFactory.createEmptyBorder(5, 10, 10, 10));
    jobsTable = new JTable();
    jobsModel = new ClusterJobsSummaryModel();
    jobsTable.setModel(jobsModel);
    ClusterJobsSummaryCellRenderer renderer = new ClusterJobsSummaryCellRenderer();
    jobsTable.setDefaultRenderer(String.class, renderer);
    JLabel jobsTableTitle = new JLabel("Jobs status");
    jobsTableTitle.setAlignmentX(JLabel.CENTER_ALIGNMENT);
    jobsTableTitle.setFont(new Font("Dialog", Font.BOLD, 14));
    tablePanel.add(Box.createVerticalStrut(5));
    tablePanel.add(jobsTableTitle);
    tablePanel.add(Box.createVerticalStrut(10));
    tablePanel.add(jobsTable.getTableHeader());
    tablePanel.add(jobsTable);
    LoggingManager.log(Level.FINE, LoggingManager.RESOURCESTOOL, this.getClass().getName(), "getTablePanel",
            "TablePanel constructed");
    return tablePanel;
}

From source file:edu.ucla.stat.SOCR.applications.demo.PortfolioApplication2.java

public void init() {

    //   dataPoints = new LinkedList();
    t1_x = t2_x = 0;//  ww w  .j a  v a 2  s.  c o  m
    t1_y = t2_y = 0.001;
    simulatedPoints = setupUniformSimulate(numStocks, numSimulate);
    tabbedPanelContainer = new JTabbedPane();
    show_tangent = true;

    //   addGraph(chartPanel);
    //   addToolbar(sliderPanel);
    initGraphPanel();
    initMixPanel();
    initInputPanel();
    emptyTool();
    emptyTool2();
    leftControl = new JPanel();
    leftControl.setLayout(new BoxLayout(leftControl, BoxLayout.PAGE_AXIS));
    addRadioButton2Left("Number of Stocks:", "", numStocksArray, numStocks - 2, this);
    addRadioButton2Left("Show Tangent Line :", "", on_off, 0, this);

    JScrollPane mixPanelContainer = new JScrollPane(mixPanel);
    mixPanelContainer.setPreferredSize(new Dimension(600, CHART_SIZE_Y + 100));

    addTabbedPane(GRAPH, graphPanel);

    addTabbedPane(INPUT, inputPanel);

    addTabbedPane(ALL, mixPanelContainer);

    setChart();

    tabbedPanelContainer.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == ALL) {
                mixPanel.removeAll();
                setMixPanel();
                mixPanel.validate();
            } else if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == GRAPH) {
                graphPanel.removeAll();
                setChart();

            } else if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) == INPUT) {
                //
                setInputPanel();
            }
        }
    });

    statusTextArea = new JTextPane(); //right side lower
    statusTextArea.setEditable(false);
    JScrollPane statusContainer = new JScrollPane(statusTextArea);
    statusContainer.setPreferredSize(new Dimension(600, 140));

    JSplitPane upContainer = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(leftControl),
            new JScrollPane(tabbedPanelContainer));

    this.getMainPanel().removeAll();
    if (SHOW_STATUS_TEXTAREA) {
        JSplitPane container = new JSplitPane(JSplitPane.VERTICAL_SPLIT, new JScrollPane(upContainer),
                statusContainer);
        container.setContinuousLayout(true);
        container.setDividerLocation(0.6);
        this.getMainPanel().add(container, BorderLayout.CENTER);
    } else {

        this.getMainPanel().add(new JScrollPane(upContainer), BorderLayout.CENTER);
    }
    this.getMainPanel().validate();

}

From source file:org.obiba.onyx.jade.instrument.ricelake.RiceLakeWeightInstrumentRunner.java

protected JPanel buildMeasureCountSubPanel() {
    JPanel panel = new JPanel();

    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.add(measureCountLabel = new MeasureCountLabel());
    panel.setAlignmentX(Component.LEFT_ALIGNMENT);

    return (panel);
}

From source file:diet.gridr.g5k.gui.ClusterInfoPanel.java

/**
 * Method returning the selectionChartPanel
 *
 * @return the selection chart panel/*from   ww w.  j  av  a 2  s . c  o  m*/
 */
private JPanel getSelectionChartPanel() {
    if (selectionChartPanel == null) {
        selectionChartPanel = new JPanel();
        selectionChartPanel.setLayout(new BoxLayout(selectionChartPanel, BoxLayout.X_AXIS));
        JLabel selectionChartLabel = new JLabel("Available charts: ");
        selectionChartPanel.add(selectionChartLabel);
        selectionChartPanel.add(Box.createHorizontalStrut(10));
        selectionChartPanel.add(getSelectionComboBox());
        selectionChartPanel.add(Box.createHorizontalGlue());

        if (Config.getBatchScheduler(G5kSite.getIndexForSite(siteName)).equalsIgnoreCase("OAR1")) {
            JButton button = new JButton("Jobs Gantt Chart");
            selectionChartPanel.add(button);
            button.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    Iterator<String> iter = jobsMap.keySet().iterator();
                    ArrayList<GridJob> jobsList = new ArrayList<GridJob>();
                    while (iter.hasNext()) {
                        jobsList.add(jobsMap.get(iter.next()));
                    }
                    new GanttChart("Jobs Gantt Chart", siteName, jobsList, connection);
                }
            });
        }
    }
    return selectionChartPanel;
}

From source file:DialogDemo.java

/**
 * Used by createSimpleDialogBox and createFeatureDialogBox to create a pane
 * containing a description, a single column of radio buttons, and the Show
 * it! button.//w  w  w .  j av  a  2s.com
 */
private JPanel createPane(String description, JRadioButton[] radioButtons, JButton showButton) {

    int numChoices = radioButtons.length;
    JPanel box = new JPanel();
    JLabel label = new JLabel(description);

    box.setLayout(new BoxLayout(box, BoxLayout.PAGE_AXIS));
    box.add(label);

    for (int i = 0; i < numChoices; i++) {
        box.add(radioButtons[i]);
    }

    JPanel pane = new JPanel(new BorderLayout());
    pane.add(box, BorderLayout.PAGE_START);
    pane.add(showButton, BorderLayout.PAGE_END);
    return pane;
}

From source file:diet.gridr.g5k.gui.G5kSummaryChart.java

/**
 * Method returning the chart selection panel
 *
 * @return panel for the selection of a chart to display
 *///from ww w.  ja v  a2 s. c om
private JPanel getChartSelectionPanel() {
    if (chartSelectionPanel == null) {
        chartSelectionPanel = new JPanel();
        chartSelectionPanel.setLayout(new BoxLayout(chartSelectionPanel, BoxLayout.X_AXIS));
        chartSelectionLabel = new JLabel("Available charts :");
        chartSelectionPanel.add(chartSelectionLabel);
        chartSelectionPanel.add(Box.createHorizontalStrut(10));
        chartSelectionPanel.add(getChartSelectionComboBox());
        chartSelectionPanel.add(Box.createHorizontalGlue());
    }
    return chartSelectionPanel;
}

From source file:org.obiba.onyx.jade.instrument.ricelake.RiceLakeWeightInstrumentRunner.java

protected JPanel buildResultsSubPanel() {
    final JPanel panel = new JPanel();

    panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.setLayout(new BoxLayout(panel, BoxLayout.X_AXIS));
    panel.add(new JLabel(resourceBundle.getString("Weight") + ":"));
    panel.add(Box.createRigidArea(new Dimension(10, 0)));
    panel.add(weightTxt);//w  w w .ja v a2 s. c  o m
    panel.add(Box.createRigidArea(new Dimension(10, 0)));
    panel.add(new JLabel(resourceBundle.getString("kg")));
    panel.setAlignmentX(Component.LEFT_ALIGNMENT);

    return panel;
}

From source file:org.spf4j.ui.TSDBViewJInternalFrame.java

@edu.umd.cs.findbugs.annotations.SuppressWarnings("UP_UNUSED_PARAMETER")
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
    TreePath[] selectionPaths = measurementTree.getSelectionPaths();
    JPanel content = new JPanel();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
    chartPannel.setViewportView(content);
    try {//from www  .  j  av a2  s  .  c o m
        List<String> selectedTables = getSelectedTables(selectionPaths);
        for (String tableName : selectedTables) {
            addChartToPanel(tableName, content);
        }
    } catch (IOException ex) {
        throw new RuntimeException(ex);
    }
    chartPannel.repaint();
}

From source file:se.six.jmeter.visualizer.statagg.StatAggVisualizer.java

/**
 * Main visualizer setup.//w ww . j  a  v  a 2s.  c  o m
 */
private void init() {
    this.setLayout(new BorderLayout());

    // MAIN PANEL
    JPanel mainPanel = new JPanel();
    Border margin = new EmptyBorder(10, 10, 5, 10);

    mainPanel.setBorder(margin);
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));

    //mainPanel.add(makeTitlePanel());
    _chart = createChart();
    _chartPanel = new ChartPanel(_chart);
    mainPanel.add(_chartPanel);

    _model = new StatAggTreeTableModel();
    _table = new JXTreeTable(_model);
    _table.setRootVisible(false);
    //table.setShowHorizontalLines(true);
    //table.setShowVerticalLines(true);
    _table.setLeafIcon(new ImageIcon(getClass().getResource("task.png")));
    _table.setRowSelectionAllowed(true);
    _table.setExpandsSelectedPaths(true);
    _table.setPreferredScrollableViewportSize(new Dimension(500, 70));

    JScrollPane scrollPane = new JScrollPane(_table);
    this.add(mainPanel, BorderLayout.NORTH);
    this.add(scrollPane, BorderLayout.CENTER);
}

From source file:org.broad.igv.util.stats.KMPlotFrame.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    panel1 = new JPanel();
    panel2 = new JPanel();
    label2 = new JLabel();
    survivalColumnControl = new JComboBox();
    panel3 = new JPanel();
    label3 = new JLabel();
    censurColumnControl = new JComboBox();
    panel4 = new JPanel();
    label4 = new JLabel();
    groupByControl = new JComboBox();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("Kaplan-Meier Plot");
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {/*from w  ww .  jav  a  2 s . c o  m*/
        dialogPane.setBorder(new EmptyBorder(12, 12, 12, 12));
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new BorderLayout());

            //======== panel1 ========
            {
                panel1.setAlignmentX(0.0F);
                panel1.setLayout(new BoxLayout(panel1, BoxLayout.Y_AXIS));

                //======== panel2 ========
                {
                    panel2.setAlignmentX(1.0F);
                    panel2.setLayout(null);

                    //---- label2 ----
                    label2.setText("Survival column");
                    panel2.add(label2);
                    label2.setBounds(new Rectangle(new Point(5, 10), label2.getPreferredSize()));

                    //---- survivalColumnControl ----
                    survivalColumnControl.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            survivalColumnControlActionPerformed(e);
                        }
                    });
                    panel2.add(survivalColumnControl);
                    survivalColumnControl.setBounds(120, 5, 235,
                            survivalColumnControl.getPreferredSize().height);

                    { // compute preferred size
                        Dimension preferredSize = new Dimension();
                        for (int i = 0; i < panel2.getComponentCount(); i++) {
                            Rectangle bounds = panel2.getComponent(i).getBounds();
                            preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                            preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                        }
                        Insets insets = panel2.getInsets();
                        preferredSize.width += insets.right;
                        preferredSize.height += insets.bottom;
                        panel2.setMinimumSize(preferredSize);
                        panel2.setPreferredSize(preferredSize);
                    }
                }
                panel1.add(panel2);

                //======== panel3 ========
                {
                    panel3.setAlignmentX(1.0F);
                    panel3.setLayout(null);

                    //---- label3 ----
                    label3.setText("Censure column");
                    panel3.add(label3);
                    label3.setBounds(new Rectangle(new Point(5, 10), label3.getPreferredSize()));

                    //---- censurColumnControl ----
                    censurColumnControl.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            survivalColumnControlActionPerformed(e);
                        }
                    });
                    panel3.add(censurColumnControl);
                    censurColumnControl.setBounds(120, 5, 235, censurColumnControl.getPreferredSize().height);

                    { // compute preferred size
                        Dimension preferredSize = new Dimension();
                        for (int i = 0; i < panel3.getComponentCount(); i++) {
                            Rectangle bounds = panel3.getComponent(i).getBounds();
                            preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                            preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                        }
                        Insets insets = panel3.getInsets();
                        preferredSize.width += insets.right;
                        preferredSize.height += insets.bottom;
                        panel3.setMinimumSize(preferredSize);
                        panel3.setPreferredSize(preferredSize);
                    }
                }
                panel1.add(panel3);

                //======== panel4 ========
                {
                    panel4.setAlignmentX(1.0F);
                    panel4.setLayout(null);

                    //---- label4 ----
                    label4.setText("Group by");
                    panel4.add(label4);
                    label4.setBounds(new Rectangle(new Point(5, 10), label4.getPreferredSize()));

                    //---- groupByControl ----
                    groupByControl.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            survivalColumnControlActionPerformed(e);
                        }
                    });
                    panel4.add(groupByControl);
                    groupByControl.setBounds(120, 5, 235, groupByControl.getPreferredSize().height);

                    { // compute preferred size
                        Dimension preferredSize = new Dimension();
                        for (int i = 0; i < panel4.getComponentCount(); i++) {
                            Rectangle bounds = panel4.getComponent(i).getBounds();
                            preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                            preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
                        }
                        Insets insets = panel4.getInsets();
                        preferredSize.width += insets.right;
                        preferredSize.height += insets.bottom;
                        panel4.setMinimumSize(preferredSize);
                        panel4.setPreferredSize(preferredSize);
                    }
                }
                panel1.add(panel4);
            }
            contentPanel.add(panel1, BorderLayout.NORTH);
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    setSize(565, 510);
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}