Example usage for javax.swing Box createVerticalBox

List of usage examples for javax.swing Box createVerticalBox

Introduction

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

Prototype

public static Box createVerticalBox() 

Source Link

Document

Creates a Box that displays its components from top to bottom.

Usage

From source file:com.isencia.passerelle.hmi.specific.HMITest.java

/**
 * @param frame/*from  ww w . j a  v  a2  s .  c  om*/
 */
@Override
protected void showModelForm(final String modelKey) {
    clearModelForms();
    if ("HelloWorld".equals(modelKey)) {
        frame.getContentPane().setLayout(new BorderLayout());
        final Box formBox = Box.createVerticalBox();
        final FormField valueField = new FormField();
        valueField.setEditable(true);
        formBox.add(new FormEntry(new JLabel(VALUE_FIELD), (FormField) registerBinding(VALUE_FIELD, valueField,
                (ParameterToWidgetBinder) new ParameterToTextFieldBinder())));
        frame.getContentPane().add(formBox, BorderLayout.NORTH);
    } else if ("LaunchNotepad".equals(modelKey)) {
        frame.getContentPane().setLayout(new BorderLayout());
        final Box formBox = Box.createVerticalBox();
        final FormField cmdField = new FormField();
        cmdField.setEditable(true);
        formBox.add(new FormEntry(new JLabel(COMMAND_FIELD), (FormField) registerBinding(COMMAND_FIELD,
                cmdField, (ParameterToWidgetBinder) new ParameterToTextFieldBinder())));
        frame.getContentPane().add(formBox, BorderLayout.NORTH);
    } else if ("test1_samba".equals(modelKey)) {
        frame.getContentPane().add(getEditSequencePanelRM4());
    } else if ("test-loop".equals(modelKey)) {
        frame.getContentPane().setLayout(new BorderLayout());
        final Box formBox = Box.createVerticalBox();
        final FormField valueField = new FormField();
        valueField.setEditable(true);
        formBox.add(new FormEntry(new JLabel(VALUE_FIELD), (FormField) registerBinding(VALUE_FIELD, valueField,
                (ParameterToWidgetBinder) new ParameterToTextFieldBinder())));

        final FormField delayField = new FormField();
        delayField.setEditable(true);
        formBox.add(new FormEntry(new JLabel(DELAYTIME_FIELD), (FormField) registerBinding(DELAYTIME_FIELD,
                delayField, (ParameterToWidgetBinder) new ParameterToTextFieldBinder())));

        final FormField loopCountField = new FormField();
        loopCountField.setEditable(true);
        formBox.add(new FormEntry(new JLabel(LOOPCOUNT_FIELD), (FormField) registerBinding(LOOPCOUNT_FIELD,
                loopCountField, (ParameterToWidgetBinder) new ParameterToTextFieldBinder())));

        frame.getContentPane().add(formBox, BorderLayout.NORTH);
    }
    frame.show();
}

From source file:ImageIOTest.java

/**
 * Open a file and load the images./*from   ww w.  j  a  v a  2  s  .c om*/
 */
public void openFile() {
    JFileChooser chooser = new JFileChooser();
    chooser.setCurrentDirectory(new File("."));
    String[] extensions = ImageIO.getReaderFileSuffixes();
    chooser.setFileFilter(new FileNameExtensionFilter("Image files", extensions));
    int r = chooser.showOpenDialog(this);
    if (r != JFileChooser.APPROVE_OPTION)
        return;
    File f = chooser.getSelectedFile();
    Box box = Box.createVerticalBox();
    try {
        String name = f.getName();
        String suffix = name.substring(name.lastIndexOf('.') + 1);
        Iterator<ImageReader> iter = ImageIO.getImageReadersBySuffix(suffix);
        ImageReader reader = iter.next();
        ImageInputStream imageIn = ImageIO.createImageInputStream(f);
        reader.setInput(imageIn);
        int count = reader.getNumImages(true);
        images = new BufferedImage[count];
        for (int i = 0; i < count; i++) {
            images[i] = reader.read(i);
            box.add(new JLabel(new ImageIcon(images[i])));
        }
    } catch (IOException e) {
        JOptionPane.showMessageDialog(this, e);
    }
    setContentPane(new JScrollPane(box));
    validate();
}

