Example usage for javax.swing GroupLayout PREFERRED_SIZE

List of usage examples for javax.swing GroupLayout PREFERRED_SIZE

Introduction

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

Prototype

int PREFERRED_SIZE

To view the source code for javax.swing GroupLayout PREFERRED_SIZE.

Click Source Link

Document

Indicates the preferred size from the component or gap should be used for a particular range value.

Usage

From source file:uk.ac.ebi.pride.tools.converter.gui.dialogs.SimplePTMDialog.java

private void initComponents() {
        // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
        // Generated using JFormDesigner non-commercial license
        cancelButton = new JButton();
        okButton = new JButton();
        scrollPane1 = new JScrollPane();
        ptmList = new JList();
        label1 = new JLabel();
        label2 = new JLabel();
        massDeltaTextField = new JTextField();
        ptmLabelTextField = new JTextField();
        label3 = new JLabel();
        olsButton = new JButton();

        //======== this ========
        setTitle("PTM Assignment");
        Container contentPane = getContentPane();

        //---- cancelButton ----
        cancelButton.setText("Cancel");
        cancelButton.addActionListener(new ActionListener() {
            @Override/*from   w  ww  .  ja va 2 s .c o m*/
            public void actionPerformed(ActionEvent e) {
                cancelButtonActionPerformed();
            }
        });

        //---- okButton ----
        okButton.setText("OK");
        okButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                okButtonActionPerformed();
            }
        });

        //======== scrollPane1 ========
        {

            //---- ptmList ----
            ptmList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
            ptmList.addMouseListener(new MouseAdapter() {
                @Override
                public void mouseClicked(MouseEvent e) {
                    ptmListMouseClicked(e);
                }
            });
            scrollPane1.setViewportView(ptmList);
        }

        //---- label1 ----
        label1.setText("Label");

        //---- label2 ----
        label2.setText("Mass Delta");

        //---- massDeltaTextField ----
        massDeltaTextField.setEditable(false);

        //---- ptmLabelTextField ----
        ptmLabelTextField.setEditable(false);

        //---- label3 ----
        label3.setText("Suggested PTMs:");

        //---- olsButton ----
        olsButton.setText("Search OLS");
        olsButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                olsButtonActionPerformed();
            }
        });

        GroupLayout contentPaneLayout = new GroupLayout(contentPane);
        contentPane.setLayout(contentPaneLayout);
        contentPaneLayout.setHorizontalGroup(contentPaneLayout.createParallelGroup().addGroup(
                GroupLayout.Alignment.TRAILING,
                contentPaneLayout.createSequentialGroup().addContainerGap().addGroup(contentPaneLayout
                        .createParallelGroup(GroupLayout.Alignment.TRAILING)
                        .addComponent(scrollPane1, GroupLayout.Alignment.LEADING, GroupLayout.DEFAULT_SIZE, 376,
                                Short.MAX_VALUE)
                        .addGroup(contentPaneLayout.createSequentialGroup().addComponent(olsButton)
                                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 94, Short.MAX_VALUE)
                                .addComponent(okButton, GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(cancelButton))
                        .addGroup(GroupLayout.Alignment.LEADING, contentPaneLayout.createSequentialGroup()
                                .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                                        .addComponent(label1).addComponent(label2))
                                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(contentPaneLayout.createParallelGroup()
                                        .addComponent(ptmLabelTextField, GroupLayout.DEFAULT_SIZE, 291,
                                                Short.MAX_VALUE)
                                        .addComponent(massDeltaTextField, GroupLayout.DEFAULT_SIZE, 291,
                                                Short.MAX_VALUE)))
                        .addComponent(label3, GroupLayout.Alignment.LEADING)).addContainerGap()));
        contentPaneLayout.setVerticalGroup(contentPaneLayout.createParallelGroup().addGroup(
                GroupLayout.Alignment.TRAILING,
                contentPaneLayout.createSequentialGroup().addContainerGap()
                        .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(ptmLabelTextField, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                .addComponent(label1))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(label2).addComponent(massDeltaTextField, GroupLayout.PREFERRED_SIZE,
                                        GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED).addComponent(label3)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(scrollPane1, GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE)
                        .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                        .addGroup(contentPaneLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(cancelButton).addComponent(okButton).addComponent(olsButton))
                        .addContainerGap()));
        pack();
        setLocationRelativeTo(getOwner());
        // JFormDesigner - End of component initialization  //GEN-END:initComponents
    }

