Example usage for java.awt GridBagConstraints GridBagConstraints

List of usage examples for java.awt GridBagConstraints GridBagConstraints

Introduction

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

Prototype

public GridBagConstraints() 

Source Link

Document

Creates a GridBagConstraint object with all of its fields set to their default value.

Usage

From source file:endrov.frameTime.FrameTimeWindow.java

/**
 * Regenerate UI/* w w w .  j  a va2  s  .co m*/
 */
public void fillDatapart() {
    datapart.removeAll();
    datapart.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.gridx = 0;
    datapart.add(new JLabel("Frame"), c);
    c.gridx = 1;
    datapart.add(new JLabel("Time"), c);
    for (int i = 0; i < inputVector.size(); i++) {
        c.gridy++;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 1;
        c.gridx = 0;
        datapart.add(inputVector.get(i).frame, c);
        c.gridx = 1;
        datapart.add(inputVector.get(i).time, c);
        c.gridx = 2;
        c.fill = 0;
        c.weightx = 0;
        datapart.add(inputVector.get(i).bDelete, c);
    }
    setVisibleEvWindow(true);
}

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

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

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();//  w ww  .  ja v  a2s  . c  o m
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("UploadBagFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Upload Resources " + "to:")));
    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.getResourceContainerURI(map);
    try {
        urlField.setText(uri != null ? uri.toString() : null);
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }
    urlField.setEnabled(false);

    //only if bag is not null
    if (bag != null) {
        urlLabel.setEnabled(true);
    }

    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);
    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:com.marginallyclever.makelangelo.MainGUI.java

public void chooseLanguage() {
    final JDialog driver = new JDialog(mainframe, "Language", true);
    driver.setLayout(new GridBagLayout());

    final String[] choices = translator.getLanguageList();
    final JComboBox<String> language_options = new JComboBox<String>(choices);
    final JButton save = new JButton(">>>");

    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.WEST;
    c.gridwidth = 2;//from   w  w  w. j a  v a 2s.  c om
    c.gridx = 0;
    c.gridy = 0;
    driver.add(language_options, c);
    c.anchor = GridBagConstraints.EAST;
    c.gridwidth = 1;
    c.gridx = 2;
    c.gridy = 0;
    driver.add(save, c);

    ActionListener driveButtons = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Object subject = e.getSource();
            // TODO prevent "close" icon.  Must press save to continue!
            if (subject == save) {
                translator.currentLanguage = choices[language_options.getSelectedIndex()];
                translator.saveConfig();
                driver.dispose();
            }
        }
    };

    save.addActionListener(driveButtons);

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

From source file:com.apatar.ui.JPublishToApatarDialog.java

