Example usage for java.awt GridBagConstraints HORIZONTAL

List of usage examples for java.awt GridBagConstraints HORIZONTAL

Introduction

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

Prototype

int HORIZONTAL

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

Click Source Link

Document

Resize the component horizontally but not vertically.

Usage

From source file:edu.harvard.mcz.imagecapture.LoginDialog.java

/**
 * This method initializes jPanel   /* w  ww .j a  v  a 2  s.  c om*/
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanel() {
    if (jPanel == null) {
        GridBagConstraints gridBagConstraints17 = new GridBagConstraints();
        gridBagConstraints17.gridx = 1;
        gridBagConstraints17.anchor = GridBagConstraints.WEST;
        gridBagConstraints17.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints17.gridy = 16;
        jLabel6 = new JLabel();
        jLabel6.setText("");
        GridBagConstraints gridBagConstraints62 = new GridBagConstraints();
        gridBagConstraints62.gridx = 0;
        gridBagConstraints62.gridwidth = 2;
        gridBagConstraints62.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints62.anchor = GridBagConstraints.WEST;
        gridBagConstraints62.gridy = 6;
        GridBagConstraints gridBagConstraints51 = new GridBagConstraints();
        gridBagConstraints51.gridx = 0;
        gridBagConstraints51.gridy = 4;
        GridBagConstraints gridBagConstraints41 = new GridBagConstraints();
        gridBagConstraints41.fill = GridBagConstraints.BOTH;
        gridBagConstraints41.gridy = 3;
        gridBagConstraints41.weightx = 1.0;
        gridBagConstraints41.anchor = GridBagConstraints.WEST;
        gridBagConstraints41.gridx = 1;
        GridBagConstraints gridBagConstraints31 = new GridBagConstraints();
        gridBagConstraints31.gridx = 0;
        gridBagConstraints31.anchor = GridBagConstraints.EAST;
        gridBagConstraints31.gridy = 3;
        jLabel9 = new JLabel();
        jLabel9.setText("Password");
        GridBagConstraints gridBagConstraints21 = new GridBagConstraints();
        gridBagConstraints21.gridx = 0;
        gridBagConstraints21.anchor = GridBagConstraints.EAST;
        gridBagConstraints21.gridy = 2;
        jLabel8 = new JLabel();
        jLabel8.setText("email");
        GridBagConstraints gridBagConstraints16 = new GridBagConstraints();
        gridBagConstraints16.fill = GridBagConstraints.BOTH;
        gridBagConstraints16.gridy = 2;
        gridBagConstraints16.weightx = 1.0;
        gridBagConstraints16.anchor = GridBagConstraints.WEST;
        gridBagConstraints16.gridx = 1;
        GridBagConstraints gridBagConstraints15 = new GridBagConstraints();
        gridBagConstraints15.gridx = 1;
        gridBagConstraints15.gridy = 12;
        GridBagConstraints gridBagConstraints61 = new GridBagConstraints();
        gridBagConstraints61.gridx = 0;
        gridBagConstraints61.gridwidth = 1;
        gridBagConstraints61.anchor = GridBagConstraints.NORTHEAST;
        gridBagConstraints61.gridheight = 4;
        gridBagConstraints61.fill = GridBagConstraints.NONE;
        gridBagConstraints61.weighty = 1.0;
        gridBagConstraints61.insets = new Insets(0, 0, 0, 0);
        gridBagConstraints61.gridy = 10;
        jLabel7 = new JLabel();
        URL iconFile = this.getClass().getResource("/edu/harvard/mcz/imagecapture/resources/key_small.png");
        try {
            //this.setIconImage(new ImageIcon(iconFile).getImage());
            jLabel7.setIcon(new ImageIcon(iconFile));
        } catch (Exception e) {
            System.out.println("Can't open icon file: " + iconFile);
        }
        jLabel7.setText(" ");
        GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
        gridBagConstraints12.gridx = 1;
        gridBagConstraints12.anchor = GridBagConstraints.NORTH;
        gridBagConstraints12.fill = GridBagConstraints.NONE;
        gridBagConstraints12.gridy = 1;
        jLabel5 = new JLabel();
        jLabel5.setText("Connect to Database");
        jLabel4 = new JLabel();
        jLabel4.setText("Dialect");
        jLabel3 = new JLabel();
        jLabel3.setText("Connection");
        jLabel2 = new JLabel();
        jLabel2.setText("Driver");
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.gridy = 2;
        jLabel1 = new JLabel();
        jLabel1.setText("DBPassword");
        jLabel = new JLabel();
        jLabel.setText("Schema");
        jPanel = new JPanel();

        jPanel.setLayout(new GridBagLayout());
        jPanel.add(jLabel5, gridBagConstraints12);
        jPanel.add(jLabel7, gridBagConstraints61);
        jPanel.add(getJPanel1(), gridBagConstraints15);
        jPanel.add(getJTextFieldEmail(), gridBagConstraints16);
        jPanel.add(jLabel8, gridBagConstraints21);
        jPanel.add(jLabel9, gridBagConstraints31);
        jPanel.add(getJPasswordFieldUser(), gridBagConstraints41);
        jPanel.add(getJButton2(), gridBagConstraints51);
        jPanel.add(getJPanelAdvanced(), gridBagConstraints62);
        jPanel.add(jLabel6, gridBagConstraints17);
    }
    return jPanel;
}

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