From source file:uk.chromis.pos.config.JPanelConfiguration.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor.// w w  w.j  ava  2s .  c  o  m
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    jTabbedPane1 = new javax.swing.JTabbedPane();
    jPanelDatabase = new javax.swing.JPanel();
    jPanelGeneral = new javax.swing.JPanel();
    jPanelLocale = new javax.swing.JPanel();
    jPanelPayment = new javax.swing.JPanel();
    jPanelPeripheral = new javax.swing.JPanel();
    jPanelSystem = new javax.swing.JPanel();
    jPanelTicketSetup = new javax.swing.JPanel();
    jPanel1 = new javax.swing.JPanel();
    jbtnRestore = new javax.swing.JButton();
    jbtnExit = new javax.swing.JButton();
    jbtnSave = new javax.swing.JButton();

    setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    setMinimumSize(new java.awt.Dimension(780, 700));
    setPreferredSize(new java.awt.Dimension(780, 700));

    jTabbedPane1.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jTabbedPane1.setPreferredSize(new java.awt.Dimension(730, 650));

    jPanelDatabase.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jPanelDatabase.setPreferredSize(new java.awt.Dimension(0, 450));
    jPanelDatabase.setLayout(new javax.swing.BoxLayout(jPanelDatabase, javax.swing.BoxLayout.LINE_AXIS));
    jTabbedPane1.addTab("Database Setup", jPanelDatabase);

    jPanelGeneral.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jPanelGeneral.setPreferredSize(new java.awt.Dimension(0, 400));
    jPanelGeneral.setLayout(new javax.swing.BoxLayout(jPanelGeneral, javax.swing.BoxLayout.LINE_AXIS));
    jTabbedPane1.addTab("General", jPanelGeneral);

    jPanelLocale.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jPanelLocale.setPreferredSize(new java.awt.Dimension(730, 400));
    jPanelLocale.setLayout(new javax.swing.BoxLayout(jPanelLocale, javax.swing.BoxLayout.LINE_AXIS));
    jTabbedPane1.addTab("Locale", jPanelLocale);

    jPanelPayment.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jPanelPayment.setPreferredSize(new java.awt.Dimension(0, 400));
    jPanelPayment.setLayout(new javax.swing.BoxLayout(jPanelPayment, javax.swing.BoxLayout.LINE_AXIS));
    jTabbedPane1.addTab("Payment Method", jPanelPayment);

    jPanelPeripheral.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jPanelPeripheral.setPreferredSize(new java.awt.Dimension(0, 400));
    jPanelPeripheral.setLayout(new javax.swing.BoxLayout(jPanelPeripheral, javax.swing.BoxLayout.LINE_AXIS));
    jTabbedPane1.addTab("Peripherals", jPanelPeripheral);

    jPanelSystem.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jPanelSystem.setPreferredSize(new java.awt.Dimension(0, 500));
    jPanelSystem.setLayout(new javax.swing.BoxLayout(jPanelSystem, javax.swing.BoxLayout.LINE_AXIS));
    jTabbedPane1.addTab("System Options", jPanelSystem);

    jPanelTicketSetup.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jPanelTicketSetup.setPreferredSize(new java.awt.Dimension(0, 400));
    jPanelTicketSetup.setLayout(new javax.swing.BoxLayout(jPanelTicketSetup, javax.swing.BoxLayout.LINE_AXIS));
    jTabbedPane1.addTab("Ticket Setup", jPanelTicketSetup);

    jbtnRestore.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jbtnRestore.setText(AppLocal.getIntString("Button.Factory")); // NOI18N
    jbtnRestore.setMaximumSize(new java.awt.Dimension(103, 33));
    jbtnRestore.setMinimumSize(new java.awt.Dimension(103, 33));
    jbtnRestore.setPreferredSize(new java.awt.Dimension(80, 33));
    jbtnRestore.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbtnRestoreActionPerformed(evt);
        }
    });

    jbtnExit.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jbtnExit.setText(AppLocal.getIntString("Button.Exit")); // NOI18N
    jbtnExit.setMaximumSize(new java.awt.Dimension(70, 33));
    jbtnExit.setMinimumSize(new java.awt.Dimension(70, 33));
    jbtnExit.setPreferredSize(new java.awt.Dimension(80, 33));
    jbtnExit.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbtnExitActionPerformed(evt);
        }
    });

    jbtnSave.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
    jbtnSave.setText(AppLocal.getIntString("Button.Save")); // NOI18N
    jbtnSave.setMaximumSize(new java.awt.Dimension(70, 33));
    jbtnSave.setMinimumSize(new java.awt.Dimension(70, 33));
    jbtnSave.setPreferredSize(new java.awt.Dimension(80, 33));
    jbtnSave.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            jbtnSaveActionPerformed(evt);
        }
    });

    javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
    jPanel1.setLayout(jPanel1Layout);
    jPanel1Layout
            .setHorizontalGroup(
                    jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(
                                    jPanel1Layout.createSequentialGroup().addContainerGap()
                                            .addComponent(jbtnRestore, javax.swing.GroupLayout.PREFERRED_SIZE,
                                                    80, javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addGap(230, 230, 230)
                                            .addComponent(jbtnExit, javax.swing.GroupLayout.PREFERRED_SIZE, 80,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
                                                    250, Short.MAX_VALUE)
                                            .addComponent(jbtnSave, javax.swing.GroupLayout.PREFERRED_SIZE, 80,
                                                    javax.swing.GroupLayout.PREFERRED_SIZE)
                                            .addContainerGap()));
    jPanel1Layout.setVerticalGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jbtnRestore, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtnExit, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
                            javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jbtnSave, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
                            javax.swing.GroupLayout.PREFERRED_SIZE)));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE,
                                    javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addContainerGap(37, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addComponent(jTabbedPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 645, Short.MAX_VALUE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE,
                            javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap()));
}