From source file:org.jdal.swing.table.TablePanel.java

/**
 * Creates a new Component with PageableTable.
 * @return PageableTableComponent./*from w  w  w.  ja va  2 s  . com*/
 */
private Component createTableBox() {
    Box tableBox = Box.createVerticalBox();
    tableBox.add(createControlBox());
    tableBox.add(Box.createVerticalStrut(5));
    table.setAlignmentX(Container.LEFT_ALIGNMENT);
    tableBox.add(table);

    return tableBox;
}

From source file:org.jdal.swing.TableEditor.java

/**
 * Creates a new Box with table and actions buttons
 * @return a new Box/* w  w  w .jav  a2 s .c  om*/
 */
protected Container createTablePanel() {
    table = new JTable(tableModel, tableModel.getTableColumnModel());
    table.setRowHeight(22);
    table.setAutoCreateRowSorter(true);
    tableModel.addTableModelListener(this);
    JScrollPane scroll = new JScrollPane(table);
    scroll.setAlignmentX(Container.LEFT_ALIGNMENT);
    Box box = Box.createVerticalBox();
    JButton addButton = new JButton(new AddAction());
    JButton deleteButton = new JButton(new DeleteAction());
    JButton saveButton = new JButton(new SaveAction());
    JButton refreshButton = new JButton(new RefreshAction());
    Box buttonBox = Box.createHorizontalBox();
    buttonBox.add(addButton);
    buttonBox.add(Box.createHorizontalStrut(5));
    buttonBox.add(deleteButton);
    buttonBox.add(Box.createHorizontalStrut(5));
    buttonBox.add(saveButton);
    buttonBox.add(Box.createHorizontalStrut(5));
    buttonBox.add(refreshButton);
    buttonBox.setAlignmentX(Container.LEFT_ALIGNMENT);
    buttonBox.setMaximumSize(new Dimension(Short.MAX_VALUE, 25));
    box.add(buttonBox);
    box.add(Box.createVerticalStrut(5));
    box.add(scroll);
    return box;
}

From source file:org.jdal.swing.table.TablePanel.java

/**
 * Creates a new Component with FilterView.
 * @return new Component./*from  w w  w  .  j  a va  2  s . co  m*/
 */
private Component createFilterBox() {
    Box header = Box.createVerticalBox();

    if (filterView != null) {
        header.add(Box.createVerticalStrut(10));
        filterView.refresh();
        header.add(filterView.getPanel());
    }

    header.setAlignmentX(Container.LEFT_ALIGNMENT);

    return header;
}

From source file:org.jdal.swing.form.SimpleBoxFormBuilder.java

/**
 * Gets current column pointed to cursor, create one if none.
 * @return a new or existent column Box.
 *///  w ww . j  av  a2s . co  m
private Box getColumn() {
    Box column = null;
    if (index < columns.size()) {
        column = (Box) columns.get(index);
    } else {
        if (!columns.isEmpty())
            container.add(Box.createHorizontalStrut(defaultSpace));

        column = Box.createVerticalBox();
        columns.add(column);
        container.add(column);
        columnsWidth.add(0);

        if (debug) {
            column.setBorder(BorderFactory.createLineBorder(Color.RED));
        }
    }
    return column;
}

From source file:com.moteiv.trawler.Trawler.java

