Example usage for javax.swing GroupLayout GroupLayout

List of usage examples for javax.swing GroupLayout GroupLayout

Introduction

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

Prototype

public GroupLayout(Container host) 

Source Link

Document

Creates a GroupLayout for the specified Container .

Usage

From source file:gtu._work.ui.JUnitMakerUI.java

private void initGUI() {
    try {//from   ww w  .  j  a v  a2  s  .  c  om
        GroupLayout thisLayout = new GroupLayout((JComponent) getContentPane());
        getContentPane().setLayout(thisLayout);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        {
            jTextField1 = new JTextField();
        }
        {
            jLabel1 = new JLabel();
            jLabel1.setText("Class");
        }
        {
            jTextField2 = new JTextField();
        }
        {
            jLabel2 = new JLabel();
            jLabel2.setText("Package");
        }
        {
            jTextField3 = new JTextField();
        }
        {
            jLabel3 = new JLabel();
            jLabel3.setText("fieldName");
        }
        {
            jTextArea1 = new JTextArea();
        }
        {
            jButton1 = new JButton();
            jButton1.setText("execute");
            jButton1.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    jButton1ActionPerformed(evt);
                }
            });
        }
        {
            jButton3 = new JButton();
            jButton3.setText("validate");
            jButton3.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    jButton3ActionPerformed(evt);
                }
            });
        }
        {
            jTextField4 = new JTextField();
        }
        {
            jLabel4 = new JLabel();
            jLabel4.setText("dest");
        }
        {
            jButton2 = new JButton();
            jButton2.setText("choice");
            jButton2.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    jButton2ActionPerformed(evt);
                }
            });
        }
        thisLayout.setVerticalGroup(thisLayout.createSequentialGroup().addContainerGap()
                .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextField1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                25, GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextField2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                25, GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextField3, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                25, GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel3, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                        .addComponent(jTextField4, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                25, GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel4, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                        .addComponent(jButton2, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jTextArea1, GroupLayout.PREFERRED_SIZE, 164, GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                        .addComponent(jButton1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                        .addGroup(GroupLayout.Alignment.LEADING,
                                thisLayout.createSequentialGroup()
                                        .addComponent(jButton3, GroupLayout.PREFERRED_SIZE, 24,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addGap(0, 0, Short.MAX_VALUE)))
                .addGap(6));
        thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup().addContainerGap().addGroup(thisLayout
                .createParallelGroup()
                .addGroup(thisLayout.createSequentialGroup().addGroup(thisLayout.createParallelGroup()
                        .addComponent(jLabel4, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 85,
                                GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel3, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 85,
                                GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel2, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 85,
                                GroupLayout.PREFERRED_SIZE)
                        .addComponent(jLabel1, GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 85,
                                GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(thisLayout.createParallelGroup()
                                .addGroup(GroupLayout.Alignment.LEADING,
                                        thisLayout.createSequentialGroup()
                                                .addComponent(jTextField4, GroupLayout.PREFERRED_SIZE, 200,
                                                        GroupLayout.PREFERRED_SIZE)
                                                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(jButton2, GroupLayout.PREFERRED_SIZE, 73,
                                                        GroupLayout.PREFERRED_SIZE))
                                .addGroup(thisLayout.createSequentialGroup().addComponent(jTextField3,
                                        GroupLayout.PREFERRED_SIZE, 279, GroupLayout.PREFERRED_SIZE))
                                .addGroup(thisLayout.createSequentialGroup().addComponent(jTextField2,
                                        GroupLayout.PREFERRED_SIZE, 279, GroupLayout.PREFERRED_SIZE))
                                .addGroup(thisLayout.createSequentialGroup().addComponent(jTextField1,
                                        GroupLayout.PREFERRED_SIZE, 279, GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE))
                .addGroup(
                        thisLayout.createSequentialGroup()
                                .addComponent(jTextArea1, GroupLayout.PREFERRED_SIZE, 376,
                                        GroupLayout.PREFERRED_SIZE)
                                .addGap(0, 0, Short.MAX_VALUE))
                .addGroup(GroupLayout.Alignment.LEADING, thisLayout.createSequentialGroup().addGap(78)
                        .addComponent(jButton3, GroupLayout.PREFERRED_SIZE, 82, GroupLayout.PREFERRED_SIZE)
                        .addGap(73)
                        .addComponent(jButton1, GroupLayout.PREFERRED_SIZE, 82, GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 61, Short.MAX_VALUE)))
                .addContainerGap(17, 17));
        this.setSize(421, 380);
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:gtu.zcognos.SimpleUI.java

private void initGUI() {
    try {//from w ww  . j  a va 2  s. com

        final SwingActionUtil swingUtil = (SwingActionUtil) SwingActionUtil.newInstance(this);
        {
            GroupLayout thisLayout = new GroupLayout((JComponent) getContentPane());
            getContentPane().setLayout(thisLayout);
            this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            {
                projectId = new JTextField();
            }
            {
                packageId = new JTextField();
            }
            {
                jLabel1 = new JLabel();
                jLabel1.setText("PROJECT_ID");
            }
            {
                jLabel2 = new JLabel();
                jLabel2.setText("PACKAGE_ID");
            }
            {
                jLabel3 = new JLabel();
                jLabel3.setText("DATATABLE");
            }
            {
                jScrollPane1 = new JScrollPane();
                {
                    dataTable = new JTextArea();
                    jScrollPane1.setViewportView(dataTable);
                }
            }
            {
                create = new JButton();
                create.setText("create");
                create.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent evt) {
                        swingUtil.invokeAction("create.actionPerformed", evt);
                    }
                });
            }
            thisLayout.setVerticalGroup(thisLayout.createSequentialGroup().addContainerGap(16, 16)
                    .addGroup(thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                            .addComponent(projectId, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel1, GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
                                    GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addGroup(thisLayout.createParallelGroup().addGroup(GroupLayout.Alignment.LEADING,
                            thisLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(packageId, GroupLayout.Alignment.BASELINE,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel2, GroupLayout.Alignment.BASELINE,
                                            GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.PREFERRED_SIZE))
                            .addGroup(GroupLayout.Alignment.LEADING,
                                    thisLayout.createSequentialGroup()
                                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0,
                                                    Short.MAX_VALUE)
                                            .addComponent(create, GroupLayout.PREFERRED_SIZE, 22,
                                                    GroupLayout.PREFERRED_SIZE)))
                    .addComponent(jLabel3, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 217, GroupLayout.PREFERRED_SIZE)
                    .addContainerGap());
            thisLayout.setHorizontalGroup(thisLayout.createSequentialGroup().addContainerGap(31, 31).addGroup(
                    thisLayout.createParallelGroup().addGroup(GroupLayout.Alignment.LEADING, thisLayout
                            .createSequentialGroup()
                            .addGroup(thisLayout.createParallelGroup()
                                    .addComponent(jLabel2, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel1, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(jLabel3, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 103, GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(thisLayout.createParallelGroup()
                                    .addComponent(packageId, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE)
                                    .addComponent(projectId, GroupLayout.Alignment.LEADING,
                                            GroupLayout.PREFERRED_SIZE, 204, GroupLayout.PREFERRED_SIZE))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(create, GroupLayout.PREFERRED_SIZE, 88, GroupLayout.PREFERRED_SIZE)
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 0, Short.MAX_VALUE))
                            .addGroup(thisLayout.createSequentialGroup()
                                    .addComponent(jScrollPane1, GroupLayout.PREFERRED_SIZE, 417,
                                            GroupLayout.PREFERRED_SIZE)
                                    .addGap(0, 0, Short.MAX_VALUE)))
                    .addContainerGap(17, 17));
        }
        this.setSize(473, 356);

        swingUtil.addAction("create.actionPerformed", new Action() {
            public void action(EventObject evt) throws Exception {
                String project = projectId.getText();
                String dataTab = dataTable.getText();
                Validate.notEmpty(project);
                Validate.notEmpty(dataTab);
                String pkgId = StringUtils.defaultIfEmpty(packageId.getText(), project);

                List<String> dataTableList = new ArrayList<String>();
                StringTokenizer tok = new StringTokenizer(dataTab);
                for (int ii = 0; tok.hasMoreElements(); ii++) {
                    String column = (String) tok.nextElement();
                    System.out.format("%d -- %s\n", ii, column);
                    if (StringUtils.isBlank(column)) {
                        continue;
                    }
                    dataTableList.add(column.trim());
                }

                File destDir = new File(CREATE_DEST + "\\" + project);
                destDir.mkdirs();

                Map<String, Object> map = new HashMap<String, Object>();
                map.put("PROJECT_ID", project);
                map.put("PACKAGE_ID", pkgId);
                map.put("DATATABLE", dataTableList);

                ConfigCopy.getInstance().applyBaseDir(new File(CREATE_DEST)).applyProjectId(project).execute();

                Simple.getInstance()//
                        .applyDestDir(destDir.getAbsolutePath())//
                        .applyParameter(map)//
                        .execute();

                JOptionPaneUtil.newInstance().iconInformationMessage()
                        .showMessageDialog(pkgId + " create completed!!\r\n dir : " //
                                + destDir.getAbsolutePath(), pkgId);

                Desktop.getDesktop().open(destDir);
            }
        });

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:layout.Find.java

public Find() {
    JLabel label = new JLabel("Find What:");
    ;/*  ww w  .ja  v a  2s. com*/
    JTextField textField = new JTextField();
    JCheckBox caseCheckBox = new JCheckBox("Match Case");
    JCheckBox wrapCheckBox = new JCheckBox("Wrap Around");
    JCheckBox wholeCheckBox = new JCheckBox("Whole Words");
    JCheckBox backCheckBox = new JCheckBox("Search Backwards");
    JButton findButton = new JButton("Find");
    JButton cancelButton = new JButton("Cancel");

    // remove redundant default border of check boxes - they would hinder
    // correct spacing and aligning (maybe not needed on some look and feels)
    caseCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    wrapCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    wholeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    backCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(label)
            .addGroup(layout.createParallelGroup(LEADING).addComponent(textField)
                    .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(LEADING).addComponent(caseCheckBox)
                                    .addComponent(wholeCheckBox))
                            .addGroup(layout.createParallelGroup(LEADING).addComponent(wrapCheckBox)
                                    .addComponent(backCheckBox))))
            .addGroup(layout.createParallelGroup(LEADING).addComponent(findButton).addComponent(cancelButton)));

    layout.linkSize(SwingConstants.HORIZONTAL, findButton, cancelButton);

    layout.setVerticalGroup(layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(BASELINE).addComponent(label).addComponent(textField)
                    .addComponent(findButton))
            .addGroup(layout.createParallelGroup(LEADING)
                    .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(BASELINE).addComponent(caseCheckBox)
                                    .addComponent(wrapCheckBox))
                            .addGroup(layout.createParallelGroup(BASELINE).addComponent(wholeCheckBox)
                                    .addComponent(backCheckBox)))
                    .addComponent(cancelButton)));

    setTitle("Find");
    pack();
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}

From source file:net.chunkyhosting.Roe.computer.CHGManager.gui.panels.ServerDisplay.java

public ServerDisplay(JSONObject server) {

    JLabel game = new JLabel(server.getString("gametype"));
    JLabel statusImg = new JLabel(
            new ImageIcon(CHGManager.getInstance().getSettings().getWorkingDirectory().toString()
                    + File.separator + "img" + File.separator + "icons" + File.separator + "ball_green.gif"));
    JLabel statusDetail = new JLabel("284/500");
    JLabel ip = new JLabel(server.getString("ip") + ":" + server.getString("port"));
    JButton console = new JButton(
            new ImageIcon(CHGManager.getInstance().getSettings().getWorkingDirectory().toString()
                    + File.separator + "img" + File.separator + "icons" + File.separator + "console.gif"));
    JButton restart = new JButton(
            new ImageIcon(CHGManager.getInstance().getSettings().getWorkingDirectory().toString()
                    + File.separator + "img" + File.separator + "icons" + File.separator + "restart.gif"));
    JButton stop = new JButton(
            new ImageIcon(CHGManager.getInstance().getSettings().getWorkingDirectory().toString()
                    + File.separator + "img" + File.separator + "icons" + File.separator + "stop.gif"));
    JButton edit = new JButton(
            new ImageIcon(CHGManager.getInstance().getSettings().getWorkingDirectory().toString()
                    + File.separator + "img" + File.separator + "icons" + File.separator + "edit.gif"));
    GroupLayout gl_panel = new GroupLayout(this);
    gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel.createSequentialGroup().addContainerGap().addComponent(game).addGap(18)
                    .addComponent(statusImg).addGap(18).addComponent(statusDetail).addGap(18).addComponent(ip)
                    .addPreferredGap(ComponentPlacement.RELATED, 178, Short.MAX_VALUE).addComponent(console)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(restart)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(stop)
                    .addPreferredGap(ComponentPlacement.RELATED).addComponent(edit)));
    gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panel.createParallelGroup(Alignment.BASELINE).addComponent(edit)
                            .addComponent(stop).addComponent(restart).addComponent(console))
                    .addContainerGap(23, Short.MAX_VALUE))
            .addGroup(Alignment.TRAILING,
                    gl_panel.createSequentialGroup().addContainerGap(15, Short.MAX_VALUE)
                            .addGroup(gl_panel.createParallelGroup(Alignment.BASELINE).addComponent(game)
                                    .addComponent(statusImg).addComponent(statusDetail).addComponent(ip))
                            .addGap(14)));
    this.setLayout(gl_panel);

}