private void createDialog() {

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    this.setLayout(gridbag);

    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;//  w ww.  ja  va2 s.c o m
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    //c.insets = new Insets(5, 5, 5, 5);

    JPanel panelLogin = new JPanel();
    panelLogin.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelLogin.setLayout(new BoxLayout(panelLogin, BoxLayout.X_AXIS));
    panelLogin.add(new JLabel("User Name"));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(username);
    username.setComponentPopupMenu(new JDefaultContextMenu(username));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(new JLabel("Password"));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(password);

    JPanel panelForgotPassLink = new JPanel();
    panelForgotPassLink.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelForgotPassLink.setLayout(new BoxLayout(panelForgotPassLink, BoxLayout.X_AXIS));
    panelForgotPassLink.add(new JLabel("Lost your password? "));
    panelForgotPassLink.add(Box.createHorizontalStrut(5));
    panelForgotPassLink.add(forgotPassLinkLabel);

    forgotPassLinkLabel.setFont(UiUtils.NORMAL_SIZE_12_FONT);
    forgotPassLinkLabel.addMouseListener(new MouseHyperLinkEvent());
    forgotPassLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    forgotPassLinkLabel.setText(
            "<html><a href='http://www.apatarforge.org/profile/lostpassword.html'>Click here to retrieve it</a></html>");

    JPanel panelFile = new JPanel();
    panelFile.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelFile.setLayout(new BoxLayout(panelFile, BoxLayout.X_AXIS));
    panelFile.add(selectFromFile);
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(new JLabel("New File "));
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(nameFile);
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(browse);
    nameFile.setEnabled(false);
    nameFile.setComponentPopupMenu(new JDefaultContextMenu(nameFile));
    browse.setEnabled(false);

    JPanel panelLocation = new JPanel();
    panelLocation.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelLocation.setLayout(new BoxLayout(panelLocation, BoxLayout.X_AXIS));
    panelLocation.add(new JLabel("Suggest Location:"));
    panelLocation.add(Box.createHorizontalStrut(5));
    panelLocation.add(location);

    JPanel panelDMName = new JPanel();
    panelDMName.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMName.setLayout(new BoxLayout(panelDMName, BoxLayout.X_AXIS));
    JLabel datamapNameLabel = new JLabel("DataMap Name:");
    datamapNameLabel.setBorder(new EmptyBorder(0, 0, 0, 10));
    panelDMName.add(datamapNameLabel);
    panelDMName.add(Box.createHorizontalStrut(5));
    panelDMName.add(dataMapName);
    dataMapName.setComponentPopupMenu(new JDefaultContextMenu(dataMapName));

    JPanel panelDMDescription = new JPanel();
    panelDMDescription.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMDescription.setLayout(new BoxLayout(panelDMDescription, BoxLayout.X_AXIS));
    panelDMDescription.add(new JLabel("DataMap Description (16000 Chars)"));
    panelDMDescription.add(Box.createHorizontalStrut(5));
    //JScrollPane scroll = new JScrollPane(dataMapDescription);
    //scroll.setSize(300, 50);
    dataMapDescription.setLineWrap(true);
    dataMapDescription.setWrapStyleWord(true);
    panelDMDescription.add(new JScrollPane(dataMapDescription));

    JPanel panelDMShortDescription = new JPanel();
    panelDMShortDescription.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMShortDescription.setLayout(new BoxLayout(panelDMShortDescription, BoxLayout.X_AXIS));
    JLabel labelShort = new JLabel("Short Description:");
    labelShort.setBorder(new EmptyBorder(0, 0, 0, 85));
    panelDMShortDescription.add(labelShort);
    panelDMShortDescription.add(Box.createHorizontalStrut(5));
    shortDescription.setLineWrap(true);
    shortDescription.setWrapStyleWord(true);
    panelDMShortDescription.add(new JScrollPane(shortDescription));
    setEnableShortDescription(false);

    // -------------

    JPanel panelTitleForTags = new JPanel();
    panelTitleForTags.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelTitleForTags.setLayout(new BoxLayout(panelTitleForTags, BoxLayout.X_AXIS));
    panelTitleForTags.add(new JLabel("Add tags associated with your DataMap:"));

    // -------------

    JPanel panelListAddedTags = new JPanel();
    panelListAddedTags.setBorder(new EmptyBorder(0, 10, 10, 10));
    panelListAddedTags.setLayout(new BoxLayout(panelListAddedTags, BoxLayout.X_AXIS));

    // --
    JPanel panelFrom = new JPanel();
    panelFrom.setLayout(new BoxLayout(panelFrom, BoxLayout.Y_AXIS));
    JPanel panelMiddle = new JPanel();
    panelMiddle.setLayout(new BoxLayout(panelMiddle, BoxLayout.X_AXIS));
    JPanel panelTo = new JPanel();
    panelTo.setLayout(new BoxLayout(panelTo, BoxLayout.Y_AXIS));

    // --
    JPanel panelAddNewTag = new JPanel();
    panelAddNewTag.setLayout(new BoxLayout(panelAddNewTag, BoxLayout.X_AXIS));
    panelAddNewTag.add(new JLabel("Add new tag:"));
    panelAddNewTag.add(Box.createHorizontalStrut(5));
    textfieldAddNewTag = new JTextField();
    textfieldAddNewTag.setComponentPopupMenu(new JDefaultContextMenu(textfieldAddNewTag));
    panelAddNewTag.add(textfieldAddNewTag);
    panelAddNewTag.add(Box.createHorizontalStrut(5));
    JButton buttonAddTag = new JButton("Add");
    buttonAddTag.addActionListener(addNewTagMouseListener);
    panelAddNewTag.add(buttonAddTag);

    // --
    JPanel panelDeleteTags = new JPanel();
    panelDeleteTags.setLayout(new BoxLayout(panelDeleteTags, BoxLayout.X_AXIS));

    panelDeleteTags.add(new JLabel("Delete selected tag(s):"));
    panelDeleteTags.add(Box.createHorizontalStrut(5));
    JButton buttonDeleteTag = new JButton("Delete");
    buttonDeleteTag.addActionListener(deleteTagMouseListener);
    panelDeleteTags.add(buttonDeleteTag);
    panelDeleteTags.add(new JPanel());

    // --

    JButton moveTag = new JButton(UiUtils.ARROW_ICON);
    moveTag.addActionListener(addTagsMouseListener);
    panelMiddle.add(moveTag);

    tblModelFrom = new DefaultTableModel();
    tblModelTo = new DefaultTableModel();
    tblModelFrom.addColumn("Tag Name");
    tblModelTo.addColumn("Tag Name");

    tagsTableFrom = new JTable(tblModelFrom);
    tagsTableTo = new JTable(tblModelTo);

    tagsTableFrom.setOpaque(false);
    tagsTableFrom.setBackground(null);
    tagsTableFrom.setBorder(null);
    tagsTableFrom.setShowGrid(false);

    tagsTableTo.setOpaque(false);
    tagsTableTo.setBackground(null);
    tagsTableTo.setBorder(null);
    tagsTableTo.setShowGrid(false);

    tagsTableFrom.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField()));
    tagsTableTo.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField()));

    fillTableTags();

    tagsTableFrom.setComponentPopupMenu(new JDefaultContextMenu(tagsTableFrom));
    tagsTableTo.setComponentPopupMenu(new JDefaultContextMenu(tagsTableTo));

    JScrollPane srollPane = new JScrollPane(tagsTableFrom);
    srollPane.setBorder(null);

    JScrollPane srollPane2 = new JScrollPane(tagsTableTo);
    srollPane.setBorder(null);

    panelFrom.add(srollPane);
    panelFrom.add(Box.createVerticalStrut(5));
    panelFrom.add(panelAddNewTag);

    panelTo.add(srollPane2);
    panelTo.add(Box.createVerticalStrut(5));
    panelTo.add(panelDeleteTags);

    panelListAddedTags.add(panelFrom);
    panelListAddedTags.add(Box.createHorizontalStrut(5));
    panelListAddedTags.add(panelMiddle);
    panelListAddedTags.add(Box.createHorizontalStrut(5));
    panelListAddedTags.add(panelTo);

    // -------

    JPanel panelButton = new JPanel();
    panelButton.setLayout(new BoxLayout(panelButton, BoxLayout.X_AXIS));
    panelButton.add(Box.createHorizontalGlue());
    panelButton.add(bOk);
    panelButton.add(Box.createHorizontalStrut(5));
    panelButton.add(bCancel);
    panelButton.add(Box.createHorizontalStrut(5));

    ComponentBuilder.makeComponent(new JCommentPanel(), gridbag, c, getContentPane());

    ComponentBuilder.makeComponent(panelLogin, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelForgotPassLink, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelFile, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelLocation, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelDMName, gridbag, c, getContentPane());

    c.fill = GridBagConstraints.BOTH;

    c.weighty = 2.0;
    ComponentBuilder.makeComponent(panelDMDescription, gridbag, c, getContentPane());

    c.weighty = 0.0;
    ComponentBuilder.makeComponent(autoGenerateShortDescription, gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelDMShortDescription, gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelTitleForTags, gridbag, c, getContentPane());

    c.weighty = 3.0;
    ComponentBuilder.makeComponent(panelListAddedTags, gridbag, c, getContentPane());

    c.weighty = 0.0;
    ComponentBuilder.makeComponent(new JSeparator(), gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelButton, gridbag, c, getContentPane());
}