From source file:volker.streaming.music.gui.ConfigPanel.java

private void initLayout() {
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);

    layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING).addComponent(userLabel)
                            .addComponent(pollLabel).addComponent(apiSchemeLabel).addComponent(apiBaseLabel)
                            .addComponent(apiPathLabel).addComponent(apiKeyLabel))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addComponent(userField)
                            .addGroup(layout.createSequentialGroup()
                                    .addComponent(pollField, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(pollEndLabel))
                            .addComponent(apiSchemeField).addComponent(apiBaseField).addComponent(apiPathField)
                            .addComponent(apiKeyField)))
            .addComponent(pollErrorLabel).addComponent(advancedViewBox)).addContainerGap());
    layout.setVerticalGroup(//  ww w.  j  av a  2s. co  m
            layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(userLabel)
                            .addComponent(userField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(pollLabel)
                            .addComponent(pollField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE)
                            .addComponent(pollEndLabel))
                    .addComponent(pollErrorLabel).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(advancedViewBox).addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(apiSchemeLabel).addComponent(apiSchemeField,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(apiBaseLabel).addComponent(apiBaseField, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(apiPathLabel).addComponent(apiPathField, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(apiKeyLabel).addComponent(apiKeyField, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addContainerGap());

    updateView();
}

From source file:volker.streaming.music.gui.FormatPanel.java

private void initLayout() {
    GroupLayout layout = new GroupLayout(this);
    this.setLayout(layout);

    layout.setHorizontalGroup(layout.createSequentialGroup().addContainerGap().addGroup(layout
            .createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addComponent(formatLabel)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(formatInfoButton))
            .addGroup(layout.createSequentialGroup().addComponent(previewLabel)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(previewField))
            .addGroup(layout.createSequentialGroup()
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addComponent(templateLabel).addComponent(formatArea))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                            .addComponent(tagLabel).addComponent(tagScrollPane)))
            .addComponent(nullMessageLabel).addComponent(nullMessageField).addComponent(hline)
            .addComponent(fileLabel)/*from www  .java  2s .  co  m*/
            .addGroup(layout.createSequentialGroup().addComponent(fileField)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(fileButton)))
            .addContainerGap());

    layout.setVerticalGroup(
            layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.CENTER).addComponent(formatLabel)
                            .addComponent(formatInfoButton))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(previewLabel).addComponent(previewField))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup().addComponent(templateLabel)
                                    .addComponent(formatArea))
                            .addGroup(layout.createSequentialGroup().addComponent(tagLabel)
                                    .addComponent(tagScrollPane)))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(nullMessageLabel)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(nullMessageField, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(hline, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(fileLabel)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(
                            layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                                    .addComponent(fileField, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(fileButton))
                    .addContainerGap());
}