private void layoutBagVersionSelection(JPanel contentPane, int row) {
    //contents//from  ww w  .j a va 2s  .  c  o  m
    // Bag version dropdown list
    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();
    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"));

    GridBagConstraints glbc = null;

    JLabel spacerLabel = new JLabel();
    glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.WEST);
    contentPane.add(bagVersionLabel, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.CENTER);
    contentPane.add(bagVersionList, 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   w ww .  j  av a 2  s  . c  om*/
 * 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:ImageOpByRomain.java

private void buildControlsPanel() {
    JPanel controls = new JPanel(new GridBagLayout());

    // red component
    controls.add(new JLabel("Red: 0"), new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_END,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(redSlider = new JSlider(0, 255, 255), new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(new JLabel("255"), new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

    // green component
    controls.add(new JLabel("Green: 0"), new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
            GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(greenSlider = new JSlider(0, 255, 255), new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(new JLabel("255"), new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

    // blue component
    controls.add(new JLabel("Blue: 0"), new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0,
            GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(blueSlider = new JSlider(0, 255, 255), new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(new JLabel("255"), new GridBagConstraints(2, 2, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

    // mix value//  w w w  . j  a v a 2s.  c  o m
    controls.add(new JLabel("Mix: 0%"), new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
            GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(alphaSlider = new JSlider(0, 100, 50), new GridBagConstraints(1, 3, 1, 1, 1.0, 1.0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(new JLabel("100%"), new GridBagConstraints(2, 3, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

    // change listener
    ChangeListener colorChange = new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            imagePanel.setColor(new Color(redSlider.getValue(), greenSlider.getValue(), blueSlider.getValue()));
        }
    };
    redSlider.addChangeListener(colorChange);
    greenSlider.addChangeListener(colorChange);
    blueSlider.addChangeListener(colorChange);

    // alpha listener
    alphaSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            imagePanel.setMix((float) alphaSlider.getValue() / 100.0f);
        }
    });

    add(controls, BorderLayout.SOUTH);
}

From source file:coolmap.canvas.datarenderer.renderer.impl.NumberComposite.java

public NumberComposite() {

    setName("Number to Composite");
    //        System.out.println("Created a new NumberComposite");
    setDescription("A renderer that can be used to assign renderers to different aggregations");

    configUI.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;/*from  w ww .j a va 2 s .c  o  m*/
    c.gridy = 0;
    c.ipadx = 5;
    c.ipady = 5;
    c.insets = new Insets(2, 2, 2, 2);
    c.gridwidth = 1;

    //This combo box will need to be able to add registered
    singleComboBox = new JComboBox();
    rowComboBox = new JComboBox();
    columnComboBox = new JComboBox();
    rowColumnComboBox = new JComboBox();

    singleLegend = new JLabel();
    rowLegend = new JLabel();
    columnLegend = new JLabel();
    rowColumnLegend = new JLabel();

    singleLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    rowLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    columnLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));
    rowColumnLegend.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5));

    //Add them
    JLabel label = new JLabel("Default:");
    label.setToolTipText("Default renderer");
    c.gridx = 0;
    c.gridy++;
    configUI.add(label, c);
    c.gridx = 1;
    configUI.add(singleComboBox, c);
    singleComboBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                updateRenderer();
            }
        }
    });

    c.gridx = 2;
    JButton config = new JButton(UI.getImageIcon("gear"));
    configUI.add(config, c);
    config.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (singleRenderer == null) {
                return;
            }
            //                JOptionPane.showmess
            int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(),
                    singleRenderer.getConfigUI(), "Default Renderer Config", JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.PLAIN_MESSAGE, null);
            if (returnVal == JOptionPane.OK_OPTION) {
                updateRenderer();
            }
        }
    });

    c.gridx = 1;
    c.gridy++;
    c.gridwidth = 1;
    configUI.add(singleLegend, c);

    //////////////////////////////////////////////////////////////
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    label = new JLabel("Row Group:");
    label.setToolTipText("Renderer for row ontology nodes");
    configUI.add(label, c);
    c.gridx = 1;
    configUI.add(rowComboBox, c);
    c.gridx++;
    config = new JButton(UI.getImageIcon("gear"));
    configUI.add(config, c);
    config.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (rowGroupRenderer == null) {
                return;
            }
            //                JOptionPane.showmess
            int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(),
                    rowGroupRenderer.getConfigUI(), "Row Group Renderer Config", JOptionPane.OK_CANCEL_OPTION,
                    JOptionPane.PLAIN_MESSAGE, null);
            if (returnVal == JOptionPane.OK_OPTION) {
                updateRenderer();
            }

        }
    });
    rowComboBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                updateRenderer();
            }
        }
    });

    c.gridx = 1;
    c.gridy++;
    c.gridwidth = 1;
    configUI.add(rowLegend, c);

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    label = new JLabel("Column Group:");
    label.setToolTipText("Renderer for column ontology nodes");
    configUI.add(label, c);
    c.gridx = 1;
    configUI.add(columnComboBox, c);
    c.gridx++;
    config = new JButton(UI.getImageIcon("gear"));
    configUI.add(config, c);
    config.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (columnGroupRenderer == null) {
                return;
            }
            //                JOptionPane.showmess
            int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(),
                    columnGroupRenderer.getConfigUI(), "Column Group Renderer Config",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null);
            if (returnVal == JOptionPane.OK_OPTION) {
                updateRenderer();
            }
        }
    });

    c.gridx = 1;
    c.gridy++;
    c.gridwidth = 1;
    configUI.add(columnLegend, c);
    columnComboBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                updateRenderer();
            }
        }
    });

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    label = new JLabel("Row & Column Group:");
    label.setToolTipText("Renderer for row and column ontology nodes");
    configUI.add(label, c);
    c.gridx = 1;
    configUI.add(rowColumnComboBox, c);
    c.gridx++;
    config = new JButton(UI.getImageIcon("gear"));
    configUI.add(config, c);
    config.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (rowColumnGroupRenderer == null) {
                return;
            }
            //                JOptionPane.showmess
            int returnVal = JOptionPane.showConfirmDialog(CoolMapMaster.getCMainFrame(),
                    rowColumnGroupRenderer.getConfigUI(), "Row + Column Group Renderer Config",
                    JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null);
            if (returnVal == JOptionPane.OK_OPTION) {
                updateRenderer();
            }
        }
    });
    rowColumnComboBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                updateRenderer();
            }
        }
    });

    c.gridx = 1;
    c.gridy++;
    c.gridwidth = 1;
    configUI.add(rowColumnLegend, c);

    JButton button = new JButton("Apply Changes", UI.getImageIcon("refresh"));
    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            updateRenderer();
        }
    });

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 2;
    configUI.add(button, c);

    singleComboBox.setRenderer(new ComboRenderer());
    rowComboBox.setRenderer(new ComboRenderer());
    columnComboBox.setRenderer(new ComboRenderer());
    rowColumnComboBox.setRenderer(new ComboRenderer());

    _updateLists();

}