protected Box getControls() {
    java.util.Dictionary labels;/*from   w  w  w. j  a va2s. co  m*/
    if (controls == null) {
        controls = Box.createVerticalBox();
        JPanel runtimeControls = new JPanel(new GridLayout(0, 1));
        runtimeControls.setBorder(BorderFactory.createTitledBorder("Runtime Controls"));

        vLog = new JCheckBox("Log packets", false);
        vLog.addActionListener(this);
        runtimeControls.add(vLog);
        runtimeControls.add(new JLabel("Edge persistence (sec)", JLabel.LEFT));
        eDispose = new JSlider(0, 300, 10);
        eDispose.setMajorTickSpacing(100);
        eDispose.setMinorTickSpacing(10);
        eDispose.setPaintTicks(true);
        eDispose.setPaintTrack(true);
        //       labels = eDispose.getLabelTable();

        eDispose.setPaintLabels(true);
        eDispose.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                LinkData.setEdgeDelay((1 + eDispose.getValue()) * 1000);
                savePrefs();
            }
        });
        runtimeControls.add(eDispose);
        runtimeControls.add(new JLabel("Vertex persistence (sec)", JLabel.LEFT));
        vDispose = new JSlider(0, 300, 30);
        vDispose.setMajorTickSpacing(100);
        vDispose.setMinorTickSpacing(10);
        vDispose.setPaintTicks(true);
        vDispose.setPaintTrack(true);
        vDispose.setPaintLabels(true);
        vDispose.addChangeListener(new ChangeListener() {
            public void stateChanged(ChangeEvent e) {
                NodeData.setNodeDelay((1 + vDispose.getValue()) * 1000);
                savePrefs();
            }
        });
        runtimeControls.add(vDispose);
        graphReset = new JButton("Reset Nodes");
        graphReset.addActionListener(this);
        runtimeControls.add(graphReset);
        controls.add(runtimeControls);

        JPanel vertexControl = new JPanel(new GridLayout(0, 1));
        vertexControl.setBorder(BorderFactory.createTitledBorder("Node display"));
        vLabels = new JCheckBox("Display vertex details", true);
        vLabels.addActionListener(this);

        vertexControl.add(vLabels);
        vBlink = new JCheckBox("Blink on incoming packets");
        vBlink.addActionListener(this);
        vertexControl.add(vBlink);
        vSave = new JCheckBox("Save node locations", true);
        vSave.addActionListener(this);
        vertexControl.add(vSave);
        controls.add(vertexControl);
        JPanel edgeControl = new JPanel(new GridLayout(0, 1));
        edgeControl.setBorder(BorderFactory.createTitledBorder("Link diplay"));
        eLabels = new JCheckBox("Display link quality", true);
        eLabels.addActionListener(this);
        edgeControl.add(eLabels);
        eFilter = new JCheckBox("Show alternate parents", true);
        eFilter.addActionListener(this);
        edgeControl.add(eFilter);
        controls.add(edgeControl);
    }
    return controls;
}

From source file:com.diversityarrays.kdxplore.field.PlotIdTrialLayoutPane.java

public PlotIdTrialLayoutPane() {
    super(new BorderLayout());

    /*//from  ww w  .j  a  v  a2  s.  c  om
     *  *  .--->           <---.
     *  |    (o)      (o)   |
     *  v                   v
     *   (o)             (o)
     *   
     *                            
     *   (o)             (o)
     *  ^                   ^ 
     *  |    (o)      (o)   |
     *  `--->           <---'
     *  
     *  Traversal: (o) 1-w  (o) 2-w
     *  
     *  (above is in odtPanel)
     *  ---------------------------
     *  
     *  Run Length:     [         ]
     *  Origin Plot Id: [         ]
     */

    JPanel top = new JPanel();

    GBH gbh = new GBH(top);
    int y = 0;

    gbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, "Plot Ids:");
    gbh.add(1, y, 3, 1, GBH.HORZ, 1, 1, GBH.WEST, plotIdentInfo);
    ++y;

    // - - - - - - -

    JPanel bottom = new JPanel();
    GBH rgbh = new GBH(bottom);
    y = 0;

    rgbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, "Run Length:");
    rgbh.add(1, y, 1, 1, GBH.HORZ, 1, 1, GBH.CENTER, runLengthSpinner);
    ++y;
    rgbh.add(0, y, 1, 1, GBH.NONE, 1, 1, GBH.EAST, "Origin Plot Id:");
    rgbh.add(1, y, 1, 1, GBH.HORZ, 1, 1, GBH.CENTER, plotSpinner);
    ++y;

    // - - - - - - -
    Box main = Box.createVerticalBox();
    main.add(top);
    main.add(withInsets(new JSeparator(JSeparator.HORIZONTAL), new Insets(0, 20, 0, 20)));
    main.add(odtPanel);
    main.add(withInsets(new JSeparator(JSeparator.HORIZONTAL), new Insets(0, 20, 0, 20)));

    main.add(bottom);

    add(main, BorderLayout.CENTER);

    //         crb_ll_right.doClick();

    ChangeListener changeListener = new ChangeListener() {
        @Override
        public void stateChanged(ChangeEvent e) {
            if (initialised) {
                firePropertyChange(PROP_LAYOUT_CHANGED, false, true);
            }
        }
    };
    runLengthModel.addChangeListener(changeListener);
    plotIdModel.addChangeListener(changeListener);

    initialised = true;
}