From source file:lookandfeel.SynthDialog.java

public SynthDialog() {
    JLabel label = new JLabel("Find What:");
    ;//w  ww  .  jav a 2  s.  co m
    JTextField textField = new JTextField();
    JCheckBox caseCheckBox = new JCheckBox("Match Case");
    JCheckBox wrapCheckBox = new JCheckBox("Wrap Around");
    JCheckBox wholeCheckBox = new JCheckBox("Whole Words");
    JCheckBox backCheckBox = new JCheckBox("Search Backwards");
    JButton findButton = new JButton("Find");
    JButton cancelButton = new JButton("Cancel");

    // remove redundant default border of check boxes - they would hinder
    // correct spacing and aligning (maybe not needed on some look and feels)
    caseCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    wrapCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    wholeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    backCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(layout.createSequentialGroup().addComponent(label)
            .addGroup(layout.createParallelGroup(LEADING).addComponent(textField)
                    .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(LEADING).addComponent(caseCheckBox)
                                    .addComponent(wholeCheckBox))
                            .addGroup(layout.createParallelGroup(LEADING).addComponent(wrapCheckBox)
                                    .addComponent(backCheckBox))))
            .addGroup(layout.createParallelGroup(LEADING).addComponent(findButton).addComponent(cancelButton)));

    layout.linkSize(SwingConstants.HORIZONTAL, findButton, cancelButton);

    layout.setVerticalGroup(layout.createSequentialGroup()
            .addGroup(layout.createParallelGroup(BASELINE).addComponent(label).addComponent(textField)
                    .addComponent(findButton))
            .addGroup(layout.createParallelGroup(LEADING)
                    .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(BASELINE).addComponent(caseCheckBox)
                                    .addComponent(wrapCheckBox))
                            .addGroup(layout.createParallelGroup(BASELINE).addComponent(wholeCheckBox)
                                    .addComponent(backCheckBox)))
                    .addComponent(cancelButton)));

    setTitle("Find");
    pack();
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}