From source file:com.sec.ose.osi.ui.frm.main.identification.JPanIdentifyResetComment.java

private Component getJPanelOkResetBtn() {
    if (jPanOKCancelBtn == null) {

        jPanOKCancelBtn = new JPanel();

        GridBagConstraints gridBagConstraintsOKBtn = new GridBagConstraints();
        gridBagConstraintsOKBtn.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsOKBtn.insets = new Insets(0, 0, 10, 0);
        gridBagConstraintsOKBtn.gridx = 0;
        gridBagConstraintsOKBtn.gridy = 0;

        GridBagConstraints gridBagConstraintsResetBtn = new GridBagConstraints();
        gridBagConstraintsResetBtn.gridx = 0;
        gridBagConstraintsResetBtn.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsResetBtn.insets = new Insets(0, 0, 10, 0);
        gridBagConstraintsResetBtn.gridy = 1;

        jPanOKCancelBtn.setLayout(new GridBagLayout());
        jPanOKCancelBtn.add(getJButtonOK(), gridBagConstraintsOKBtn);
        jPanOKCancelBtn.add(getJButtonReset(), gridBagConstraintsResetBtn);
    }/*  w w  w. ja va 2  s.co m*/
    return jPanOKCancelBtn;
}

From source file:org.executequery.gui.scriptgenerators.GenerateScriptsPanelThree.java

