Example usage for javax.swing BoxLayout LINE_AXIS

List of usage examples for javax.swing BoxLayout LINE_AXIS

Introduction

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

Prototype

int LINE_AXIS

To view the source code for javax.swing BoxLayout LINE_AXIS.

Click Source Link

Document

Specifies that components should be laid out in the direction of a line of text as determined by the target container's ComponentOrientation property.

Usage

From source file:uk.nhs.cfh.dsp.yasb.expression.builder.SimpleCloseToUserExpressionPanel.java

/**
 * Inits the components.//  ww w . j  av a2  s. c o m
 */
public synchronized void initComponents() {

    renderingLabel = new ExpressionRenderingLabel(humanReadableRender);
    renderingLabel.initComponents();

    // create expressionBuilderDialog
    createExpressionBuilderDialog();

    JideButton editButton = new JideButton(new AbstractAction("Edit") {
        public void actionPerformed(ActionEvent e) {
            // display expression builder dialog
            expressionBuilderDialog.setVisible(true);
        }
    });

    // create  panel that displays editing options and button
    JPanel p1 = new JPanel();
    p1.setLayout(new BoxLayout(p1, BoxLayout.LINE_AXIS));
    p1.add((new JLabel("Edit this expression")));
    p1.add(Box.createHorizontalGlue());
    p1.add(editButton);

    // set title and add panels
    setBorder(BorderFactory.createTitledBorder("Contained Expression"));
    setLayout(new BorderLayout());
    add(renderingLabel, BorderLayout.CENTER);
    add(p1, BorderLayout.SOUTH);
}

From source file:uk.nhs.cfh.dsp.yasb.searchpanel.SearchPanel.java

/**
 * Creates the control panel.//from  ww w .  ja v a2s.  co  m
 */
private synchronized void createControlPanel() {
    // set controls for rendering concept ids and labels in a collapsible pane
    controlsPane = new JXCollapsiblePane(new GridLayout(0, 1));
    controlsPane.setName("controlsPane");

    final JComboBox conceptTypeBox = new JComboBox(ConceptType.values());
    // set default value to UNKNOWN, which will return all types
    conceptTypeBox.setSelectedItem(ConceptType.UNKNOWN);

    conceptTypeBox.setAction(new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            // get selected value
            Object selection = conceptTypeBox.getSelectedItem();
            if (selection instanceof ConceptType) {
                selectedConceptType = (ConceptType) conceptTypeBox.getSelectedItem();
                doSearch();
            }

        }
    });
    JPanel panel1 = new JPanel();
    panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));
    panel1.add(new JLabel("Concept Type"));
    panel1.add(Box.createHorizontalStrut(10));
    panel1.add(conceptTypeBox);

    final JComboBox statusBox = new JComboBox(ComponentStatus.values());
    statusBox.setSelectedItem(ComponentStatus.CURRENT);
    statusBox.setAction(new AbstractAction() {

        public void actionPerformed(ActionEvent arg0) {

            Object selection = statusBox.getSelectedItem();
            if (selection instanceof ComponentStatus) {
                selectedConceptStatus = (ComponentStatus) statusBox.getSelectedItem();
                doSearch();
            }
        }
    });
    JPanel panel2 = new JPanel();
    panel2.setLayout(new BoxLayout(panel2, BoxLayout.LINE_AXIS));
    panel2.add(new JLabel("Concept Status"));
    panel2.add(Box.createHorizontalStrut(10));
    panel2.add(statusBox);

    // create stemming enabling checkbox
    final JCheckBox enableStemmingCheckBox = new JCheckBox();
    enableStemmingCheckBox.setAction(new AbstractAction("Enable Stemming") {
        public void actionPerformed(ActionEvent arg0) {
            if (enableStemmingCheckBox.isSelected()) {
                // change analyser
                selectedAnalyzer = new SnowballAnalyzer("English");
                logger.debug("Enabled Stemming");
                doSearch();
            } else {
                selectedAnalyzer = new StandardAnalyzer();
                logger.debug("Disabled Stemming");
                doSearch();
            }
        }

    });

    renderConceptIdsBox = new JCheckBox(new AbstractAction("Render Concept IDs") {

        public void actionPerformed(ActionEvent e) {
            // toggle status in tree cell renderer
            renderer.setRenderConceptId(renderConceptIdsBox.isSelected());
            // refresh tree
            SwingUtilities.updateComponentTreeUI(resultsList);
        }
    });
    renderConceptIdsBox.setName("preferFSNOverPTJCheckBox");

    preferFSNOverPTJCheckBox = new JCheckBox(new AbstractAction("Prefer FSN over PT") {
        public void actionPerformed(ActionEvent e) {
            // toggle preference in renderer
            renderer.setPreferFSNOverPT(preferFSNOverPTJCheckBox.isSelected());
            // refresh tree
            SwingUtilities.updateComponentTreeUI(resultsList);
        }
    });
    preferFSNOverPTJCheckBox.setName("preferFSNOverPTJCheckBox");

    // add panels to controlsPane
    controlsPane.add(panel1);
    controlsPane.add(panel2);
    controlsPane.add(enableStemmingCheckBox);
    controlsPane.add(renderConceptIdsBox);
    controlsPane.add(preferFSNOverPTJCheckBox);
    controlsPane.setCollapsed(true);
}