From source file:com.employee.scheduler.nurserostering.swingui.NurseRosteringPanel.java

public NurseRosteringPanel() {
    employeeIcon = new ImageIcon(getClass().getResource("employee.png"));
    deleteEmployeeIcon = new ImageIcon(getClass().getResource("deleteEmployee.png"));
    GroupLayout layout = new GroupLayout(this);
    setLayout(layout);//from www.j a va 2  s .c o  m
    createEmployeeListPanel();
    JPanel headerPanel = createHeaderPanel();
    layout.setHorizontalGroup(
            layout.createParallelGroup().addComponent(headerPanel).addComponent(employeeListPanel));
    layout.setVerticalGroup(layout.createSequentialGroup()
            .addComponent(headerPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                    GroupLayout.PREFERRED_SIZE)
            .addComponent(employeeListPanel, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
                    GroupLayout.PREFERRED_SIZE));
}

From source file:GroupLayoutTest.java

public FontFrame() {
    setTitle("GroupLayoutTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    ActionListener listener = new FontAction();

    // construct components

    JLabel faceLabel = new JLabel("Face: ");

    face = new JComboBox(new String[] { "Serif", "SansSerif", "Monospaced", "Dialog", "DialogInput" });

    face.addActionListener(listener);//  ww  w .j av  a2 s.  co  m

    JLabel sizeLabel = new JLabel("Size: ");

    size = new JComboBox(new String[] { "8", "10", "12", "15", "18", "24", "36", "48" });

    size.addActionListener(listener);

    bold = new JCheckBox("Bold");
    bold.addActionListener(listener);

    italic = new JCheckBox("Italic");
    italic.addActionListener(listener);

    sample = new JTextArea();
    sample.setText("The quick brown fox jumps over the lazy dog");
    sample.setEditable(false);
    sample.setLineWrap(true);
    sample.setBorder(BorderFactory.createEtchedBorder());

    pane = new JScrollPane(sample);

    GroupLayout layout = new GroupLayout(getContentPane());
    setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addContainerGap()
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addGroup(GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                                            .addComponent(faceLabel).addComponent(sizeLabel))
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                                            .addComponent(size).addComponent(face)))
                            .addComponent(italic).addComponent(bold))
                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(pane)
                    .addContainerGap()));

    layout.linkSize(SwingConstants.HORIZONTAL, new java.awt.Component[] { face, size });

    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                    .addComponent(pane, GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(face).addComponent(faceLabel))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                    .addComponent(size).addComponent(sizeLabel))
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(italic, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(bold,
                                    GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
            .addContainerGap()));
}

