Example usage for javax.swing BoxLayout PAGE_AXIS

List of usage examples for javax.swing BoxLayout PAGE_AXIS

Introduction

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

Prototype

int PAGE_AXIS

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

Click Source Link

Document

Specifies that components should be laid out in the direction that lines flow across a page as determined by the target container's ComponentOrientation property.

Usage

From source file:us.ihmc.codecs.loader.OpenH264Downloader.java

private static void acceptLicenseGUI() {

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    JTextArea license = new JTextArea(getLicenseText());
    license.setEditable(false);/*from   w  w w  .  jav a 2  s .c om*/
    license.setLineWrap(true);
    license.setWrapStyleWord(true);
    JScrollPane scroll = new JScrollPane(license);
    scroll.setPreferredSize(new Dimension(500, 500));
    panel.add(scroll);
    panel.add(new JLabel("Do you accept the OpenH264 License?"));

    if (JOptionPane.showOptionDialog(null, panel, "OpenH264 Video Codec provided by Cisco Systems, Inc.",
            JOptionPane.YES_NO_OPTION, JOptionPane.PLAIN_MESSAGE, null, null, null) != JOptionPane.YES_OPTION) {
        JOptionPane.showMessageDialog(null, "User did not accept OpenH264 license", "License not accepted",
                JOptionPane.ERROR_MESSAGE);
        System.exit(-1);
    }

}

From source file:org.opendatakit.briefcase.ui.ScrollingStatusListDialog.java

private ScrollingStatusListDialog(Frame frame, String title, IFormDefinition form, String statusHtml) {
    super(frame, title + form.getFormName(), true);
    this.form = form;
    AnnotationProcessor.process(this);
    // Create and initialize the buttons.
    JButton cancelButton = new JButton("Close");
    cancelButton.addActionListener(this);
    getRootPane().setDefaultButton(cancelButton);

    editorArea = new JEditorPane("text/plain", statusHtml);
    editorArea.setEditable(false);/*from w w  w.j a  v  a 2 s.co  m*/
    //Put the editor pane in a scroll pane.
    JScrollPane editorScrollPane = new JScrollPane(editorArea);
    editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    editorScrollPane.setPreferredSize(new Dimension(400, 300));
    editorScrollPane.setMinimumSize(new Dimension(10, 10));

    // Create a container so that we can add a title around
    // the scroll pane. Can't add a title directly to the
    // scroll pane because its background would be white.
    // Lay out the label and scroll pane from top to bottom.
    JPanel listPane = new JPanel();
    listPane.setLayout(new BoxLayout(listPane, BoxLayout.PAGE_AXIS));
    listPane.add(Box.createRigidArea(new Dimension(0, 5)));
    listPane.add(editorScrollPane);
    listPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));

    // Lay out the buttons from left to right.
    JPanel buttonPane = new JPanel();
    buttonPane.setLayout(new BoxLayout(buttonPane, BoxLayout.LINE_AXIS));
    buttonPane.setBorder(BorderFactory.createEmptyBorder(0, 10, 10, 10));
    buttonPane.add(Box.createHorizontalGlue());
    buttonPane.add(cancelButton);

    // Put everything together, using the content pane's BorderLayout.
    Container contentPane = getContentPane();
    contentPane.add(listPane, BorderLayout.CENTER);
    contentPane.add(buttonPane, BorderLayout.PAGE_END);

    // Initialize values.
    pack();
    setLocationRelativeTo(null);
}

From source file:Align_Projections.java

public void run(String arg) {
    if (instance != null) {
        instance.toFront();/*from   w ww  .  j a va2s.com*/
        return;
    }
    instance = this;
    addKeyListener(IJ.getInstance());

    if (sourceStackImp == null) {
        sourceStackImp = WindowManager.getCurrentImage();
        if (sourceStackImp != null) {
            centerPixel = 0.5 * (sourceStackImp.getWidth() - 1);
        } else {
            centerPixel = 50; // completely arbitrary
        }
    }

    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));

    Panel valuesPanel = new Panel();
    valuesPanel.setLayout(new GridLayout(6, 2));

    Label centerPixelLabel = new Label("Center Pixel");
    valuesPanel.add(centerPixelLabel);
    centerPixelText = new TextField(IJ.d2s(centerPixel, 1), 15);
    valuesPanel.add(centerPixelText);

    Label detectorAngleLabel = new Label("Detector Angle");
    valuesPanel.add(detectorAngleLabel);
    detectorAngleText = new TextField(IJ.d2s(0, 4), 15);
    valuesPanel.add(detectorAngleText);

    Label horizontalBorderLabel = new Label("Horizontal Border");
    valuesPanel.add(horizontalBorderLabel);
    horizontalBorderText = new TextField("0", 15);
    valuesPanel.add(horizontalBorderText);

    Label topBorderLabel = new Label("Top Border");
    valuesPanel.add(topBorderLabel);
    topBorderText = new TextField("0", 15);
    valuesPanel.add(topBorderText);

    Label bottomBorderLabel = new Label("Bottom Border");
    valuesPanel.add(bottomBorderLabel);
    bottomBorderText = new TextField("0", 15);
    valuesPanel.add(bottomBorderText);

    Label crossCorrelationLabel = new Label("Cross-Correlation");
    valuesPanel.add(crossCorrelationLabel);
    crossCorrelationText = new Label("-");
    valuesPanel.add(crossCorrelationText);

    this.add(valuesPanel);

    updateButton = addButton("Update");
    optimizeButton = addButton("Optimize");
    applyButton = addButton("Apply to stack and save");
    resetButton = addButton("Reset");

    pack();
    GUI.center(this);
    show();
}

