Example usage for java.awt GridBagConstraints CENTER

List of usage examples for java.awt GridBagConstraints CENTER

Introduction

In this page you can find the example usage for java.awt GridBagConstraints CENTER.

Prototype

int CENTER

To view the source code for java.awt GridBagConstraints CENTER.

Click Source Link

Document

Put the component in the center of its display area.

Usage

From source file:cool.pandora.modeller.ui.jpanel.text.PatchWordsFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*  w  ww  .  j  av a 2  s  .co m*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("PatchWordsFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Words in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getWordContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.text.PatchAreasFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();//from w w w  .j av  a  2s .  c  om
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("PatchAreasFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Areas in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getAreaContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.text.PatchLinesFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*  w w w  .j a  v  a2s  .c o  m*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("PatchLinesFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Lines in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getLineContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.iiif.CreateDefaultContainersFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();//w w  w .  j  a v  a 2s . c om
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreateContainersFrame.title"));
    titlePane.setMessage(
            new DefaultMessage(bagView.getPropertyMessage("Create the default " + "IIIF Containers")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = IIIFObjectURI.getObjektURI(map);
    try {
        urlField.setText(uri != null ? uri.toString() : null);
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel tagLabel = new JLabel(getMessage("bag.label.hasText"));
    tagLabel.setToolTipText(getMessage("bag.label.hasText.help"));
    hasTextCheckbox = new JCheckBox();
    hasTextCheckbox.setBorder(border);
    hasTextCheckbox.setToolTipText(getMessage("bag.checkbox.hasText.help"));

    hasTextCheckbox.setSelected(bag != null && bag.hasText());
    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(tagLabel, glbc);
    panel.add(tagLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hasTextCheckbox, glbc);
    panel.add(hasTextCheckbox);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.text.CreateLinesFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();// w w w.j  av a  2  s.  c o  m
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreateLinesFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Lines in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getLineContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:cool.pandora.modeller.ui.jpanel.text.CreatePagesFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from w ww . j  a va 2 s . co m*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreatePagesFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Pages in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = TextObjectURI.getPageContainerURI(map);
    try {
        assert uri != null;
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:rhinova.gui.main.view.controller.GISViewController.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner non-commercial license
    createUIComponents();/*www. j a va  2s.  c om*/

    panel2 = new JPanel();
    btnSkipBack = new JButton();
    btnBack = new JButton();
    btnPlay = new JButton();
    btnPause = new JButton();
    btnStop = new JButton();
    btnForward = new JButton();
    btnSkipForward = new JButton();
    panel1 = new JPanel();
    label3 = new JLabel();
    lblTime = new JLabel();
    label11 = new JLabel();
    lblFinalTime = new JLabel();
    label4 = new JLabel();
    lblStage = new JLabel();
    label13 = new JLabel();
    lblInitialPopulation = new JLabel();
    label5 = new JLabel();
    lblPopulation = new JLabel();
    label12 = new JLabel();
    lblFinalPopulation = new JLabel();
    label1 = new JLabel();
    lblSlide = new JLabel();
    label18 = new JLabel();
    lblCapacity = new JLabel();
    label2 = new JLabel();
    lblFinalSlide = new JLabel();

    //======== this ========
    setLayout(null);

    //======== panel2 ========
    {
        panel2.setLayout(null);

        //---- btnSkipBack ----
        btnSkipBack.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/skip_backward.png")));
        btnSkipBack.setBackground(Color.white);
        btnSkipBack.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSkipBackActionPerformed(e);
            }
        });
        panel2.add(btnSkipBack);
        btnSkipBack.setBounds(5, 5, 58, btnSkipBack.getPreferredSize().height);

        //---- btnBack ----
        btnBack.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/back.png")));
        btnBack.setBackground(Color.white);
        btnBack.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnBackActionPerformed(e);
            }
        });
        panel2.add(btnBack);
        btnBack.setBounds(65, 5, 58, btnBack.getPreferredSize().height);

        //---- btnPlay ----
        btnPlay.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/play.png")));
        btnPlay.setBackground(Color.white);
        btnPlay.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnPlayActionPerformed(e);
            }
        });
        panel2.add(btnPlay);
        btnPlay.setBounds(125, 5, 58, btnPlay.getPreferredSize().height);

        //---- btnPause ----
        btnPause.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/pause.png")));
        btnPause.setBackground(Color.white);
        btnPause.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnPauseActionPerformed(e);
            }
        });
        panel2.add(btnPause);
        btnPause.setBounds(185, 5, 58, btnPause.getPreferredSize().height);

        //---- btnStop ----
        btnStop.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/stop.png")));
        btnStop.setBackground(Color.white);
        btnStop.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnStopActionPerformed(e);
            }
        });
        panel2.add(btnStop);
        btnStop.setBounds(245, 5, 58, btnStop.getPreferredSize().height);

        //---- btnForward ----
        btnForward.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/forward.png")));
        btnForward.setBackground(Color.white);
        btnForward.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnForwardActionPerformed(e);
            }
        });
        panel2.add(btnForward);
        btnForward.setBounds(305, 5, 58, btnForward.getPreferredSize().height);

        //---- btnSkipForward ----
        btnSkipForward.setIcon(new ImageIcon(getClass().getResource("/resoursource/icon/skip_forward.png")));
        btnSkipForward.setBackground(Color.white);
        btnSkipForward.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSkipForwardActionPerformed(e);
            }
        });
        panel2.add(btnSkipForward);
        btnSkipForward.setBounds(365, 5, 58, btnSkipForward.getPreferredSize().height);
    }
    add(panel2);
    panel2.setBounds(5, 0, 470, 75);

    //======== panel1 ========
    {
        panel1.setLayout(new GridBagLayout());
        ((GridBagLayout) panel1.getLayout()).columnWidths = new int[] { 82, 113, 92, 130, 0 };
        ((GridBagLayout) panel1.getLayout()).rowHeights = new int[] { 0, 0, 0, 0, 0, 0 };
        ((GridBagLayout) panel1.getLayout()).columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 1.0E-4 };
        ((GridBagLayout) panel1.getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 };

        //---- label3 ----
        label3.setText("Year:");
        panel1.add(label3, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblTime ----
        lblTime.setText("0000000000");
        panel1.add(lblTime, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- label11 ----
        label11.setText("Final Time:");
        panel1.add(label11, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblFinalTime ----
        lblFinalTime.setText("0000000000");
        panel1.add(lblFinalTime, new GridBagConstraints(3, 0, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //---- label4 ----
        label4.setText("Stage:");
        panel1.add(label4, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblStage ----
        lblStage.setText("0000000000");
        panel1.add(lblStage, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- label13 ----
        label13.setText("Initial Population:");
        panel1.add(label13, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblInitialPopulation ----
        lblInitialPopulation.setText("0000000000");
        panel1.add(lblInitialPopulation, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //---- label5 ----
        label5.setText("Population:");
        panel1.add(label5, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblPopulation ----
        lblPopulation.setText("0000000000");
        panel1.add(lblPopulation, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- label12 ----
        label12.setText("Final Population:");
        panel1.add(label12, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblFinalPopulation ----
        lblFinalPopulation.setText("0000000000");
        panel1.add(lblFinalPopulation, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //---- label1 ----
        label1.setText("Slide");
        panel1.add(label1, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblSlide ----
        lblSlide.setText("0.0");
        panel1.add(lblSlide, new GridBagConstraints(1, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));

        //---- label18 ----
        label18.setText("Capacity:");
        panel1.add(label18, new GridBagConstraints(2, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));

        //---- lblCapacity ----
        lblCapacity.setText("0000000000");
        panel1.add(lblCapacity, new GridBagConstraints(3, 3, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 0), 0, 0));

        //---- label2 ----
        label2.setText("No Pictures");
        panel1.add(label2, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, new Insets(0, 0, 0, 5), 0, 0));

        //---- lblFinalSlide ----
        lblFinalSlide.setText("0.0");
        panel1.add(lblFinalSlide, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                GridBagConstraints.VERTICAL, new Insets(0, 0, 0, 5), 0, 0));
    }
    add(panel1);
    panel1.setBounds(10, 75, 420, 105);

    { // compute preferred size
        Dimension preferredSize = new Dimension();
        for (int i = 0; i < getComponentCount(); i++) {
            Rectangle bounds = getComponent(i).getBounds();
            preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
            preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
        }
        Insets insets = getInsets();
        preferredSize.width += insets.right;
        preferredSize.height += insets.bottom;
        setMinimumSize(preferredSize);
        setPreferredSize(preferredSize);
    }

    //---- bindings ----
    bindingGroup = new BindingGroup();
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("year"), lblTime, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("stage"), lblStage, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("population"), lblPopulation, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("finalPopulation"), lblFinalTime, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("initialPopulation"), lblInitialPopulation, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("finalPopulation"), lblFinalPopulation, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("capacity"), lblCapacity, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("noPictures"), lblFinalSlide, BeanProperty.create("text")));
    bindingGroup.addBinding(Bindings.createAutoBinding(UpdateStrategy.READ, abstractMovie1,
            BeanProperty.create("currentPictureIndex"), lblSlide, BeanProperty.create("text")));
    bindingGroup.bind();
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:cool.pandora.modeller.ui.jpanel.text.CreateWordsFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from  w  w w . j  a v  a 2  s .c  o m*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreateWordsFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Words in:")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = CreateWordsHandler.getWordContainerURI(map);
    try {
        urlField.setText(uri.toString());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel hocrResourceLabel = new JLabel(bagView.getPropertyMessage("hocrResource" + ".label"));
    hocrResourceLabel.setToolTipText(bagView.getPropertyMessage("hocrResource.description"));
    hocrResourceField = new JTextField("");
    final String hocrResource = TextObjectURI.gethOCRResourceURI(map);
    try {
        hocrResourceField.setText(hocrResource);
    } catch (Exception e) {
        log.error("Failed to set hocrResource label", e);
    }

    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(hocrResourceLabel, glbc);
    panel.add(hocrResourceLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hocrResourceField, glbc);
    panel.add(hocrResourceField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:be.vds.jtbdive.client.view.core.dive.profile.DiveProfileGraphicDetailPanel.java

private Component createImportExportButtons() {
    JPanel p = new JPanel(new GridBagLayout());
    p.setOpaque(false);//from   www  . j a va 2s  .  c o m

    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(5, 5, 5, 5);

    GridBagLayoutManager.addComponent(p, createImportButton(), c, 0, 0, 1, 1, 0.5, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    GridBagLayoutManager.addComponent(p, createExportButton(), c, 1, 0, 1, 1, 0.5, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    return p;
}

From source file:yp.tibco.com.yang.lottery.client.GraphicalLotteryClient.java

private void initComponents() {
    JLabel jLabel1 = new JLabel();
    jTextFieldHost = new JTextField();
    jButtonConnect = new JButton();
    JLabel jLabel3 = new JLabel();
    jSpinnerWidth = new JSpinner();
    JLabel label5 = new JLabel();
    jSpinnerChars = new JSpinner();
    checkBoxContinuous = new JCheckBox();
    JLabel jLabel2 = new JLabel();
    jTextFieldPort = new JTextField();
    jButtonDisconnect = new JButton();
    JLabel jLabel4 = new JLabel();
    jSpinnerHeight = new JSpinner();
    jButtonSendRequest = new JButton();
    imagePanel1 = new LotteryPanel();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setMinimumSize(new Dimension(700, 300));
    setPreferredSize(new Dimension(740, 600));
    Container contentPane = getContentPane();
    contentPane.setLayout(new GridBagLayout());
    ((GridBagLayout) contentPane.getLayout()).columnWidths = new int[] { 36, 167, 99, 41, 66, 75, 57, 96, 0,
            0 };/*from w ww.ja va2  s. c o  m*/
    ((GridBagLayout) contentPane.getLayout()).rowHeights = new int[] { 10, 31, 31, 256, 0 };
    ((GridBagLayout) contentPane.getLayout()).columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 1.0, 1.0E-4 };
    ((GridBagLayout) contentPane.getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 1.0E-4 };

    //---- jLabel1 ----
    jLabel1.setText("Host");
    contentPane.add(jLabel1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
    contentPane.add(jTextFieldHost, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jButtonConnect ----
    jButtonConnect.setText("Connect");
    jButtonConnect.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jButtonConnectActionPerformed();
        }
    });
    contentPane.add(jButtonConnect, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jLabel3 ----
    jLabel3.setText("Width");
    contentPane.add(jLabel3, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
    contentPane.add(jSpinnerWidth, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- label5 ----
    label5.setText("characters");
    contentPane.add(label5, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
            GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));
    contentPane.add(jSpinnerChars, new GridBagConstraints(6, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 10), 0, 0));

    //---- checkBoxContinuous ----
    checkBoxContinuous.setText("continuous");
    contentPane.add(checkBoxContinuous, new GridBagConstraints(7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jLabel2 ----
    jLabel2.setText("Port");
    contentPane.add(jLabel2, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
    contentPane.add(jTextFieldPort, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jButtonDisconnect ----
    jButtonDisconnect.setText("Disconnect");
    jButtonDisconnect.setEnabled(false);
    jButtonDisconnect.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jButtonDisconnectActionPerformed();
        }
    });
    contentPane.add(jButtonDisconnect, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jLabel4 ----
    jLabel4.setText("Height");
    contentPane.add(jLabel4, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
    contentPane.add(jSpinnerHeight, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jButtonSendRequest ----
    jButtonSendRequest.setText("Send Request");
    jButtonSendRequest.setEnabled(false);
    jButtonSendRequest.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jButtonSendRequestActionPerformed();
        }
    });
    contentPane.add(jButtonSendRequest, new GridBagConstraints(5, 2, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //======== imagePanel1 ========
    {
        imagePanel1.setBackground(new Color(51, 153, 255));
        imagePanel1.setPreferredSize(new Dimension(500, 500));

        { // compute preferred size
            Dimension preferredSize = new Dimension();
            for (int i = 0; i < imagePanel1.getComponentCount(); i++) {
                Rectangle bounds = imagePanel1.getComponent(i).getBounds();
                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
            }
            Insets insets = imagePanel1.getInsets();
            preferredSize.width += insets.right;
            preferredSize.height += insets.bottom;
            imagePanel1.setMinimumSize(preferredSize);
            imagePanel1.setPreferredSize(preferredSize);
        }
    }
    contentPane.add(imagePanel1, new GridBagConstraints(0, 3, 9, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(8, 5, 8, 5), 0, 0));
    pack();
    setLocationRelativeTo(getOwner());
}