From source file:lookandfeel.SynthDialog.java

public SynthDialog() {
   JLabel label = new JLabel("Find What:");;
    JTextField textField = new JTextField();
    JCheckBox caseCheckBox = new JCheckBox("Match Case");
    JCheckBox wrapCheckBox = new JCheckBox("Wrap Around");
    JCheckBox wholeCheckBox = new JCheckBox("Whole Words");
    JCheckBox backCheckBox = new JCheckBox("Search Backwards");
    JButton findButton = new JButton("Find");
    JButton cancelButton = new JButton("Cancel");

    // remove redundant default border of check boxes - they would hinder
    // correct spacing and aligning (maybe not needed on some look and feels)
    caseCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    wrapCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    wholeCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    backCheckBox.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);//from  w  w w. j a  v a2 s  .  co  m
    layout.setAutoCreateGaps(true);
    layout.setAutoCreateContainerGaps(true);

    layout.setHorizontalGroup(layout.createSequentialGroup()
        .addComponent(label)
        .addGroup(layout.createParallelGroup(LEADING)
            .addComponent(textField)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(LEADING)
                    .addComponent(caseCheckBox)
                    .addComponent(wholeCheckBox))
                .addGroup(layout.createParallelGroup(LEADING)
                    .addComponent(wrapCheckBox)
                    .addComponent(backCheckBox))))
        .addGroup(layout.createParallelGroup(LEADING)
            .addComponent(findButton)
            .addComponent(cancelButton))
    );
       
    layout.linkSize(SwingConstants.HORIZONTAL, findButton, cancelButton);

    layout.setVerticalGroup(layout.createSequentialGroup()
        .addGroup(layout.createParallelGroup(BASELINE)
            .addComponent(label)
            .addComponent(textField)
            .addComponent(findButton))
        .addGroup(layout.createParallelGroup(LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(BASELINE)
                    .addComponent(caseCheckBox)
                    .addComponent(wrapCheckBox))
                .addGroup(layout.createParallelGroup(BASELINE)
                    .addComponent(wholeCheckBox)
                    .addComponent(backCheckBox)))
            .addComponent(cancelButton))
    );

    setTitle("Find");
    pack();
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}