From source file:org.isatools.isacreator.optionselector.OptionGroup.java

public OptionGroup(int alignment, boolean singleSelection, int leftPadding) {
    this.singleSelection = singleSelection;
    this.alignment = alignment;

    availableOptions = new ListOrderedMap<T, OptionItem>();

    setLayout(//ww w  . ja  va  2 s.c  o  m
            new BoxLayout(this, alignment == HORIZONTAL_ALIGNMENT ? BoxLayout.LINE_AXIS : BoxLayout.PAGE_AXIS));
    add(Box.createHorizontalStrut(leftPadding));
    setOpaque(false);
}

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

private JPanel getMiscellaneousSettingsPanel() {
    JPanel res = new JPanel();
    res.setLayout(new BoxLayout(res, BoxLayout.PAGE_AXIS));

    showTimerOnStartupCheckBox = new JCheckBox(RC.getString("settingseditor.show.timer.on.startup"));

    storePasswordCheckBox = new JCheckBox(RC.getString("settingseditor.store.password.title"));

    res.add(showTimerOnStartupCheckBox);
    res.add(storePasswordCheckBox);/*  www .j a  v a  2s . c  o m*/

    return res;
}

From source file:org.zaproxy.zap.extension.viewstate.HttpPanelViewStateView.java

private JPanel getContainerPanel() {
    if (container == null) {
        container = new JPanel();
        container.setLayout(new BoxLayout(container, BoxLayout.PAGE_AXIS));
        JScrollPane cScroll = new JScrollPane();
        cScroll.setName(CAPTION_NAME);//  w  w  w  .j  a v  a 2s.  c om
        cScroll.setViewportView(getHexTableBody());
        // Outer scroll size constraints
        container.setPreferredSize(new Dimension(0, 100));
        // Setup text field for ViewState info
        vsInfoTxt = new JFormattedTextField();
        vsInfoTxt.setEditable(false);
        vsInfoTxt.setBackground(Color.decode("#D6D9DF"));
        vsInfoTxt.setFont(FontUtils.getFont("Courier", Font.BOLD));
        // Add to container
        container.add(cScroll);
        container.add(vsInfoTxt);
    }
    return container;
}

From source file:org.monome.pages.PageTemplate.java

public JPanel getPanel() {
    if (this.panel != null) {
        return this.panel;
    }//from   w w  w.jav  a 2 s  .  co m

    JPanel panel = new JPanel();
    panel.setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
    panel.setPreferredSize(new java.awt.Dimension(464, 156));

    pageNameLBL = new JLabel("Page " + (this.index + 1) + ": Page Name");
    panel.add(pageNameLBL);

    this.panel = panel;
    return panel;
}

From source file:org.isatools.gui.optionselector.OptionGroup.java

/**
 * OptionGroup contains a number of items which you can either select one or many of depending on the single selection parameter
 *
 * @param alignment       - e.g. OptionGroup.HORIZONTAL_ALIGNMENT to align the options in a horizontal arrangement.
 * @param singleSelection - whether or not this group should allow singular selection (true) or multiple option selection (false)
 *//*from   w ww.  j a  v a  2s  .co m*/
