Example usage for java.awt GridBagConstraints NONE

List of usage examples for java.awt GridBagConstraints NONE

Introduction

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

Prototype

int NONE

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

Click Source Link

Document

Do not resize the component.

Usage

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

/**
 * layoutProfileSelection./*from   w w w  . j  a  v  a  2  s.  c  o  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:org.jets3t.gui.UserInputFields.java

/**
 * Builds a user input panel matching the fields specified in the uploader.properties file.
 *
 * @param fieldsPanel//from   ww w.  j  a  v a2 s  . co m
 * the panel component to add prompt and user input components to.
 * @param uploaderProperties
 * properties specific to the Uploader application that includes the field.* settings
 * necessary to build the User Inputs screen.
 *
 * @return
 * true if there is at least one valid user input field, false otherwise.
 */
public boolean buildFieldsPanel(JPanel fieldsPanel, Jets3tProperties uploaderProperties) {
    int fieldIndex = 0;

    for (int fieldNo = 0; fieldNo < 100; fieldNo++) {
        String fieldName = uploaderProperties.getStringProperty("field." + fieldNo + ".name", null);
        String fieldType = uploaderProperties.getStringProperty("field." + fieldNo + ".type", null);
        String fieldPrompt = uploaderProperties.getStringProperty("field." + fieldNo + ".prompt", null);
        String fieldOptions = uploaderProperties.getStringProperty("field." + fieldNo + ".options", null);
        String fieldDefault = uploaderProperties.getStringProperty("field." + fieldNo + ".default", null);

        if (fieldName == null) {
            log.debug("No field with index number " + fieldNo);
            continue;
        } else {
            if (fieldType == null || fieldPrompt == null) {
                log.warn("Field '" + fieldName + "' missing .type or .prompt properties");
                continue;
            }

            if ("message".equals(fieldType)) {
                JHtmlLabel label = skinsFactory.createSkinnedJHtmlLabel(fieldName);
                label.setText(fieldPrompt);
                label.setHyperlinkeActivatedListener(hyperlinkListener);
                fieldsPanel.add(label, new GridBagConstraints(0, fieldIndex++, 1, 1, 0, 0,
                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
            } else if ("radio".equals(fieldType)) {
                if (fieldOptions == null) {
                    log.warn(
                            "Radio button field '" + fieldName + "' is missing the required .options property");
                    continue;
                }

                JHtmlLabel label = skinsFactory.createSkinnedJHtmlLabel(fieldName);
                label.setText(fieldPrompt);
                label.setHyperlinkeActivatedListener(hyperlinkListener);
                fieldsPanel.add(label, new GridBagConstraints(0, fieldIndex++, 1, 1, 0, 0,
                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

                JPanel optionsPanel = skinsFactory.createSkinnedJPanel("OptionsPanel");
                optionsPanel.setLayout(new GridBagLayout());
                int columnOffset = 0;
                ButtonGroup buttonGroup = new ButtonGroup();
                StringTokenizer st = new StringTokenizer(fieldOptions, ",");
                while (st.hasMoreTokens()) {
                    String option = st.nextToken();
                    JRadioButton radioButton = skinsFactory.createSkinnedJRadioButton(fieldName);
                    radioButton.setText(option);
                    buttonGroup.add(radioButton);

                    if (fieldDefault != null && fieldDefault.equals(option)) {
                        // This option is the default one.
                        radioButton.setSelected(true);
                    } else if (buttonGroup.getButtonCount() == 1) {
                        // Make first button the default.
                        radioButton.setSelected(true);
                    }

                    optionsPanel.add(radioButton, new GridBagConstraints(columnOffset++, 0, 1, 1, 0, 0,
                            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0));
                }
                fieldsPanel.add(optionsPanel, new GridBagConstraints(0, fieldIndex++, 1, 1, 0, 0,
                        GridBagConstraints.WEST, GridBagConstraints.NONE, insetsNone, 0, 0));

                userInputComponentsMap.put(fieldName, buttonGroup);
            } else if ("selection".equals(fieldType)) {
                if (fieldOptions == null) {
                    log.warn(
                            "Radio button field '" + fieldName + "' is missing the required .options property");
                    continue;
                }

                JHtmlLabel label = skinsFactory.createSkinnedJHtmlLabel(fieldName);
                label.setText(fieldPrompt);
                label.setHyperlinkeActivatedListener(hyperlinkListener);
                fieldsPanel.add(label, new GridBagConstraints(0, fieldIndex++, 1, 1, 0, 0,
                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

                JComboBox comboBox = skinsFactory.createSkinnedJComboBox(fieldName);
                StringTokenizer st = new StringTokenizer(fieldOptions, ",");
                while (st.hasMoreTokens()) {
                    String option = st.nextToken();
                    comboBox.addItem(option);
                }

                if (fieldDefault != null) {
                    comboBox.setSelectedItem(fieldDefault);
                }

                fieldsPanel.add(comboBox, new GridBagConstraints(0, fieldIndex++, 1, 1, 1, 0,
                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

                userInputComponentsMap.put(fieldName, comboBox);
            } else if ("text".equals(fieldType)) {
                JHtmlLabel label = skinsFactory.createSkinnedJHtmlLabel(fieldName);
                label.setText(fieldPrompt);
                label.setHyperlinkeActivatedListener(hyperlinkListener);
                fieldsPanel.add(label, new GridBagConstraints(0, fieldIndex++, 1, 1, 0, 0,
                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
                JTextField textField = skinsFactory.createSkinnedJTextField(fieldName);
                if (fieldDefault != null) {
                    textField.setText(fieldDefault);
                }

                fieldsPanel.add(textField, new GridBagConstraints(0, fieldIndex++, 1, 1, 1, 0,
                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

                userInputComponentsMap.put(fieldName, textField);
            } else if ("password".equals(fieldType)) {
                JHtmlLabel label = skinsFactory.createSkinnedJHtmlLabel(fieldName);
                label.setText(fieldPrompt);
                label.setHyperlinkeActivatedListener(hyperlinkListener);
                fieldsPanel.add(label, new GridBagConstraints(0, fieldIndex++, 1, 1, 0, 0,
                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
                JPasswordField passwordField = skinsFactory.createSkinnedJPasswordField(fieldName);
                if (fieldDefault != null) {
                    passwordField.setText(fieldDefault);
                }

                fieldsPanel.add(passwordField, new GridBagConstraints(0, fieldIndex++, 1, 1, 1, 0,
                        GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

                userInputComponentsMap.put(fieldName, passwordField);
            } else if (fieldType.equals("textarea")) {
                JHtmlLabel label = skinsFactory.createSkinnedJHtmlLabel(fieldName);
                label.setText(fieldPrompt);
                label.setHyperlinkeActivatedListener(hyperlinkListener);
                fieldsPanel.add(label, new GridBagConstraints(0, fieldIndex++, 2, 1, 0, 0,
                        GridBagConstraints.NORTHWEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
                JTextArea textArea = skinsFactory.createSkinnedJTextArea(fieldName);
                textArea.setLineWrap(true);
                if (fieldDefault != null) {
                    textArea.setText(fieldDefault);
                }

                JScrollPane scrollPane = skinsFactory.createSkinnedJScrollPane(fieldName);
                scrollPane.setViewportView(textArea);
                fieldsPanel.add(scrollPane, new GridBagConstraints(0, fieldIndex++, 2, 1, 1, 1,
                        GridBagConstraints.WEST, GridBagConstraints.BOTH, insetsDefault, 0, 0));

                userInputComponentsMap.put(fieldName, textArea);
            } else {
                log.warn("Unrecognised .type setting for field '" + fieldName + "'");
            }
        }
    }

    return isUserInputFieldsAvailable();
}

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

/**
 * layoutSelectDataContent./*from  w  w w .  j a v a 2 s . c  o  m*/
 *
 * @param contentPanel JPanel
 * @param row          int
 */
private void layoutSelectDataContent(final JPanel contentPanel, final int row) {

    final JLabel location = new JLabel("Select Data:");
    final JButton saveAsButton = new JButton(bagView.getPropertyMessage("bag.button.browse"));
    saveAsButton.addActionListener(new BrowseFileHandler());
    saveAsButton.setEnabled(true);
    saveAsButton.setToolTipText(bagView.getPropertyMessage("bag.button.browse.help"));

    String fileName = "";
    if (bag != null) {
        fileName = bag.getName();
    }
    bagNameField = new JTextField(fileName);
    bagNameField.setCaretPosition(fileName.length());
    bagNameField.setEditable(false);
    bagNameField.setEnabled(false);

    GridBagConstraints glbc = new GridBagConstraints();
    glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 1, 50, GridBagConstraints.NONE,
            GridBagConstraints.WEST);
    contentPanel.add(location, glbc);

    glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 1, 50, GridBagConstraints.NONE,
            GridBagConstraints.EAST);
    contentPanel.add(saveAsButton, glbc);

    glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.WEST);
    glbc.ipadx = 0;
    contentPanel.add(bagNameField, glbc);
}

From source file:org.eurocarbdb.application.glycoworkbench.plugin.s3.gui.SignedGetUrlDialog.java

public SignedGetUrlDialog(Frame ownerFrame, HyperlinkActivatedListener hyperlinkListener, S3Service s3Service,
        S3Object[] objects) {//w w w  .j a  va  2s.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:gov.loc.repository.bagger.ui.NewBagInPlaceFrame.java

private void layoutBagVersionContent(JPanel contentPanel, int row) {
    GridBagConstraints glbc = new GridBagConstraints();

    JLabel bagVersionLabel = new JLabel(bagView.getPropertyMessage("bag.label.version"));
    bagVersionLabel.setToolTipText(bagView.getPropertyMessage("bag.versionlist.help"));
    ArrayList<String> versionModel = new ArrayList<String>();
    Version[] vals = Version.values();//  www  .j  a  va2s. c o m
    for (int i = 0; i < vals.length; i++) {
        versionModel.add(vals[i].versionString);
    }

    bagVersionList = new JComboBox(versionModel.toArray());
    bagVersionList.setName(bagView.getPropertyMessage("bag.label.versionlist"));
    bagVersionList.setSelectedItem(Version.V0_96.versionString);
    bagVersionList.setToolTipText(bagView.getPropertyMessage("bag.versionlist.help"));

    glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 1, 50, GridBagConstraints.NONE,
            GridBagConstraints.WEST);
    contentPanel.add(bagVersionLabel, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.WEST);
    contentPanel.add(bagVersionList, glbc);
}

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

/**
 * Setup the GUI.//from   w w w.  jav  a2 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:org.nuclos.client.genericobject.logbook.LogbookController.java

private void setupToolbar(final LogbookPanel pnlLogbook) {
    this.btnRefresh.setName("btnRefresh");
    this.btnRefresh.setAction(actRefresh);
    this.btnRefresh.setText(null);
    pnlLogbook.getToolbar().add(this.btnRefresh);

    pnlFilter.setBorder(BorderFactory
            .createTitledBorder(getSpringLocaleDelegate().getMessage("LogbookController.4", "Filter nach")));
    pnlFilter.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets.right = 5;/*from  w  w  w . j a  v a  2  s. c om*/
    gbc.fill = GridBagConstraints.NONE;

    gbc.gridx = 0;
    gbc.gridy = 0;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.5", "Ge\u00e4ndert am")),
            gbc);

    gbc.gridx = 1;
    gbc.insets.right = 10;
    this.pnlFilter.add(this.tfCOLUMN_CHANGEDAT, gbc);
    this.tfCOLUMN_CHANGEDAT.setColumns(15);
    this.tfCOLUMN_CHANGEDAT.setToolTipText(
            getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte") + " '"
                    + getSpringLocaleDelegate().getMessage("LogbookController.5", "Ge\u00e4ndert am") + "'");

    ++gbc.gridy;
    gbc.gridx = 0;
    gbc.insets.right = 5;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.7", "Ge\u00e4ndert von")),
            gbc);

    gbc.gridx = 1;
    gbc.insets.right = 10;
    this.pnlFilter.add(this.tfCOLUMN_CHANGEDBY, gbc);
    this.tfCOLUMN_CHANGEDBY.setColumns(15);
    this.tfCOLUMN_CHANGEDBY.setToolTipText(
            getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte") + " '"
                    + getSpringLocaleDelegate().getMessage("LogbookController.7", "Ge\u00e4ndert von") + "'");

    ++gbc.gridy;
    gbc.gridx = 0;
    gbc.insets.right = 5;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.8", "Feld")), gbc);

    gbc.gridx = 1;
    gbc.insets.right = 10;
    this.pnlFilter.add(this.tfCOLUMN_LABEL, gbc);
    this.tfCOLUMN_LABEL.setColumns(15);
    this.tfCOLUMN_LABEL
            .setToolTipText(getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte")
                    + " '" + getSpringLocaleDelegate().getMessage("LogbookController.8", "Feld") + "'");

    gbc.gridx = 2;
    gbc.gridy = 0;
    gbc.insets.right = 5;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.9", "Alter Wert")), gbc);

    gbc.gridx = 3;
    this.pnlFilter.add(this.tfCOLUMN_OLDVALUE, gbc);
    this.tfCOLUMN_OLDVALUE.setColumns(15);
    this.tfCOLUMN_OLDVALUE
            .setToolTipText(getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte")
                    + " '" + getSpringLocaleDelegate().getMessage("LogbookController.9", "Alter Wert") + "'");

    ++gbc.gridy;
    gbc.gridx = 2;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.10", "Neuer Wert")), gbc);

    gbc.gridx = 3;
    this.pnlFilter.add(this.tfCOLUMN_NEWVALUE, gbc);
    this.tfCOLUMN_NEWVALUE.setColumns(15);
    this.tfCOLUMN_NEWVALUE
            .setToolTipText(getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte")
                    + " '" + getSpringLocaleDelegate().getMessage("LogbookController.10", "Neuer Wert") + "'");

    ++gbc.gridy;
    gbc.gridx = 2;
    pnlFilter.add(new JLabel(getSpringLocaleDelegate().getMessage("LogbookController.11", "ID")), gbc);

    gbc.gridx = 3;
    this.pnlFilter.add(this.tfCOLUMN_ID, gbc);
    this.tfCOLUMN_ID.setColumns(15);
    this.tfCOLUMN_ID
            .setToolTipText(getSpringLocaleDelegate().getMessage("LogbookController.6", "Filter nach Spalte")
                    + " '" + getSpringLocaleDelegate().getMessage("LogbookController.11", "ID") + "'");

    gbc.gridx = 4;
    gbc.gridy = 0;
    gbc.weightx = 0.1;
    this.btnFilter.setAction(actFilter);
    this.btnFilter.setText(null);
    this.pnlFilter.add(this.btnFilter, gbc);

    gbc.gridx = 4;
    gbc.gridy = 1;
    this.btnClearFilter.setAction(actClearFilter);
    this.btnClearFilter.setText(null);
    this.pnlFilter.add(this.btnClearFilter, gbc);

    pnlLogbook.getToolbar().add(this.pnlFilter);
    pnlLogbook.getToolbar().add(Box.createHorizontalGlue());

    /**
     * action: Refresh
     */
    KeyBindingProvider.bindActionToComponent(KeyBindingProvider.REFRESH, actRefresh, pnlLogbook);
}

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

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

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*  w  w w . jav a 2s . c om*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("PatchCanvasFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Canvases")));
    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.getCanvasContainerURI(map);
    try {
        urlField.setText(uri != null ? uri.toString() : null);
    } catch (final Exception e) {
        log.error("Failed to set url 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);
    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.CreateListsFrame.java

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

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from   www. j  a  v  a 2 s . co m*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreateListsFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create List 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.getListContainerURI(map);
    try {
        urlField.setText(uri != null ? uri.toString() : null);
    } catch (final Exception e) {
        log.error("Failed to set url 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);
    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.PatchSequenceFrame.java

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

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from  ww  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("PatchSequenceFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Patch Sequences")));
    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 (Exception e) {
        log.error("Failed to set url 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(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;

}