Example usage for javax.swing BoxLayout Y_AXIS

List of usage examples for javax.swing BoxLayout Y_AXIS

Introduction

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

Prototype

int Y_AXIS

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

Click Source Link

Document

Specifies that components should be laid out top to bottom.

Usage

From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptingDialog.java

/**
 * Builds the panel hosting the components.
 *
 * @return See above.// w ww.ja va 2  s. c o  m
 */
private JPanel buildControlPanel() {
    JPanel controlPanel = new JPanel();
    controlPanel.setBorder(null);
    controlPanel.add(cancelButton);
    controlPanel.add(Box.createRigidArea(H_SPACER_SIZE));
    controlPanel.add(applyButton);
    controlPanel.add(Box.createRigidArea(H_SPACER_SIZE));
    JPanel bar = new JPanel();
    bar.setLayout(new BoxLayout(bar, BoxLayout.Y_AXIS));
    bar.add(controlPanel);
    bar.add(Box.createVerticalStrut(10));

    JPanel all = new JPanel();
    all.setLayout(new BoxLayout(all, BoxLayout.X_AXIS));
    all.add(UIUtilities.buildComponentPanel(menuButton));
    all.add(UIUtilities.buildComponentPanelRight(bar));
    return all;
}

From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptingDialog.java

/**
 * Returns the component displaying the description of the script.
 *
 * @return See above.//www .j  a va  2 s. c  o m
 */
private JComponent buildDescriptionPane() {
    String description = script.getDescription();
    if (StringUtils.isBlank(description))
        return null;
    OMEWikiComponent area = new OMEWikiComponent(false);
    area.setEnabled(false);
    area.setText(description);
    JPanel content = new JPanel();
    content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
    JLabel label = UIUtilities.setTextFont(script.getName());
    Font f = label.getFont();
    label.setFont(f.deriveFont(f.getStyle(), f.getSize() + 2));
    content.add(UIUtilities.buildComponentPanel(label));
    content.add(Box.createVerticalStrut(5));
    JPanel p = UIUtilities.buildComponentPanel(area);
    p.setBackground(BG_COLOR);
    area.setBackground(BG_COLOR);
    content.add(p);
    return content;
}

From source file:org.openmicroscopy.shoola.env.ui.ActivityComponent.java

/** 
 * Invokes when the activity end. //  ww  w  . j a v  a  2  s . c  o  m
 * 
 * @param result The result of the activity.
 */
public void endActivity(Object result) {
    this.result = result;
    boolean busy = status.isBusy();
    reset();
    if (result instanceof Map) {
        Map<String, Object> m = convertResult((Map<String, Object>) result);
        int size = m.size();
        this.result = m;
        remove(resultPane);
        Color c = getBackground();
        if (size == 0) {
            JToolBar row = new JToolBar();
            row.setOpaque(false);
            row.setFloatable(false);
            row.setBorder(null);
            row.setBackground(c);
            JButton button;
            if (errorObject != null) {
                button = createButton(ActivityResultRow.ERROR_TEXT, ERROR, this);
                button.addMouseListener(new MouseAdapter() {

                    public void mouseReleased(MouseEvent e) {
                        showMenu((JComponent) e.getSource(), ERROR, e.getX(), e.getY());
                    }
                });
                row.add(button);
            }
            if (infoObject != null) {
                button = createButton(ActivityResultRow.INFO_TEXT, INFO, this);
                button.addMouseListener(new MouseAdapter() {

                    public void mouseReleased(MouseEvent e) {
                        showMenu((JComponent) e.getSource(), INFO, e.getX(), e.getY());
                    }
                });
                row.add(button);
            }
            add(row, paneIndex);
        } else {
            Entry<String, Object> entry;
            Iterator<Entry<String, Object>> i = m.entrySet().iterator();
            ActivityResultRow row = null;
            JPanel content = new JPanel();
            content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));

            content.setBackground(c);
            int index = 0;
            int max = 2;
            JButton moreButton = null;
            while (i.hasNext()) {
                entry = (Entry<String, Object>) i.next();
                this.result = entry.getValue();
                row = new ActivityResultRow((String) entry.getKey(), entry.getValue(), this);
                row.setBackground(c);
                row.addPropertyChangeListener(listener);
                resultButtons.add(row);
                if (index < max)
                    content.add(row);
                else {
                    if (moreButton == null) {
                        moreButton = createButton("" + (m.size() - max) + " more", ALL_RESULT, this);
                        content.add(moreButton);
                    }
                }
                index++;
            }

            if (m.size() == 1)
                add(row, paneIndex);
            else
                add(content, paneIndex);
            resultPane = content;
        }

        repaint();
    }

    firePropertyChange(UNREGISTER_ACTIVITY_PROPERTY, null, this);
    notifyActivityEnd();
    //Post an event to 
    //if (busy) {
    EventBus bus = registry.getEventBus();
    bus.post(new ActivityProcessEvent(this, busy));
    //}
}