From source file:com.antelink.sourcesquare.gui.view.ExitSourceSquareView.java

/**
 * Create the frame./* ww  w . j  a v a2  s  .  co  m*/
 */
public ExitSourceSquareView() {
    setIconImage(Toolkit.getDefaultToolkit().getImage(SourceSquareView.class.getResource("/antelink.png")));
    setTitle("SourceSquare");
    setResizable(false);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 500, 170);
    this.contentPane = new JPanel();
    this.contentPane.setBackground(Color.WHITE);
    this.contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(this.contentPane);

    this.mainPanel = new JPanel();
    this.mainPanel.setBackground(Color.WHITE);
    GroupLayout gl_contentPane = new GroupLayout(this.contentPane);
    gl_contentPane.setHorizontalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
            .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE));
    gl_contentPane.setVerticalGroup(gl_contentPane.createParallelGroup(Alignment.LEADING)
            .addComponent(this.mainPanel, GroupLayout.DEFAULT_SIZE, 263, Short.MAX_VALUE));
    this.mainPanel.setLayout(new BoxLayout(this.mainPanel, BoxLayout.Y_AXIS));

    JPanel panel_1 = new JPanel();
    panel_1.setBackground(Color.WHITE);
    this.mainPanel.add(panel_1);
    panel_1.setLayout(new BorderLayout(0, 0));

    JPanel panel = new JPanel();
    panel.setLayout(new FlowLayout(FlowLayout.CENTER, 50, 20));
    panel.setBackground(Color.WHITE);
    panel_1.add(panel, BorderLayout.SOUTH);

    Image openButtonImage = Toolkit.getDefaultToolkit()
            .getImage(SourceSquareView.class.getResource("/OpenButton.png"));
    this.openButtonLabel = new JLabel(new ImageIcon(openButtonImage));
    this.openButtonLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    panel.add(this.openButtonLabel);

    JLabel exitLabel = new JLabel("<html><b>Closing this window will quit the application</b></html>");
    exitLabel.setFont(new Font("Helvetica", Font.PLAIN, 13));

    JLabel explainLabel = new JLabel("<html>(You won't be able to see or publish your results anymore)</html>");
    explainLabel.setFont(new Font("Helvetica", Font.PLAIN, 13));

    JPanel textPanel = new JPanel();
    textPanel.setBackground(Color.WHITE);
    textPanel.setLayout(new FlowLayout(FlowLayout.CENTER, 5, 0));

    textPanel.add(exitLabel, BorderLayout.CENTER);
    textPanel.add(explainLabel, BorderLayout.CENTER);

    panel_1.add(textPanel, BorderLayout.CENTER);

    CopyrightPanel copyrightPanel = new CopyrightPanel();
    copyrightPanel.setBackground(Color.WHITE);
    this.mainPanel.add(copyrightPanel);
    this.contentPane.setLayout(gl_contentPane);

    setLocationRelativeTo(null);
}

