Example usage for javax.swing GroupLayout createParallelGroup

List of usage examples for javax.swing GroupLayout createParallelGroup

Introduction

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

Prototype

public ParallelGroup createParallelGroup(Alignment alignment) 

Source Link

Document

Creates and returns a ParallelGroup with the specified alignment.

Usage

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("GroupLayout");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = frame.getContentPane();

    GroupLayout groupLayout = new GroupLayout(contentPane);

    contentPane.setLayout(groupLayout);/*from  w  w  w  . jav  a2  s.c om*/

    JLabel label = new JLabel("Label");
    JButton b2 = new JButton("Second Button");

    groupLayout.setHorizontalGroup(groupLayout.createSequentialGroup().addComponent(label).addComponent(b2));

    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
            .addComponent(label).addComponent(b2));

    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("GroupLayout");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = frame.getContentPane();

    GroupLayout groupLayout = new GroupLayout(contentPane);

    contentPane.setLayout(groupLayout);//from  www. ja  v a  2s  . com

    JLabel label = new JLabel("Label");
    JButton b2 = new JButton("Second Button");

    groupLayout.setHorizontalGroup(
            groupLayout.createSequentialGroup().addComponent(label).addGap(5, 10, 50).addComponent(b2));

    groupLayout.setVerticalGroup(groupLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
            .addComponent(label).addComponent(b2));

    frame.pack();
    frame.setVisible(true);
}

From source file:Main.java

public static void main(String[] args) {
    JFrame frame = new JFrame("GroupLayout");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    Container contentPane = frame.getContentPane();

    GroupLayout groupLayout = new GroupLayout(contentPane);
    groupLayout.setAutoCreateGaps(true);
    groupLayout.setAutoCreateContainerGaps(true);
    contentPane.setLayout(groupLayout);/*  w w  w . j av a2 s  .co  m*/

    JButton b1 = new JButton("Button 1");
    JButton b2 = new JButton("Button Second");
    JButton b3 = new JButton("3");
    JButton b4 = new JButton("4");

    groupLayout.setHorizontalGroup(groupLayout.createSequentialGroup()
            .addGroup(groupLayout.createParallelGroup(LEADING).addComponent(b1).addComponent(b3))
            .addGroup(groupLayout.createParallelGroup(TRAILING).addComponent(b2).addComponent(b4)));

    groupLayout.setVerticalGroup(groupLayout.createSequentialGroup()
            .addGroup(groupLayout.createParallelGroup(BASELINE).addComponent(b1).addComponent(b2))
            .addGroup(groupLayout.createParallelGroup(BASELINE).addComponent(b3).addComponent(b4)));

    frame.pack();
    frame.setVisible(true);
}

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:AppPackage.humidity.java

@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">                          
private void initComponents() {

    setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);/*  w  ww  . j  a va 2 s. c  o m*/
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,
            300, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 400,
            Short.MAX_VALUE));

    pack();
}

From source file:pl.piotrsukiennik.jbrain.gui.SimulationHistoryPanel.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./* www  . jav  a  2  s .  c o m*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    simulationHistoryPane = new javax.swing.JTabbedPane();

    setBackground(new java.awt.Color(255, 255, 255));

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(simulationHistoryPane, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(simulationHistoryPane, javax.swing.GroupLayout.DEFAULT_SIZE, 300, Short.MAX_VALUE));
}

From source file:inout.ChartFrame.java

public void initChart(JFreeChart chart) {
    ChartPanel chartPanel = new ChartPanel(chart);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);//  ww  w  .  ja  v a 2 s .  c  om
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGroup(
            javax.swing.GroupLayout.Alignment.TRAILING,
            layout.createSequentialGroup().addComponent(chartPanel)));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup().addComponent(chartPanel)));
}

From source file:inout.ChartFrame.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.//from   www.j  a va  2s .c o  m
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,
            400, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 300,
            Short.MAX_VALUE));

    pack();
}

From source file:com.jtk.pengelolaanujian.view.dashboard.PipePanelSample.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 . jav a 2s.co  m*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
    this.setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,
            323, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 252,
            Short.MAX_VALUE));
}

From source file:GUI_Internalframes.StatistikAnzeige.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.//from w w  w.ja  va  2s  .  c om
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {

    setClosable(true);
    setDefaultCloseOperation(javax.swing.WindowConstants.HIDE_ON_CLOSE);
    setTitle("Statistik");

    javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
    getContentPane().setLayout(layout);
    layout.setHorizontalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0,
            740, Short.MAX_VALUE));
    layout.setVerticalGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING).addGap(0, 408,
            Short.MAX_VALUE));

    pack();
}