public OptionGroup(int alignment, boolean singleSelection) {
    this.singleSelection = singleSelection;
    this.alignment = alignment;

    availableOptions = new ListOrderedMap<T, OptionItem>();

    setLayout(
            new BoxLayout(this, alignment == HORIZONTAL_ALIGNMENT ? BoxLayout.LINE_AXIS : BoxLayout.PAGE_AXIS));
    setOpaque(false);
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.resultexplanationpanel.QueryStatisticsCollectionPanel.java

/**
 * Inits the components./*from w ww.  j  a v  a2 s  .co m*/
 */
public synchronized void initComponents() {

    resultCountLabel = new JXLabel(
            "<html><b>Number of patients satisfying criteria in the query : </b></html>");
    resultCountLabel.setHorizontalTextPosition(SwingConstants.LEFT);
    queryTimeLabel = new JXLabel("<html><b>Time taken to return results for query : </b></html>");
    queryTimeLabel.setHorizontalTextPosition(SwingConstants.LEFT);

    // create panels and add labels
    JPanel countPanel = new JPanel();
    countPanel.setLayout(new BoxLayout(countPanel, BoxLayout.LINE_AXIS));
    countPanel.add(resultCountLabel);
    countPanel.add(Box.createHorizontalGlue());
    JPanel timePanel = new JPanel();
    timePanel.setLayout(new BoxLayout(timePanel, BoxLayout.LINE_AXIS));
    timePanel.add(Box.createHorizontalGlue());
    timePanel.add(queryTimeLabel);
    JPanel labelsPanel = new JPanel();
    labelsPanel.setLayout(new BoxLayout(labelsPanel, BoxLayout.PAGE_AXIS));
    labelsPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    labelsPanel.add(countPanel);
    labelsPanel.add(timePanel);
    // add empty panel for spacing
    labelsPanel.add(new JXLabel(" "));

    JPanel humanReadableLabelPanel = new JPanel(new BorderLayout());
    humanReadableLabelPanel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(),
            BorderFactory.createTitledBorder("Query Text")));
    humanReadableLabel = new JXLabel();
    humanReadableLabel.setLineWrap(true);
    humanReadableLabelPanel.add(humanReadableLabel, BorderLayout.CENTER);

    JPanel upperPanel = new JPanel(new BorderLayout());
    upperPanel.add(humanReadableLabelPanel, BorderLayout.CENTER);
    upperPanel.add(labelsPanel, BorderLayout.SOUTH);

    commentedStepsTextArea = new JTextArea();
    commentedStepsTextArea.setLineWrap(true);
    commentedStepsTextArea.setEditable(false);
    commentedStepsTextArea.setWrapStyleWord(true);
    // create panel for comments text area
    JPanel commentsPanel = createStatementsPanel(commentedStepsTextArea, "SQL Steps");

    sqlStatementsTextArea = new JTextArea();
    sqlStatementsTextArea.setLineWrap(true);
    sqlStatementsTextArea.setEditable(false);
    sqlStatementsTextArea.setWrapStyleWord(true);
    // create panel for sql statements
    JPanel sqlPanel = createStatementsPanel(sqlStatementsTextArea, "SQL Statements");

    // create a tabbed pane to contain the statements panels
    JTabbedPane tabbedPane = new JTabbedPane(JTabbedPane.TOP);
    tabbedPane.addTab("Steps", null, commentsPanel, "Commented steps executed in generating the result");
    tabbedPane.addTab("SQL", null, sqlPanel, "SQL Statements used in generating the result");

    // add components to this panel
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder());
    setPreferredSize(new Dimension(550, 450));
    add(upperPanel, BorderLayout.NORTH);
    add(tabbedPane, BorderLayout.CENTER);
}

From source file:InternalFrameEventDemo.java

protected void createDisplayWindow() {
    JButton b1 = new JButton("Show internal frame");
    b1.setActionCommand(SHOW);/*from   w w w .ja v  a  2s .  c o  m*/
    b1.addActionListener(this);

    JButton b2 = new JButton("Clear event info");
    b2.setActionCommand(CLEAR);
    b2.addActionListener(this);

    display = new JTextArea(3, 30);
    display.setEditable(false);
    JScrollPane textScroller = new JScrollPane(display);
    // Have to supply a preferred size, or else the scroll
    // area will try to stay as large as the text area.
    textScroller.setPreferredSize(new Dimension(200, 75));
    textScroller.setMinimumSize(new Dimension(10, 10));

    displayWindow = new JInternalFrame("Event Watcher", true, // resizable
            false, // not closable
            false, // not maximizable
            true); // iconifiable
    JPanel contentPane = new JPanel();
    contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.PAGE_AXIS));
    b1.setAlignmentX(CENTER_ALIGNMENT);
    contentPane.add(b1);
    contentPane.add(Box.createRigidArea(new Dimension(0, 5)));
    contentPane.add(textScroller);
    contentPane.add(Box.createRigidArea(new Dimension(0, 5)));
    b2.setAlignmentX(CENTER_ALIGNMENT);
    contentPane.add(b2);

    displayWindow.setContentPane(contentPane);
    displayWindow.pack();
    displayWindow.setVisible(true);
}