From source file:client.ui.UploadFileWindow.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.//  ww w  . ja  v  a2  s.  c  om
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    filePathLabel = new JLabel();
    pathField = new JTextField();
    pathButton = new JButton();
    filenameLabel = new JLabel();
    filenameField = new JTextField();
    confirmButton = new JButton();
    filenameTip = new JLabel();

    FormListener formListener = new FormListener();

    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setTitle("");
    setResizable(false);

    filePathLabel.setFont(new Font("", 0, 12)); // NOI18N
    filePathLabel.setText("");

    pathField.setFont(new Font("", 0, 12)); // NOI18N

    pathButton.setFont(new Font("", 0, 12)); // NOI18N
    pathButton.setText("?");
    pathButton.addActionListener(formListener);

    filenameLabel.setFont(new Font("", 0, 12)); // NOI18N
    filenameLabel.setText("??");

    filenameField.setFont(new Font("", 0, 12)); // NOI18N

    confirmButton.setFont(new Font("", 0, 12)); // NOI18N
    confirmButton.setText("");
    confirmButton.addActionListener(formListener);

    filenameTip.setFont(new Font("", 0, 12)); // NOI18N
    filenameTip.setForeground(new Color(153, 153, 153));
    filenameTip.setText("???");

    GroupLayout layout = new GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout
            .createSequentialGroup()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout
                    .createSequentialGroup().addGap(19, 19, 19)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addComponent(filePathLabel).addComponent(filenameLabel))
                    .addGap(18, 18, 18)
                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING)
                            .addComponent(filenameTip)
                            .addGroup(layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING, false)
                                            .addComponent(pathField, GroupLayout.DEFAULT_SIZE, 213,
                                                    Short.MAX_VALUE)
                                            .addComponent(filenameField))
                                    .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                                    .addComponent(pathButton))))
                    .addGroup(layout.createSequentialGroup().addGap(167, 167, 167).addComponent(confirmButton)))
            .addContainerGap(33, Short.MAX_VALUE)));
    layout.setVerticalGroup(layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGroup(layout
            .createSequentialGroup().addContainerGap()
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(filePathLabel)
                    .addComponent(pathField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(pathButton))
            .addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
            .addGroup(layout.createParallelGroup(GroupLayout.Alignment.BASELINE).addComponent(filenameLabel)
                    .addComponent(filenameField, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED).addComponent(filenameTip)
            .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED, 19, Short.MAX_VALUE)
            .addComponent(confirmButton).addContainerGap()));

    pack();
}