From source file:org.openmicroscopy.shoola.env.ui.ActivityComponent.java

/**
 * Removes the activity from the display
 * @see ActionListener#actionPerformed(ActionEvent)
 */// www . ja  va  2 s  .c  om
public void actionPerformed(ActionEvent e) {
    int index = Integer.parseInt(e.getActionCommand());
    switch (index) {
    case REMOVE:
        firePropertyChange(REMOVE_ACTIVITY_PROPERTY, null, this);
        break;
    case CANCEL:
        onActivityCancelled();
        if (cancelButton != null)
            cancelButton.setEnabled(false);
        if (loader != null)
            loader.cancel();
        break;
    case EXCEPTION:
        showException();
        break;
    case ALL_RESULT:
        Iterator<ActivityResultRow> i = resultButtons.iterator();
        JPanel content = new JPanel();
        content.setBackground(getBackground());
        content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS));
        while (i.hasNext()) {
            content.add(i.next());
        }
        remove(resultPane);
        add(content, paneIndex);
        resultPane = content;
        validate();
        repaint();
        break;
    }
}

From source file:org.openmicroscopy.shoola.util.ui.MessengerDialog.java

/**
 * Builds and lays out the buttons./*  w  w w  . ja v  a  2s .co m*/
 * 
 * @param submit Pass <code>true</code> to display the submit files option,
 *              <code>false</code> otherwise.
 * @return See above.
 */
private JPanel buildToolBar(boolean submit) {
    JPanel bars = new JPanel();
    bars.setLayout(new BoxLayout(bars, BoxLayout.X_AXIS));
    if (submit) {
        JPanel row = new JPanel();
        row.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
        row.add(new JLabel("Submit Exceptions and: "));
        row.add(UIUtilities.buildComponentPanel(submitFile));
        JPanel p = new JPanel();
        p.setBorder(null);
        p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
        p.add(row);
        JPanel progressPane = new JPanel();
        progressPane.setLayout(new BoxLayout(progressPane, BoxLayout.X_AXIS));
        progressPane.add(progress);
        progressPane.add(Box.createHorizontalStrut(5));
        progressPane.add(progressLabel);
        p.add(UIUtilities.buildComponentPanel(progressPane));
        bars.add(UIUtilities.buildComponentPanel(p));
    }
    JPanel bar = new JPanel();
    bar.setLayout(new BoxLayout(bar, BoxLayout.X_AXIS));
    bar.add(cancelButton);
    bar.add(Box.createHorizontalStrut(5));
    bar.add(sendButton);
    bar.add(Box.createHorizontalStrut(10));
    bars.add(UIUtilities.buildComponentPanelRight(bar));
    return bars;
}

From source file:org.openmicroscopy.shoola.util.ui.omeeditpane.OMEWikiComponent.java

/** Builds and lays out the UI. */
private void buildGUI() {
    //setLayout(new BoxLayout(this, BoxLayout.Y_AXIS));
    if (toolBar != null) {
        JPanel p = new JPanel();
        p.setBackground(UIUtilities.BACKGROUND_COLOR);
        p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
        p.add(Box.createVerticalStrut(5));
        JPanel bar = UIUtilities.buildComponentPanel(toolBar, 0, 0);
        bar.setBackground(UIUtilities.BACKGROUND_COLOR);
        p.add(bar);/*from  ww  w. j a  v  a  2s. c  om*/
        p.add(Box.createVerticalStrut(2));
        add(p, BorderLayout.NORTH);
    }
    setLayout(new BorderLayout());
    add(pane, BorderLayout.CENTER);
}

From source file:org.openmicroscopy.shoola.util.ui.search.SearchComponent.java

/** 
 * Builds and lays out the UI. /*from  www .  j a v a2 s .c  o  m*/
 * 
 * @param showControl   Pass <code>true</code> to display the buttons,
 *                   <code>false</code> otherwise.
 */