From source file:com.orange.atk.graphAnalyser.RealtimeGraph.java

private void initComponents() {

    jListGraph = new JList(listModelGraph);
    jPanelroot = new JPanel();
    jScrollPaneListGraph = new JScrollPane();
    jListPerfGraph = new JList(listModelGraph);
    jComboBoxLeft = new JComboBox(comboModelLeft);
    jComboBoxRight = new JComboBox(comboModelRight);
    setDefaultCloseOperation(DISPOSE_ON_CLOSE);

    jScrollPaneListGraph.setViewportView(jListPerfGraph);

    jComboBoxLeft.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBoxLeftActionPerformed(evt);
        }//from w w  w.  j a  v  a  2  s .  c o  m
    });

    jComboBoxRight.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jComboBoxRightActionPerformed(evt);
        }
    });

    jPanelroot.setLayout(new BorderLayout());
    jPanelroot.add(chartPanel, BorderLayout.CENTER);

    toolPane = new JPanel();
    toolPane.setLayout(new FlowLayout());

    toolPane.add(jComboBoxLeft);

    Box graphlistbox = Box.createVerticalBox();
    graphlistbox.add(new JLabel("List of Graph"));
    graphlistbox.add(jScrollPaneListGraph);
    toolPane.add(graphlistbox);

    toolPane.add(jComboBoxRight);

    jPanelroot.add(toolPane, BorderLayout.NORTH);

    setContentPane(jPanelroot);

    //a small size for small screen
    //  setMaximumSize(new Dimension(600,500));
    pack();

}

From source file:de.mpg.mpi_inf.bioinf.netanalyzer.ui.IntHistogramVisualizer.java

@Override
protected JComponent addSettingsPanels(JTabbedPane aPanel) {

    addTab(aPanel, Messages.DI_GENERAL, new SettingsPanel(general), Messages.TT_GENSETTINGS);
    addTab(aPanel, Messages.DI_AXES, new SettingsPanel(settings.axes), Messages.TT_AXESSETTINGS);
    addTab(aPanel, Messages.DI_GRID, new SettingsPanel(settings.grid), Messages.TT_GRIDSETTINGS);

    boolean useScatter = settings.useScatter();
    final Box histPanel = Box.createVerticalBox();

    final JComboBox choiceCombo = addChoice(histPanel, useScatter ? 1 : 0);

    final CardLayout innerLayout = new CardLayout();
    final JPanel innerPanel = new JPanel(innerLayout);
    histPanel.add(innerPanel);/*from   w  w  w  .j  a v a  2  s .  c o m*/
    aPanel.addTab(Messages.DI_HISTOGRAM, null, histPanel, Messages.TT_HISTSETTINGS);

    ItemListener listener = new ItemListener() {

        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                innerLayout.next(innerPanel);
            }
        }
    };
    choiceCombo.addItemListener(listener);

    innerPanel.add(new SettingsPanel(settings.bars), "0");
    innerPanel.add(new SettingsPanel(settings.scatter), "1");
    if (useScatter) {
        innerLayout.next(innerPanel);
    }

    return choiceCombo;
}