private JPanel createFileOutputPanel() {

    pathField = WidgetFactory.createTextField();

    final JButton browseButton = new DefaultPanelButton("Browse");
    browseButton.setMnemonic('B');
    browseButton.addActionListener(this);

    final DefaultFieldLabel label = new DefaultFieldLabel("Save Path:");

    writeToFileCheck = new JCheckBox("Write to file");
    writeToFileCheck.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            boolean enable = writeToFileCheck.isSelected();
            browseButton.setEnabled(enable);
            pathField.setEnabled(enable);
            label.setEnabled(enable);/*  w  ww.  j  a  va2  s. co  m*/
        }
    });

    browseButton.setEnabled(false);
    pathField.setEnabled(false);
    label.setEnabled(false);

    ComponentTitledPanel panel = new ComponentTitledPanel(writeToFileCheck);
    JPanel fileOutputPanel = panel.getContentPane();
    fileOutputPanel.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx++;
    gbc.gridy++;
    gbc.insets = new Insets(7, 5, 5, 5);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    fileOutputPanel.add(label, gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    fileOutputPanel.add(pathField, gbc);
    gbc.fill = GridBagConstraints.NONE;
    gbc.gridx = 2;
    gbc.weightx = 0;
    gbc.insets.top = 3;
    gbc.insets.right = 5;
    fileOutputPanel.add(browseButton, gbc);

    return panel;
}

From source file:com.att.aro.ui.view.videotab.VideoTab.java

@Override
public JPanel layoutDataPanel() {
    if (mainPanel == null) {

        mainPanel = new JPanel(new GridBagLayout());
        mainPanel.setOpaque(false);//w w w.j a va  2  s.c  o m

        int section = 1;

        mainPanel.add(buildSummariesGroup(), new GridBagConstraints(0, section++, 1, 1, 1.0, 0.0,
                GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

        graphPanelIndex = section++;
        addGraphPanel();

        mainPanel.add(buildManifestsGroup(), new GridBagConstraints(0, section++, 1, 1, 1.0, 0.0,
                GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 0));

        mainPanel.add(buildRequestsGroup(), new GridBagConstraints(0, section++, 1, 1, 1.0, 0.0,
                GridBagConstraints.EAST, GridBagConstraints.HORIZONTAL, new Insets(10, 0, 0, 0), 0, 0));
    }
    return mainPanel;
}

From source file:de.juwimm.cms.gui.admin.PanUnitGroupPerUser.java

void jbInit() throws Exception {
    this.setLayout(new GridBagLayout());

    this.unitPickData = new PickListData();
    this.unitPickData.setLeftLabel(rb.getString("panel.admin.tab.units.assigned"));
    this.unitPickData.setRightLabel(rb.getString("panel.admin.tab.units.all"));
    this.groupPickData = new PickListData();
    this.groupPickData.setLeftLabel(rb.getString("panel.admin.tab.groups.assigned"));
    this.groupPickData.setRightLabel(rb.getString("panel.admin.tab.groups.all"));
    this.panUnitPick = new PickListPanel(this.unitPickData);
    this.panGroupPick = new PickListPanel(this.groupPickData);
    this.btnSave.setText(rb.getString("dialog.save"));
    this.lblUser.setText(rb.getString("panel.login.username"));

    this.btnSave.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            save();//w  ww.  j  a v  a2 s .c om
        }
    });

    this.tblUser = new JTable();
    JScrollPane scrollUser = new NoResizeScrollPane(tblUser);

    this.add(lblUser, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL, new Insets(10, 10, 5, 0), 0, 0));
    this.add(scrollUser, new GridBagConstraints(0, 1, 1, 2, 1.0, 1.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, new Insets(0, 10, 0, 0), 0, 0));
    this.add(btnSave, new GridBagConstraints(0, 3, 1, 1, 0.0, 0.0, GridBagConstraints.SOUTHWEST,
            GridBagConstraints.NONE, new Insets(10, 10, 10, 0), 0, 0));
    this.add(this.panUnitPick, new GridBagConstraints(1, 0, 1, 2, 2.0, 1.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, new Insets(0, 10, 0, 10), 0, 0));
    this.add(this.panGroupPick, new GridBagConstraints(1, 2, 1, 1, 2.0, 1.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, new Insets(0, 10, 0, 10), 0, 0));
}

From source file:org.executequery.gui.browser.TableDataTab.java

private void init() throws Exception {

    if (displayRowCount) {

        initRowCountPanel();//w  ww  . j a v  a2  s  . c  o  m
    }

    canEditTableNotePanel = createCanEditTableNotePanel();
    canEditTableNoteConstraints = new GridBagConstraints(1, 1, 1, 1, 1.0, 0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.HORIZONTAL, new Insets(5, 5, 0, 5), 0, 0);

    scroller = new JScrollPane();
    scrollerConstraints = new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0, GridBagConstraints.SOUTHEAST,
            GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);

    rowCountPanelConstraints = new GridBagConstraints(1, 3, 1, 1, 1.0, 0, GridBagConstraints.SOUTHWEST,
            GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 5), 0, 0);

    errorLabelConstraints = new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0);

    tableDataChanges = new ArrayList<TableDataChange>();
    alwaysShowCanEditNotePanel = SystemProperties.getBooleanProperty(Constants.USER_PROPERTIES_KEY,
            "browser.always.show.table.editable.label");

    cancelPanel = new InterruptibleProcessPanel("Executing query for data...");

    EventMediator.registerListener(this);
}