From source file:org.keyboardplaying.xtt.ui.UIController.java

/** Builds and shows the settings window. */
public void showSettingsWindow() {
    /* Create UI. */
    JPanel pane = new JPanel(new GridBagLayout());

    /* Arrange the components */
    GridBagConstraints c;/* www.  ja va 2  s. c  om*/

    // project directory (text)
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.BOTH;
    pane.add(new ProjectTextFieldChooser(location), c);

    // project directory (button)
    c = new GridBagConstraints();
    c.gridx = 2;
    c.gridy = 0;
    c.fill = GridBagConstraints.BOTH;
    pane.add(new ProjectButtonChooser(images, i18n, location), c);

    // Locale (icon)
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 1;
    c.fill = GridBagConstraints.BOTH;
    pane.add(new JLabel(new ImageIcon(images.getImage("image-prefs-locale", ImageSize.W_16))), c);

    // Locale (combo)
    c = new GridBagConstraints();
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.BOTH;
    pane.add(new LocaleComboBox(i18n), c);

    // Clear preferences
    c = new GridBagConstraints();
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = 3;
    c.fill = GridBagConstraints.BOTH;
    pane.add(makeActionButton("action.prefs.clear", "action-clear-prefs", ImageSize.W_16, clearPrefsAction), c);

    makeWindow("app.settings", "icon-settings", pane).setVisible(true);
}