From source file:uk.nhs.cfh.dsp.yasb.searchpanel.SearchPanel.java

/**
 * Creates the button panel.//from   w ww  .ja  v a2  s .  c  om
 */
private void createButtonPanel() {

    buttonsPanel = new JPanel();
    buttonsPanel.setLayout(new BoxLayout(buttonsPanel, BoxLayout.PAGE_AXIS));

    JPanel fieldsPanel = new JPanel();
    fieldsPanel.add(new JLabel("Search using "));
    fieldsPanel.add(Box.createHorizontalStrut(5));
    fieldsPanel.setLayout(new BoxLayout(fieldsPanel, BoxLayout.LINE_AXIS));
    // create button group for term selection
    JRadioButton allRadioButton = new JRadioButton(new AbstractAction("Term") {

        public void actionPerformed(ActionEvent event) {
            // set search on term
            searchConceptId = false;
            doSearch();
        }
    });

    JRadioButton idRadioButton = new JRadioButton(new AbstractAction("ID") {

        public void actionPerformed(ActionEvent event) {
            // set search on id
            searchConceptId = true;
            doSearch();
        }
    });

    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(allRadioButton);
    buttonGroup.add(idRadioButton);
    buttonGroup.setSelected(allRadioButton.getModel(), true);

    // add search field terms to fields panel
    fieldsPanel.add(allRadioButton);
    fieldsPanel.add(idRadioButton);
    fieldsPanel.add(Box.createHorizontalGlue());

    // create panel that contains button that toggles display of controlsPane
    JideButton controlsButton = new JideButton(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {
            if (controlsPane.isCollapsed()) {
                controlsPane.setCollapsed(false);
            } else {
                controlsPane.setCollapsed(true);
            }
        }
    });
    controlsButton.setIcon(new ImageIcon(SearchPanel.class.getResource("resources/configure.png")));
    controlsButton.setToolTipText("Click to display or hide configuration panel");
    JPanel panel4 = new JPanel();
    panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS));
    panel4.add(Box.createHorizontalGlue());
    panel4.add(new JLabel("Change search and display preferences "));
    panel4.add(controlsButton);

    // add panels to button panel
    buttonsPanel.add(fieldsPanel);
    buttonsPanel.add(panel4);
}

From source file:verdandi.ui.settings.DefaultSettingsPanel.java

private JPanel getTimeFormatSettingsPanel() {
    JPanel res = new JPanel();
    res.setLayout(new BoxLayout(res, BoxLayout.LINE_AXIS));

    radioFormatHHMM = new JRadioButton("01:45");
    radioFormatHHQuarters = new JRadioButton("1,75");

    ButtonGroup grp = new ButtonGroup();
    grp.add(radioFormatHHMM);/*from  w w w  .j  ava 2s .c o  m*/
    grp.add(radioFormatHHQuarters);

    res.add(radioFormatHHMM);
    res.add(Box.createHorizontalStrut(5));
    res.add(radioFormatHHQuarters);

    res.setBorder(BorderFactory.createTitledBorder(RC.getString("settingseditor.timeformat.title")));
    return res;
}

From source file:verdandi.ui.settings.DefaultSettingsPanel.java

private JPanel getAnnotatedWorkRecordViewPrefs() {
    JPanel res = new JPanel();
    res.setBorder(BorderFactory.createTitledBorder(RC.getString("settingseditor.annotatedworkview.title")));

    res.setLayout(new BoxLayout(res, BoxLayout.LINE_AXIS));
    initAnnotatedWorkRecordsOnStartup = new JCheckBox(
            RC.getString("settingseditor.annotatedworkview.doinitonstartup"));

    boolean selected = conf.getString(AnnotatedWorkRecordView.PREF_RESTORE_ON_INIT, "false")
            .equalsIgnoreCase("true");
    initAnnotatedWorkRecordsOnStartup.setSelected(selected);

    res.add(Box.createHorizontalStrut(5));
    res.add(initAnnotatedWorkRecordsOnStartup);
    res.add(Box.createHorizontalGlue());
    return res;/*from ww w  . j  av  a 2s .c  o  m*/
}