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:org.eurocarbdb.application.glycoworkbench.plugin.s3.gui.SignedGetUrlDialog.java

public SignedGetUrlDialog(Frame ownerFrame, HyperlinkActivatedListener hyperlinkListener, S3Service s3Service,
        S3Object[] objects) {/*from   w  w w  .  j a  v  a2  s  . co  m*/
    super(ownerFrame, "Generate Signed GET URLs", true);
    this.ownerFrame = ownerFrame;
    this.hyperlinkListener = hyperlinkListener;
    this.s3Service = s3Service;
    this.objects = objects;

    String introductionText = "<html><center>Generate signed GET URLs that you can provide to anyone<br>"
            + "who needs to access objects in your bucket for a limited time.</center></html>";
    JHtmlLabel introductionLabel = new JHtmlLabel(introductionText, hyperlinkListener);
    introductionLabel.setHorizontalAlignment(JLabel.CENTER);
    JHtmlLabel expiryTimeLabel = new JHtmlLabel("<html><b>Expiry Time</b> (Hours)</html>", hyperlinkListener);
    expiryTimeLabel.setHorizontalAlignment(JLabel.RIGHT);
    JHtmlLabel httpsUrlsLabel = new JHtmlLabel("<html><b>Secure HTTPS URLs?</b></html>", hyperlinkListener);
    httpsUrlsLabel.setHorizontalAlignment(JLabel.RIGHT);
    JHtmlLabel virtualHostLabel = new JHtmlLabel("<html><b>Bucket is a Virtual Host?</b></html>",
            hyperlinkListener);
    virtualHostLabel.setHorizontalAlignment(JLabel.RIGHT);
    JHtmlLabel requesterPaysLabel = new JHtmlLabel("<html><b>Bucket is Requester Pays?</b></html>",
            hyperlinkListener);
    requesterPaysLabel.setHorizontalAlignment(JLabel.RIGHT);

    expiryTimeTextField = new JTextField("1.0");
    expiryTimeTextField.setToolTipText("How long in hours until the URL will expire");
    expiryTimeTextField.getDocument().addDocumentListener(this);

    httpsUrlsCheckBox = new JCheckBox();
    httpsUrlsCheckBox.setSelected(false);
    httpsUrlsCheckBox.setToolTipText("Check this box to generate secure HTTPS URLs.");
    httpsUrlsCheckBox.addActionListener(this);

    virtualHostCheckBox = new JCheckBox();
    virtualHostCheckBox.setSelected(false);
    virtualHostCheckBox.setToolTipText("Check this box if your bucket is configured as a virtual host.");
    virtualHostCheckBox.addActionListener(this);

    requesterPaysCheckBox = new JCheckBox();
    requesterPaysCheckBox.setSelected(false);
    requesterPaysCheckBox.setToolTipText("Check this box if the bucket has Requester Pays enabled.");
    requesterPaysCheckBox.addActionListener(this);

    finishedButton = new JButton("Finished");
    finishedButton.setActionCommand("Finished");
    finishedButton.addActionListener(this);

    signedUrlsTextArea = new JTextArea();
    signedUrlsTextArea.setEditable(false);

    // Set default ENTER and ESCAPE buttons.
    this.getRootPane().setDefaultButton(finishedButton);
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),
            "ESCAPE");
    this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() {
        private static final long serialVersionUID = -6225706489569112809L;

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    });

    JPanel panel = new JPanel(new GridBagLayout());
    int row = 0;
    panel.add(introductionLabel, new GridBagConstraints(0, row, 6, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(expiryTimeLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(expiryTimeTextField, new GridBagConstraints(1, row, 5, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(httpsUrlsLabel, new GridBagConstraints(0, ++row, 1, 1, 0.3, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(httpsUrlsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    panel.add(virtualHostLabel, new GridBagConstraints(2, row, 1, 1, 0.3, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(virtualHostCheckBox, new GridBagConstraints(3, row, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    panel.add(requesterPaysLabel, new GridBagConstraints(4, row, 1, 1, 0.3, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(requesterPaysCheckBox, new GridBagConstraints(5, row, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    panel.add(new JScrollPane(signedUrlsTextArea), new GridBagConstraints(0, ++row, 6, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0));
    panel.add(finishedButton, new GridBagConstraints(0, ++row, 6, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    this.getContentPane().setLayout(new GridBagLayout());
    this.getContentPane().add(panel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    this.setSize(700, 450);
    this.setResizable(true);
    this.setLocationRelativeTo(ownerFrame);

    generateSignedUrls();
}

From source file:me.childintime.childintime.ui.window.tool.BmiToolDialog.java

/**
 * Build the UI./*from  ww w  .j  a  v a 2s. c o  m*/
 */
private void buildUi() {
    // Set the layout
    setLayout(new BorderLayout());

    // Create a grid bag constraints configuration
    GridBagConstraints c = new GridBagConstraints();

    // Create the container and body state panel
    final JPanel container = new JPanel(new GridBagLayout());
    container.setBorder(BorderFactory.createEmptyBorder(16, 16, 16, 16));

    // Add the close button
    c.fill = GridBagConstraints.NONE;
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 0;
    c.weighty = 0;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 0, 0, 0);
    container.add(new JLabel("Select a student to see their details."), c);

    // Add the body state panel to the container
    c.fill = GridBagConstraints.BOTH;
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 1;
    c.weighty = 1;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new Insets(16, 0, 0, 0);
    container.add(buildUiBodyStatePanel(), c);

    // Create the close button
    final JButton closeButton = new JButton("Close");
    closeButton.addActionListener(e -> dispose());

    // Add the close button
    c.fill = GridBagConstraints.NONE;
    c.gridx = 0;
    c.gridy = 2;
    c.weightx = 0;
    c.weighty = 0;
    c.anchor = GridBagConstraints.EAST;
    c.insets = new Insets(8, 0, 0, 0);
    container.add(closeButton, c);

    // Add the container
    add(container, BorderLayout.CENTER);
}

From source file:gov.loc.repository.bagger.ui.NewBagFrame.java

private void layoutProfileSelection(JPanel contentPane, int row) {
    // content/*ww  w . j a v a 2 s .  co m*/
    // profile selection
    JLabel bagProfileLabel = new JLabel(bagView.getPropertyMessage("Select Profile:"));
    bagProfileLabel.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help"));

    profileList = new JComboBox(bagView.getProfileStore().getProfileNames());
    profileList.setName(bagView.getPropertyMessage("bag.label.projectlist"));
    profileList.setSelectedItem(bagView.getPropertyMessage("bag.project.noproject"));
    profileList.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help"));

    GridBagConstraints glbc = new GridBagConstraints();

    JLabel spacerLabel = new JLabel();
    glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.WEST);
    contentPane.add(bagProfileLabel, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.CENTER);
    contentPane.add(profileList, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE,
            GridBagConstraints.EAST);
    contentPane.add(spacerLabel, glbc);
}

From source file:com.sec.ose.osi.ui.frm.main.manage.dialog.JDlgProjectCreate.java

/**
 * This method initializes jPanelPjtName   
 *    /*from  w  w  w  . j  a v  a 2 s .co  m*/
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelPjtName() {
    if (jPanelPjtName == null) {
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.insets = new Insets(10, 10, 0, 0);
        gridBagConstraints.ipadx = 4;
        gridBagConstraints.gridy = 0;
        jLabelNewProjectName = new JLabel();
        jLabelNewProjectName.setText("New Project Name :");
        GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
        gridBagConstraints7.anchor = GridBagConstraints.CENTER;
        gridBagConstraints7.insets = new Insets(10, 10, 10, 0);
        gridBagConstraints7.gridwidth = 1;
        gridBagConstraints7.gridx = 1;
        gridBagConstraints7.gridy = 1;
        gridBagConstraints7.weightx = 0.1;
        gridBagConstraints7.fill = GridBagConstraints.HORIZONTAL;
        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        gridBagConstraints6.anchor = GridBagConstraints.EAST;
        gridBagConstraints6.gridx = 0;
        gridBagConstraints6.gridy = 1;
        gridBagConstraints6.ipadx = 0;
        gridBagConstraints6.insets = new Insets(10, 10, 10, 0);
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 2;
        gridBagConstraints2.insets = new Insets(10, 10, 0, 10);
        gridBagConstraints2.fill = GridBagConstraints.NONE;
        gridBagConstraints2.gridy = 0;
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.fill = GridBagConstraints.BOTH;
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.weightx = 0.1;
        gridBagConstraints1.gridwidth = 1;
        gridBagConstraints1.insets = new Insets(10, 10, 0, 0);
        gridBagConstraints1.gridx = 1;
        jPanelPjtName = new JPanel();
        jPanelPjtName.setLayout(new GridBagLayout());
        jPanelPjtName.setPreferredSize(new Dimension(500, 200));
        jPanelPjtName.setBorder(BorderFactory.createTitledBorder(null, "Project Name",
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelPjtName.add(getJTextFieldNewProjectName(), gridBagConstraints1);
        jPanelPjtName.add(getJButtonCheck(), gridBagConstraints2);
        jPanelPjtName.add(getJCheckBoxClonedFrom(), gridBagConstraints6);
        jPanelPjtName.add(getJComboBoxClonedFrom(), gridBagConstraints7);
        jPanelPjtName.add(jLabelNewProjectName, gridBagConstraints);
    }
    return jPanelPjtName;
}

From source file:com.rapidminer.gui.new_plotter.gui.dialog.AddParallelLineDialog.java

/**
 * Setup the GUI./* w  w  w. j  a  v  a 2 s .  c o m*/
 */
private void setupGUI() {
    JPanel mainPanel = new JPanel();
    this.setContentPane(mainPanel);

    // start layout
    mainPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 5, 2, 5);
    horizontalLineRadiobutton = new JRadioButton(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.horizontal.label"));
    horizontalLineRadiobutton.setToolTipText(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.horizontal.tip"));
    horizontalLineRadiobutton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            setHorizontalLineSelected();
        }
    });
    horizontalLineRadiobutton.setSelected(true);
    this.add(horizontalLineRadiobutton, gbc);

    gbc.gridx = 1;
    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.EAST;
    verticalLineRadiobutton = new JRadioButton(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.vertical.label"));
    verticalLineRadiobutton
            .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.vertical.tip"));
    verticalLineRadiobutton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            setVerticalLineSelected();
        }
    });
    this.add(verticalLineRadiobutton, gbc);

    ButtonGroup group = new ButtonGroup();
    group.add(horizontalLineRadiobutton);
    group.add(verticalLineRadiobutton);

    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1;
    gbc.gridwidth = 2;
    gbc.anchor = GridBagConstraints.CENTER;
    rangeAxisSelectionCombobox = new JComboBox();
    rangeAxisSelectionCombobox.setToolTipText(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.range_axis_combobox.tip"));
    rangeAxisSelectionCombobox.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updateYFieldValue();
        }
    });
    this.add(rangeAxisSelectionCombobox, gbc);

    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 1;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 5, 2, 5);
    JLabel xLabel = new JLabel(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.width.label"));
    this.add(xLabel, gbc);

    gbc.gridx = 1;
    gbc.gridy = 2;
    gbc.insets = new Insets(2, 5, 2, 5);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    xField = new JTextField();
    xField.setText(String.valueOf(x));
    xField.setInputVerifier(new InputVerifier() {

        @Override
        public boolean verify(JComponent input) {
            return verifyYInput(input);
        }
    });
    xField.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.width.tip"));
    xField.setEnabled(false);
    this.add(xField, gbc);

    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.fill = GridBagConstraints.NONE;
    JLabel yLabel = new JLabel(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.height.label"));
    this.add(yLabel, gbc);

    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    yField = new JTextField();
    yField.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.height.tip"));
    yField.setText(String.valueOf(y));
    yField.setInputVerifier(new InputVerifier() {

        @Override
        public boolean verify(JComponent input) {
            return verifyXInput(input);
        }
    });
    this.add(yField, gbc);

    gbc.gridx = 0;
    gbc.gridy = 4;
    gbc.fill = GridBagConstraints.NONE;
    gbc.insets = new Insets(10, 5, 0, 5);
    modifyLineButton = new JButton();
    modifyLineButton.setToolTipText(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.modify_line.tip"));
    modifyLineButton.setIcon(SwingTools.createIcon(
            "16/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.modify_line.icon")));
    modifyLineButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            modifyLine();
        }
    });
    this.add(modifyLineButton, gbc);

    gbc.gridx = 0;
    gbc.gridy = 5;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.insets = new Insets(15, 5, 5, 5);
    this.add(new JSeparator(), gbc);

    gbc.gridx = 0;
    gbc.gridy = 6;
    gbc.gridwidth = 1;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(5, 5, 5, 5);
    okButton = new JButton(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.label"));
    okButton.setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.tip"));
    okButton.setIcon(SwingTools
            .createIcon("24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.icon")));
    okButton.setMnemonic(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.ok.mne").toCharArray()[0]);
    okButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            boolean successful = addSpecifiedLine();
            // don't dispose dialog if not successful
            if (!successful) {
                return;
            }

            AddParallelLineDialog.this.dispose();
        }
    });
    okButton.addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(KeyEvent e) {
            if (e.getKeyCode() == KeyEvent.VK_ENTER) {
                okButton.doClick();
            }
        }
    });
    this.add(okButton, gbc);

    gbc.gridx = 1;
    gbc.gridy = 6;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
    cancelButton = new JButton(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.label"));
    cancelButton
            .setToolTipText(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.tip"));
    cancelButton.setIcon(SwingTools.createIcon(
            "24/" + I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.icon")));
    cancelButton.setMnemonic(
            I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.cancel.mne").toCharArray()[0]);
    cancelButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            // cancel requested, close dialog
            AddParallelLineDialog.this.dispose();
        }
    });
    this.add(cancelButton, gbc);

    // misc settings
    this.setMinimumSize(new Dimension(300, 250));
    // center dialog
    this.setLocationRelativeTo(null);
    this.setTitle(I18N.getMessage(I18N.getGUIBundle(), "gui.action.add_parallel_line.title.label"));
    this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    this.setModal(true);

    this.addWindowListener(new WindowAdapter() {

        @Override
        public void windowActivated(WindowEvent e) {
            okButton.requestFocusInWindow();
        }
    });
}

From source file:uk.ac.soton.mib104.t2.activities.json.ui.config.JSONPathConfigurationPanel.java

protected void initGui() {
    this.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    this.setLayout(new GridBagLayout());

    jsonPathAsTextField.setMinimumSize(new Dimension(240, jsonPathAsTextField.getMinimumSize().height));
    jsonPathAsTextField.setPreferredSize(jsonPathAsTextField.getMinimumSize());
    jsonPathAsTextField.setText("");

    jsonPathButton.addActionListener(new ActionListener() {

        @Override//ww  w  .  ja va 2s. c  o  m
        public void actionPerformed(final ActionEvent e) {
            final JSONPathInputDialog jsonPathInputDialog = new JSONPathInputDialog(
                    SwingUtilities.getWindowAncestor(JSONPathConfigurationPanel.this));

            final JSONPathInputPanel jsonPathInputPane = jsonPathInputDialog.getJSONPathInputPane();

            jsonPathInputPane.getJSONDocumentEditorPane().setText(jsonPathInputDialog_jsonPathEditorPane_text);

            jsonPathInputPane.getJsonPathEditorPane()
                    .setJSONValue(jsonPathInputDialog_jsonPathEditorPane_value);
            jsonPathInputPane.getJsonPathEditorPane()
                    .setTreeVisible(jsonPathInputDialog_jsonPathEditorPane_treeVisible);
            jsonPathInputPane.getJsonPathEditorPane().setText(jsonPathAsTextField.getText());

            jsonPathInputDialog.setVisible(true);

            switch (jsonPathInputDialog.getOption()) {
            case JOptionPane.OK_OPTION:
                break;
            default:
                return;
            }

            jsonPathInputDialog_jsonPathEditorPane_text = jsonPathInputPane.getJSONDocumentEditorPane()
                    .getText();
            jsonPathInputDialog_jsonPathEditorPane_treeVisible = jsonPathInputPane.getJsonPathEditorPane()
                    .isTreeVisible();
            jsonPathInputDialog_jsonPathEditorPane_value = jsonPathInputPane.getJsonPathEditorPane()
                    .getJSONValue();

            jsonPathAsTextField.setText(jsonPathInputPane.getJsonPathEditorPane().getText());
        }

    });
    jsonPathButton.setFont(jsonPathButton.getFont().deriveFont(11f));
    jsonPathButton.setIcon(JSONPathServiceIcon.getIcon());
    jsonPathButton.setText(jsonPathButtonText);
    jsonPathButton.setToolTipText(jsonPathButtonTip);

    final JLabel portDepthLabel = new JLabel();
    portDepthLabel.setFont(portDepthLabel.getFont().deriveFont(11f));
    portDepthLabel.setHorizontalAlignment(JLabel.LEFT);
    portDepthLabel.setIcon(Silk.getHelpIcon());
    portDepthLabel.setText(portDepthInputPaneText);
    portDepthLabel.setToolTipText(portDepthInputPaneTip);

    final GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 0;

    constraints.anchor = GridBagConstraints.WEST;
    this.add(JSONPathTextField.createLabelForDocument(jsonPathAsTextField.getDocument()), constraints);

    constraints.gridx++;

    constraints.anchor = GridBagConstraints.EAST;
    constraints.weightx = 1d;
    this.add(jsonPathAsTextField, constraints);
    constraints.weightx = 0;

    constraints.gridx++;

    constraints.fill = GridBagConstraints.NONE;
    this.add(jsonPathButton, constraints);

    constraints.gridx--;

    constraints.gridy++;

    constraints.anchor = GridBagConstraints.CENTER;
    this.add(JSONPathTextField.createLabelForDocumentationURI(), constraints);
    constraints.fill = GridBagConstraints.HORIZONTAL;

    constraints.gridx = 0;
    constraints.gridy++;

    constraints.gridwidth = 3;
    this.add(new JSeparator(JSeparator.HORIZONTAL), constraints);
    constraints.gridwidth = 1;

    constraints.gridx = 0;
    constraints.gridy++;

    constraints.anchor = GridBagConstraints.WEST;
    this.add(portDepthLabel, constraints);

    constraints.gridx++;

    constraints.anchor = GridBagConstraints.EAST;
    constraints.gridwidth = 2;
    this.add(portDepthInputPane, constraints);
    constraints.gridwidth = 1;
}

From source file:geva.Operator.Operations.UserSelect.java

/**
 * Helper for adding a control to a GridBagLayout control
 * @param container The control to add <var>control</var> to
 * @param control The control being added to <var>container</var>
 * @param gridX The grid column to add the control
 * @param gridY The grid row to add the control
 * @param gridW The number of columns to span
 * @param gridH The number of rows to span
 * @param weightX The amount of horizontal space this column should take
 *  relative to other columns//from w w  w  .j ava2s.c o m
 * @param weightY The amount of vertical space this column should take
 *  relative to other rows
 */
protected static void gridAdd(Container container, Container control, int gridX, int gridY, int gridW,
        int gridH, double weightX, double weightY) {
    container.add(control, new GridBagConstraints(gridX, gridY, gridW, gridH, weightX, weightY,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(1, 1, 1, 1), 0, 0));
}

From source file:cool.pandora.modeller.ui.jpanel.base.NewBagFrame.java

/**
 * layoutProfileSelection.//  w w w.  jav  a2s  .  co m
 *
 * @param contentPane JPanel
 * @param row         int
 */
private void layoutProfileSelection(final JPanel contentPane, final int row) {
    // content
    // profile selection
    final JLabel bagProfileLabel = new JLabel(bagView.getPropertyMessage("Select Profile:"));
    bagProfileLabel.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help"));

    profileList = new JComboBox<>(bagView.getProfileStore().getProfileNames());
    profileList.setName(bagView.getPropertyMessage("bag.label.projectlist"));
    profileList.setSelectedItem(bagView.getPropertyMessage("bag.project.noproject"));
    profileList.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help"));

    GridBagConstraints glbc = new GridBagConstraints();

    final JLabel spacerLabel = new JLabel();
    glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.WEST);
    contentPane.add(bagProfileLabel, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.CENTER);
    contentPane.add(profileList, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE,
            GridBagConstraints.EAST);
    contentPane.add(spacerLabel, glbc);
}

From source file:com.limegroup.gnutella.gui.LicenseWindow.java

protected void createNotValid() {
    GridBagConstraints c = new GridBagConstraints();
    URI licenseURI = LICENSE.getLicenseURI();
    JComponent comp;//from www . j  a  v  a  2 s .c o  m

    comp = new JLabel(getWarningIcon());
    c.anchor = GridBagConstraints.NORTH;
    c.insets = new Insets(0, 0, 0, 5);
    DETAILS.add(comp, c);

    String invalidText = getInvalidString();
    if (licenseURI != null && allowRetryLink())
        invalidText += "  " + getRetryString();
    comp = newTextArea(invalidText);
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 1;
    c.insets = new Insets(7, 0, 0, 0);
    DETAILS.add(comp, c);

    c.gridwidth = 1;
    c.gridheight = 2;
    c.weightx = 0;
    c.weighty = 0;
    DETAILS.add(javax.swing.Box.createGlue(), c);

    JButton button = new JButton(getVerifyString());
    button.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent ev) {
            LICENSE.verify(LicenseWindow.this);
            buildDetails();
        }
    });
    button.setVisible(licenseURI != null && allowVerifyLookup());
    c.gridwidth = GridBagConstraints.RELATIVE;
    c.gridheight = 2;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new Insets(0, 0, 0, 100);
    DETAILS.add(button, c);

    if (LICENSE.getLicenseDeed(URN) == null || !allowClaimedDeedLink()) {
        comp = new JLabel();
        comp.setVisible(false);
    } else {
        comp = new URLLabel(LICENSE.getLicenseDeed(URN), getClaimedDeedString());
    }
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 0;
    c.weighty = 0;
    c.insets = new Insets(0, 0, 3, 0);
    DETAILS.add(comp, c);

    if (licenseURI == null || !allowVerificationLink()) {
        comp = new JLabel();
        comp.setVisible(false);
    } else {
        comp = new URLLabel(licenseURI, getVerificationString());
    }
    c.insets = new Insets(0, 0, 3, 0);
    DETAILS.add(comp, c);
}

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

private Component createControls() {
    JPanel controlPanel = new JPanel(new GridBagLayout());
    controlPanel.setOpaque(false);/*  www  .j  a  v a  2  s .  com*/

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

    GridBagLayoutManager.addComponent(controlPanel, createInstantDataPanel(), c, 0, 0, 1, 1, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.CENTER);

    GridBagLayoutManager.addComponent(controlPanel, createWarningsPanel(), c, 0, 1, 1, 1, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.CENTER);

    GridBagLayoutManager.addComponent(controlPanel, createOptionsPanel(), c, 0, 2, 1, 1, 0, 0,
            GridBagConstraints.BOTH, GridBagConstraints.CENTER);

    GridBagLayoutManager.addComponent(controlPanel, createEditorButton(), c, 0, 3, 1, 1, 0, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH);

    GridBagLayoutManager.addComponent(controlPanel, createImportExportButtons(), c, 0, 4, 1, 1, 0, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.NORTH);

    GridBagLayoutManager.addComponent(controlPanel, Box.createVerticalGlue(), c, 0, 5, 1, 1, 1, 1,
            GridBagConstraints.VERTICAL, GridBagConstraints.CENTER);

    return controlPanel;
}