From source file:org.gvsig.remotesensing.profiles.gui.LineProfileOptionsPanel.java

/**
 * @return panel con los controles para agregar o eliminar perfiles y combo
 * para seleccin de banda//from ww  w. jav  a2  s  .com
 * */
public JPanel getControlPanel() {
    if (controlPanel == null) {
        controlPanel = new JPanel();
        GridBagLayout gb = new GridBagLayout();
        controlPanel.setLayout(gb);
        GridBagConstraints constrains = new GridBagConstraints();
        constrains.insets = new java.awt.Insets(1, 5, 1, 1);
        constrains.gridx = 0;
        constrains.gridy = 0;
        controlPanel.add(getNewButton(), constrains);
        constrains.insets = new java.awt.Insets(1, 5, 1, 1);
        constrains.gridx = 0;
        constrains.gridy = 1;
        controlPanel.add(getDeleteButton(), constrains);
        constrains.insets = new java.awt.Insets(1, 5, 1, 1);
        constrains.gridx = 0;
        constrains.gridy = 2;
        controlPanel.add(getComboBands(), constrains);
    }
    return controlPanel;
}

From source file:ca.uhn.hl7v2.testpanel.ui.conn.Hl7ConnectionPanelHeader.java

/**
 * Create the panel./* w ww  . j a  v a 2 s. com*/
 */
public Hl7ConnectionPanelHeader() {
    setBorder(new TitledBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null), "Outbound Message Sender",
            TitledBorder.CENTER, TitledBorder.TOP, null, new Color(0, 0, 0)));
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.columnWidths = new int[] { 138, 0 };
    gridBagLayout.rowHeights = new int[] { 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0 };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
    setLayout(gridBagLayout);

    myNameBox = new JTextField();
    myNameBox.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent theE) {
            myIgnoreNameChanges = true;
            try {
                myConnection.setNameExplicitly(myNameBox.getText());
            } finally {
                myIgnoreNameChanges = false;
            }
        }
    });

    myRememberAsCheckBox = new JCheckBox("Save With Name:");
    myRememberAsCheckBox
            .setToolTipText("If checked, this connection will be saved for the next time you start TestPanel");
    myRememberAsCheckBox.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myConnection.setPersistent(myRememberAsCheckBox.isSelected());
            updateRememberAsUi();
        }
    });
    GridBagConstraints gbc_RememberAsCheckBox = new GridBagConstraints();
    gbc_RememberAsCheckBox.insets = new Insets(0, 0, 5, 5);
    gbc_RememberAsCheckBox.gridx = 0;
    gbc_RememberAsCheckBox.gridy = 0;
    add(myRememberAsCheckBox, gbc_RememberAsCheckBox);
    GridBagConstraints gbc_NameBox = new GridBagConstraints();
    gbc_NameBox.insets = new Insets(0, 0, 5, 0);
    gbc_NameBox.fill = GridBagConstraints.HORIZONTAL;
    gbc_NameBox.gridx = 1;
    gbc_NameBox.gridy = 0;
    add(myNameBox, gbc_NameBox);
    myNameBox.setColumns(10);

    JPanel panel_5 = new JPanel();
    GridBagConstraints gbc_panel_5 = new GridBagConstraints();
    gbc_panel_5.anchor = GridBagConstraints.WEST;
    gbc_panel_5.fill = GridBagConstraints.VERTICAL;
    gbc_panel_5.gridx = 1;
    gbc_panel_5.gridy = 1;
    add(panel_5, gbc_panel_5);

    myStartButton = new JButton("Start");
    myStartButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myConnection.start();
        }
    });
    panel_5.add(myStartButton);

    myStopButton = new JButton("Stop");
    myStopButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            myConnection.stop();
        }
    });
    panel_5.add(myStopButton);

    myStatusLabel = new JLabel("New label");
    panel_5.add(myStatusLabel);

}