private void buildGUI(boolean showControl) {
    setBackground(UIUtilities.BACKGROUND_COLOR);
    double[][] size = { { TableLayout.PREFERRED }, { TableLayout.PREFERRED, TableLayout.PREFERRED,
            TableLayout.PREFERRED, TableLayout.PREFERRED, TableLayout.PREFERRED } };
    setLayout(new TableLayout(size));
    int i = 0;
    String key = "0, ";
    add(uiDelegate, key + i);
    i++;
    if (showControl) {
        add(buildToolBar(), key + i);
    }
    i++;
    add(buildStatusBar(), key + i);
    resultPane = new JPanel();
    resultPane.setBackground(UIUtilities.BACKGROUND_COLOR);
    resultPane.setLayout(new BoxLayout(resultPane, BoxLayout.Y_AXIS));
    JPanel sep = new SeparatorPane();
    sep.setBackground(UIUtilities.BACKGROUND_COLOR);
    i++;
    add(sep, key + i);
    i++;
    add(resultPane, key + i);
}

From source file:org.openpnp.gui.AboutDialog.java

public AboutDialog(Frame frame) {
    super(frame, true);
    setTitle("About OpenPnP");
    setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
    setBounds(100, 100, 347, 360);//from   w w w .  jav a2s  .  c  om
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    contentPanel.setLayout(new BoxLayout(contentPanel, BoxLayout.Y_AXIS));
    JLabel lblOpenpnp = new JLabel("OpenPnP");
    lblOpenpnp.setAlignmentX(Component.CENTER_ALIGNMENT);
    lblOpenpnp.setFont(new Font("Lucida Grande", Font.BOLD, 32));
    contentPanel.add(lblOpenpnp);
    JLabel lblCopyright = new JLabel("Copyright  2011 - 2016 Jason von Nieda");
    lblCopyright.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
    lblCopyright.setAlignmentX(Component.CENTER_ALIGNMENT);
    contentPanel.add(lblCopyright);
    JLabel lblVersion = new JLabel("Version: " + Main.getVersion());
    lblVersion.setFont(new Font("Lucida Grande", Font.PLAIN, 10));
    lblVersion.setAlignmentX(Component.CENTER_ALIGNMENT);
    contentPanel.add(lblVersion);

    textPane = new JTextPane();
    textPane.setEditable(false);
    contentPanel.add(new JScrollPane(textPane));
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
    getContentPane().add(buttonPane, BorderLayout.SOUTH);
    JButton okButton = new JButton("OK");
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            setVisible(false);
        }
    });
    okButton.setActionCommand("OK");
    buttonPane.add(okButton);
    getRootPane().setDefaultButton(okButton);

    try {
        String s = FileUtils.readFileToString(new File("CHANGES.md"));
        textPane.setText(s);
        textPane.setCaretPosition(0);
    } catch (Exception e) {

    }
}

From source file:org.openuat.apps.OpenUATtoolkit.java

private void initUI() {

    frame = new JFrame("OpenUAT Toolkit");
    frame.setSize(1000, 1000);/*from   w  w w . java2  s .co  m*/
    frame.setLocation(100, 100);
    JPanel pane = new JPanel();
    pane.setLayout(new BoxLayout(pane, BoxLayout.Y_AXIS));

    java.net.URL printerImage = getClass().getResource("/printer_bg.png");

    ImageIcon printerIcon = new ImageIcon(printerImage);
    pane.add(new JLabel("Print service started", printerIcon, SwingConstants.CENTER));
    //      pane.add(new JLabel("Available input/output methods: button, small display, audio", null, SwingConstants.CENTER));

    pane.add(status);
    pane.add(progress);
    pane.setBorder(BorderFactory.createRaisedBevelBorder());
    frame.setContentPane(pane);
    frame.setVisible(true);
}

From source file:org.optaplanner.mes.common.swingui.SolverAndPersistenceFrame.java

private JComponent createScoreFieldPanel() {
    scoreFieldPanel = new JPanel();
    scoreTextArea = new JTextArea();
    scoreFieldPanel.add(scoreTextArea);/*  w  w w .  java2s.  c o m*/
    scoreFieldPanel.setLayout(new BoxLayout(scoreFieldPanel, BoxLayout.Y_AXIS));

    JScrollPane scrollPane = new JScrollPane(scoreFieldPanel);
    scrollPane.getVerticalScrollBar().setUnitIncrement(25);
    scrollPane.setMinimumSize(new Dimension(100, 80));
    // Size fits into screen resolution 1024*768
    scrollPane.setPreferredSize(new Dimension(180, 200));

    scoreFieldTitlePanel = new JPanel(new BorderLayout());
    scoreFieldTitlePanel.add(scrollPane, BorderLayout.CENTER);
    scoreFieldTitlePanel.setBorder(BorderFactory.createCompoundBorder(
            BorderFactory.createEmptyBorder(2, 2, 2, 2), BorderFactory.createTitledBorder("Score")));

    return scoreFieldTitlePanel;
}