From source file:cool.pandora.modeller.ui.jpanel.iiif.CreateSequencesFrame.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 2 s. c om*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreateSequencesFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create Sequence 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 = IIIFObjectURI.getSequenceContainerURI(map);
    try {
        urlField.setText(uri != null ? uri.toString() : null);
    } catch (final Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel sequenceIDLabel = new JLabel(bagView.getPropertyMessage("sequenceID.label"));
    sequenceIDLabel.setToolTipText(bagView.getPropertyMessage("sequenceID.description"));
    sequenceIDField = new JTextField("normal");
    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(sequenceIDLabel, glbc);
    panel.add(sequenceIDLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(sequenceIDField, glbc);
    panel.add(sequenceIDField);
    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:com.vgi.mafscaling.LogPlay.java

private void createSelectionPanel(JPanel panel) {
    JPanel selectionPanel = new JPanel();
    GridBagLayout gbl_selectionPanel = new GridBagLayout();
    gbl_selectionPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0 };
    gbl_selectionPanel.rowHeights = new int[] { 0 };
    gbl_selectionPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0 };
    gbl_selectionPanel.rowWeights = new double[] { 0.0 };
    selectionPanel.setLayout(gbl_selectionPanel);

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = insets3;//from ww  w  .  j  a  va2s.co  m
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 0;
    gbc.gridy = 0;

    selectionPanel.add(new JLabel("X-Axis"), gbc);

    gbc.gridx++;
    xAxisColumn = new JComboBox<String>();
    selectionPanel.add(xAxisColumn, gbc);

    gbc.gridx++;
    selectionPanel.add(new JLabel("Y-Axis"), gbc);

    gbc.gridx++;
    yAxisColumn = new JComboBox<String>();
    selectionPanel.add(yAxisColumn, gbc);

    gbc.gridx++;
    selectionPanel.add(new JLabel("Data*"), gbc);

    gbc.gridx++;
    zAxisColumn = new JComboBox<String>();
    selectionPanel.add(zAxisColumn, gbc);

    gbc.gridx++;
    gbc.weightx = 1.0;
    newPlayButton = new JButton("New Play Table");
    newPlayButton.addActionListener(this);
    selectionPanel.add(newPlayButton, gbc);

    xAxisColumn.addItem("");
    yAxisColumn.addItem("");
    zAxisColumn.addItem("Optional");
    for (int i = 0; i < logDataTable.getColumnCount(); ++i) {
        String colName = logDataTable.getColumn(i).getHeaderValue().toString();
        xAxisColumn.addItem(colName);
        yAxisColumn.addItem(colName);
        zAxisColumn.addItem(colName);
    }
    zAxisColumn.setSelectedIndex(0);

    gbc.insets = insets0;
    gbc.gridx = 0;
    gbc.anchor = GridBagConstraints.PAGE_START;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    panel.add(selectionPanel, gbc);
}

From source file:com.sec.ose.osi.ui.frm.main.report.JPanExportReport.java

private JPanel getJPanelDocumentExportInfo() {
    if (jPanelDocumentExportInfo == null) {
        jPanelDocumentExportInfo = new JPanel();
        jPanelDocumentExportInfo.setLayout(new GridBagLayout());

        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.fill = GridBagConstraints.BOTH;
        gridBagConstraints1.gridx = 0;//from  ww  w  .  j a  v a2  s.c o m
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.weightx = 1.0;
        gridBagConstraints1.insets = new Insets(0, 5, 0, 5);
        jPanelDocumentExportInfo.add(getJTextFieldReportLocation(), gridBagConstraints1);

        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 1;
        gridBagConstraints2.gridy = 0;
        jPanelDocumentExportInfo.add(getJButtonCreateExplorer(), gridBagConstraints2);
    }
    return jPanelDocumentExportInfo;
}