Example usage for java.awt GridBagConstraints REMAINDER

List of usage examples for java.awt GridBagConstraints REMAINDER

Introduction

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

Prototype

int REMAINDER

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

Click Source Link

Document

Specifies that this component is the last component in its column or row.

Usage

From source file:org.openmicroscopy.shoola.agents.dataBrowser.view.SearchPanel.java

/** Builds and lays out the UI. */
private void buildGUI() {
    setBorder(null);/*from  ww w  .  ja va  2  s . c o  m*/
    setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    c.gridy = 0;
    c.gridx = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;
    setBackground(UIUtilities.BACKGROUND_COLOR);

    add(buildSearchFor(), c);// , "0, 0");

    SeparatorPane sep = new SeparatorPane();
    sep.setBackground(UIUtilities.BACKGROUND_COLOR);
    c.gridy++;
    add(sep, c);// , "0, 1");

    JPanel typePanel = buildType();
    c.gridy++;
    add(typePanel, c);// , "0, 2")

    JPanel fieldsPanel = buildFields();
    c.gridy++;
    add(fieldsPanel, c);// , "0, 2");

    JPanel scopePanel = buildScope();
    c.gridy++;
    add(scopePanel, c);// , "0, 2");

    JPanel datePanel = buildDate();
    c.gridy++;
    add(datePanel, c);// , "0, 4");

    updateUsersBox();
}

From source file:net.sf.jabref.groups.GroupSelector.java

/**
 * The first element for each group defines which field to use for the quicksearch. The next two define the name and
 * regexp for the group.// w  ww  .j  a va  2s  . c om
 */
public GroupSelector(JabRefFrame frame, SidePaneManager manager) {
    super(manager, IconTheme.JabRefIcon.TOGGLE_GROUPS.getIcon(), Localization.lang("Groups"));
    this.groupsRoot = new GroupTreeNode(new AllEntriesGroup());

    this.frame = frame;
    hideNonHits = new JRadioButtonMenuItem(Localization.lang("Hide non-hits"),
            !Globals.prefs.getBoolean(JabRefPreferences.GRAY_OUT_NON_HITS));
    grayOut = new JRadioButtonMenuItem(Localization.lang("Gray out non-hits"),
            Globals.prefs.getBoolean(JabRefPreferences.GRAY_OUT_NON_HITS));
    ButtonGroup nonHits = new ButtonGroup();
    nonHits.add(hideNonHits);
    nonHits.add(grayOut);
    floatCb.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent event) {
            Globals.prefs.putBoolean(JabRefPreferences.GROUP_FLOAT_SELECTIONS, floatCb.isSelected());
        }
    });
    andCb.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent event) {
            Globals.prefs.putBoolean(JabRefPreferences.GROUP_INTERSECT_SELECTIONS, andCb.isSelected());
        }
    });
    invCb.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent event) {
            Globals.prefs.putBoolean(JabRefPreferences.GROUP_INVERT_SELECTIONS, invCb.isSelected());
        }
    });
    showOverlappingGroups.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent event) {
            Globals.prefs.putBoolean(JabRefPreferences.GROUP_SHOW_OVERLAPPING,
                    showOverlappingGroups.isSelected());
            if (!showOverlappingGroups.isSelected()) {
                groupsTree.setHighlight2Cells(null);
            }
        }
    });

    select.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent event) {
            Globals.prefs.putBoolean(JabRefPreferences.GROUP_SELECT_MATCHES, select.isSelected());
        }
    });
    grayOut.addChangeListener(
            event -> Globals.prefs.putBoolean(JabRefPreferences.GRAY_OUT_NON_HITS, grayOut.isSelected()));

    JRadioButtonMenuItem highlCb = new JRadioButtonMenuItem(Localization.lang("Highlight"), false);
    if (Globals.prefs.getBoolean(JabRefPreferences.GROUP_FLOAT_SELECTIONS)) {

        floatCb.setSelected(true);
        highlCb.setSelected(false);
    } else {
        highlCb.setSelected(true);
        floatCb.setSelected(false);
    }
    JRadioButtonMenuItem orCb = new JRadioButtonMenuItem(Localization.lang("Union"), false);
    if (Globals.prefs.getBoolean(JabRefPreferences.GROUP_INTERSECT_SELECTIONS)) {
        andCb.setSelected(true);
        orCb.setSelected(false);
    } else {
        orCb.setSelected(true);
        andCb.setSelected(false);
    }

    showNumberOfElements.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent e) {
            Globals.prefs.putBoolean(JabRefPreferences.GROUP_SHOW_NUMBER_OF_ELEMENTS,
                    showNumberOfElements.isSelected());
            if (groupsTree != null) {
                groupsTree.invalidate();
                groupsTree.validate();
                groupsTree.repaint();
            }
        }
    });

    autoAssignGroup.addChangeListener(new ChangeListener() {

        @Override
        public void stateChanged(ChangeEvent event) {
            Globals.prefs.putBoolean(JabRefPreferences.AUTO_ASSIGN_GROUP, autoAssignGroup.isSelected());
        }
    });

    invCb.setSelected(Globals.prefs.getBoolean(JabRefPreferences.GROUP_INVERT_SELECTIONS));
    showOverlappingGroups.setSelected(Globals.prefs.getBoolean(JabRefPreferences.GROUP_SHOW_OVERLAPPING));
    select.setSelected(Globals.prefs.getBoolean(JabRefPreferences.GROUP_SELECT_MATCHES));
    editModeIndicator = Globals.prefs.getBoolean(JabRefPreferences.EDIT_GROUP_MEMBERSHIP_MODE);
    editModeCb.setSelected(editModeIndicator);
    showNumberOfElements.setSelected(Globals.prefs.getBoolean(JabRefPreferences.GROUP_SHOW_NUMBER_OF_ELEMENTS));
    autoAssignGroup.setSelected(Globals.prefs.getBoolean(JabRefPreferences.AUTO_ASSIGN_GROUP));

    openset.setMargin(new Insets(0, 0, 0, 0));
    settings.add(andCb);
    settings.add(orCb);
    settings.addSeparator();
    settings.add(invCb);
    settings.addSeparator();
    settings.add(select);
    settings.addSeparator();
    settings.add(editModeCb);
    settings.addSeparator();
    settings.add(grayOut);
    settings.add(hideNonHits);
    settings.addSeparator();
    settings.add(showOverlappingGroups);
    settings.addSeparator();
    settings.add(showNumberOfElements);
    settings.add(autoAssignGroup);
    // settings.add(moreRow);
    // settings.add(lessRow);
    openset.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            if (!settings.isVisible()) {
                JButton src = (JButton) e.getSource();
                showNumberOfElements
                        .setSelected(Globals.prefs.getBoolean(JabRefPreferences.GROUP_SHOW_NUMBER_OF_ELEMENTS));
                autoAssignGroup.setSelected(Globals.prefs.getBoolean(JabRefPreferences.AUTO_ASSIGN_GROUP));
                settings.show(src, 0, openset.getHeight());
            }
        }
    });
    JButton expand = new JButton(IconTheme.JabRefIcon.ADD_ROW.getSmallIcon());
    expand.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int i = Globals.prefs.getInt(JabRefPreferences.GROUPS_VISIBLE_ROWS) + 1;
            groupsTree.setVisibleRowCount(i);
            groupsTree.revalidate();
            groupsTree.repaint();
            GroupSelector.this.revalidate();
            GroupSelector.this.repaint();
            Globals.prefs.putInt(JabRefPreferences.GROUPS_VISIBLE_ROWS, i);
            LOGGER.info("Height: " + GroupSelector.this.getHeight() + "; Preferred height: "
                    + GroupSelector.this.getPreferredSize().getHeight());
        }
    });
    JButton reduce = new JButton(IconTheme.JabRefIcon.REMOVE_ROW.getSmallIcon());
    reduce.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            int i = Globals.prefs.getInt(JabRefPreferences.GROUPS_VISIBLE_ROWS) - 1;
            if (i < 1) {
                i = 1;
            }
            groupsTree.setVisibleRowCount(i);
            groupsTree.revalidate();
            groupsTree.repaint();
            GroupSelector.this.revalidate();
            // _panel.sidePaneManager.revalidate();
            GroupSelector.this.repaint();
            Globals.prefs.putInt(JabRefPreferences.GROUPS_VISIBLE_ROWS, i);
        }
    });

    editModeCb.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            editModeIndicator = editModeCb.getState();
            updateBorder(editModeIndicator);
            Globals.prefs.putBoolean(JabRefPreferences.EDIT_GROUP_MEMBERSHIP_MODE, editModeIndicator);
        }
    });

    int butSize = newButton.getIcon().getIconHeight() + 5;
    Dimension butDim = new Dimension(butSize, butSize);
    //Dimension butDimSmall = new Dimension(20, 20);

    newButton.setPreferredSize(butDim);
    newButton.setMinimumSize(butDim);
    refresh.setPreferredSize(butDim);
    refresh.setMinimumSize(butDim);
    JButton helpButton = new HelpAction(Localization.lang("Help on groups"), HelpFiles.groupsHelp)
            .getHelpButton();
    helpButton.setPreferredSize(butDim);
    helpButton.setMinimumSize(butDim);
    autoGroup.setPreferredSize(butDim);
    autoGroup.setMinimumSize(butDim);
    openset.setPreferredSize(butDim);
    openset.setMinimumSize(butDim);
    expand.setPreferredSize(butDim);
    expand.setMinimumSize(butDim);
    reduce.setPreferredSize(butDim);
    reduce.setMinimumSize(butDim);
    Insets butIns = new Insets(0, 0, 0, 0);
    helpButton.setMargin(butIns);
    reduce.setMargin(butIns);
    expand.setMargin(butIns);
    openset.setMargin(butIns);
    newButton.addActionListener(this);
    refresh.addActionListener(this);
    andCb.addActionListener(this);
    orCb.addActionListener(this);
    invCb.addActionListener(this);
    showOverlappingGroups.addActionListener(this);
    autoGroup.addActionListener(this);
    floatCb.addActionListener(this);
    highlCb.addActionListener(this);
    select.addActionListener(this);
    hideNonHits.addActionListener(this);
    grayOut.addActionListener(this);
    newButton.setToolTipText(Localization.lang("New group"));
    refresh.setToolTipText(Localization.lang("Refresh view"));
    andCb.setToolTipText(Localization.lang("Display only entries belonging to all selected groups."));
    orCb.setToolTipText(
            Localization.lang("Display all entries belonging to one or more of the selected groups."));
    autoGroup.setToolTipText(Localization.lang("Automatically create groups for database."));
    invCb.setToolTipText(Localization.lang("Show entries *not* in group selection"));
    showOverlappingGroups.setToolTipText(Localization
            .lang("Highlight groups that contain entries contained in any currently selected group"));
    floatCb.setToolTipText(Localization.lang("Move entries in group selection to the top"));
    highlCb.setToolTipText(Localization.lang("Gray out entries not in group selection"));
    select.setToolTipText(Localization.lang("Select entries in group selection"));
    expand.setToolTipText(Localization.lang("Show one more row"));
    reduce.setToolTipText(Localization.lang("Show one less rows"));
    editModeCb.setToolTipText(Localization.lang("Click group to toggle membership of selected entries"));
    ButtonGroup bgr = new ButtonGroup();
    bgr.add(andCb);
    bgr.add(orCb);
    ButtonGroup visMode = new ButtonGroup();
    visMode.add(floatCb);
    visMode.add(highlCb);

    JPanel main = new JPanel();
    GridBagLayout gbl = new GridBagLayout();
    main.setLayout(gbl);

    GridBagConstraints con = new GridBagConstraints();
    con.fill = GridBagConstraints.BOTH;
    //con.insets = new Insets(0, 0, 2, 0);
    con.weightx = 1;
    con.gridwidth = 1;
    con.gridx = 0;
    con.gridy = 0;
    //con.insets = new Insets(1, 1, 1, 1);
    gbl.setConstraints(newButton, con);
    main.add(newButton);
    con.gridx = 1;
    gbl.setConstraints(refresh, con);
    main.add(refresh);
    con.gridx = 2;
    gbl.setConstraints(autoGroup, con);
    main.add(autoGroup);
    con.gridx = 3;
    con.gridwidth = GridBagConstraints.REMAINDER;

    gbl.setConstraints(helpButton, con);
    main.add(helpButton);

    // header.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.red));
    // helpButton.setBorder(BorderFactory.createMatteBorder(1,1,1,1,Color.red));
    groupsTree = new GroupsTree(this);
    groupsTree.addTreeSelectionListener(this);
    groupsTree.setModel(groupsTreeModel = new DefaultTreeModel(groupsRoot));
    JScrollPane sp = new JScrollPane(groupsTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    revalidateGroups();
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weighty = 1;
    con.gridx = 0;
    con.gridwidth = 4;
    con.gridy = 1;
    gbl.setConstraints(sp, con);
    main.add(sp);

    JPanel pan = new JPanel();
    GridBagLayout gb = new GridBagLayout();
    con.weighty = 0;
    gbl.setConstraints(pan, con);
    pan.setLayout(gb);
    con.insets = new Insets(0, 0, 0, 0);
    con.gridx = 0;
    con.gridy = 0;
    con.weightx = 1;
    con.gridwidth = 4;
    con.fill = GridBagConstraints.HORIZONTAL;
    gb.setConstraints(openset, con);
    pan.add(openset);

    con.gridwidth = 1;
    con.gridx = 4;
    con.gridy = 0;
    gb.setConstraints(expand, con);
    pan.add(expand);

    con.gridx = 5;
    gb.setConstraints(reduce, con);
    pan.add(reduce);

    con.gridwidth = 6;
    con.gridy = 1;
    con.gridx = 0;
    con.fill = GridBagConstraints.HORIZONTAL;

    con.gridy = 2;
    con.gridx = 0;
    con.gridwidth = 4;
    gbl.setConstraints(pan, con);
    main.add(pan);
    main.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
    add(main, BorderLayout.CENTER);
    updateBorder(editModeIndicator);
    definePopup();
    NodeAction moveNodeUpAction = new MoveNodeUpAction();
    moveNodeUpAction.putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.CTRL_MASK));
    NodeAction moveNodeDownAction = new MoveNodeDownAction();
    moveNodeDownAction.putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.CTRL_MASK));
    NodeAction moveNodeLeftAction = new MoveNodeLeftAction();
    moveNodeLeftAction.putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.CTRL_MASK));
    NodeAction moveNodeRightAction = new MoveNodeRightAction();
    moveNodeRightAction.putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.CTRL_MASK));
}

From source file:com.ciphertool.zodiacengine.gui.view.SwingUserInterface.java

private void appendMaxMutationsPerIndividualSpinner(GridBagLayout gridBagLayout, GridBagConstraints constraints,
        JPanel mainPanel) {/*from w  w w.j a  v a2  s .  com*/
    SpinnerModel maxMutationsPerIndividualModel = new SpinnerNumberModel(maxMutationsPerIndividualInitial,
            MAX_MUTATION_MIN, MAX_MUTATION_MAX, MAX_MUTATION_STEP);
    maxMutationsPerIndividualSpinner = new JSpinner(maxMutationsPerIndividualModel);
    JLabel maxMutationsPerIndividualLabel = new JLabel(maxMutationsPerIndividualText);
    maxMutationsPerIndividualLabel.setLabelFor(maxMutationsPerIndividualSpinner);

    constraints.weightx = LAYOUT_LABEL_WEIGHT;
    constraints.gridwidth = GridBagConstraints.RELATIVE;
    gridBagLayout.setConstraints(maxMutationsPerIndividualLabel, constraints);
    mainPanel.add(maxMutationsPerIndividualLabel);
    constraints.weightx = LAYOUT_INPUT_WEIGHT;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(maxMutationsPerIndividualSpinner, constraints);
    mainPanel.add(maxMutationsPerIndividualSpinner);
}

From source file:com.rapidminer.gui.properties.RegexpPropertyDialog.java

public RegexpPropertyDialog(final Collection<String> items, String predefinedRegexp, String description) {
    super(ApplicationFrame.getApplicationFrame(), "parameter.regexp", ModalityType.APPLICATION_MODAL,
            new Object[] {});
    this.items = items;
    this.supportsItems = items != null;
    this.infoText = "<html>" + I18N.getMessage(I18N.getGUIBundle(), getKey() + ".title") + ": <br/>"
            + description + "</html>";
    Dimension size = new Dimension(420, 500);
    this.setMinimumSize(size);
    this.setPreferredSize(size);

    JPanel panel = new JPanel(createGridLayout(1, supportsItems ? 2 : 1));

    // create regexp text field
    regexpTextField = new JTextField(predefinedRegexp);
    regexpTextField.setToolTipText(/*from w ww.j av a  2s  . co m*/
            I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.tip"));
    regexpTextField.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent e) {
        }

        @Override
        public void keyReleased(KeyEvent e) {
            fireRegularExpressionUpdated();
        }

        @Override
        public void keyTyped(KeyEvent e) {
        }

    });
    regexpTextField.requestFocus();

    // create replacement text field
    replacementTextField = new JTextField();
    replacementTextField.setToolTipText(
            I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.replacement.tip"));
    replacementTextField.addKeyListener(new KeyListener() {

        @Override
        public void keyPressed(KeyEvent e) {
        }

        @Override
        public void keyReleased(KeyEvent e) {
            fireRegularExpressionUpdated();
        }

        @Override
        public void keyTyped(KeyEvent e) {
        }

    });

    // create inline search documents
    inlineSearchDocument = new RegexpSearchStyledDocument();
    inlineReplaceDocument = new RegexpReplaceStyledDocument();

    // create search results list
    DefaultListCellRenderer resultCellRenderer = new DefaultListCellRenderer() {

        private static final long serialVersionUID = 1L;

        @Override
        public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
                boolean cellHasFocus) {
            super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
            setBackground(list.getBackground());
            setForeground(list.getForeground());
            setBorder(getNoFocusBorder());
            return this;
        }

        private Border getNoFocusBorder() {
            Border border = BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray);
            return border;
        }
    };

    JList<RegExpResult> regexpFindingsList = new JList<RegExpResult>(resultsListModel);
    regexpFindingsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    regexpFindingsList.setLayoutOrientation(JList.VERTICAL);
    regexpFindingsList.setCellRenderer(resultCellRenderer);

    // regexp panel on left side of dialog
    JPanel regexpPanel = new JPanel(new GridBagLayout());
    regexpPanel.setBorder(createTitledBorder(
            I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.regular_expression.border")));
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(4, 4, 4, 0);
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    regexpPanel.add(regexpTextField, c);

    // make shortcut button
    final Action nullAction = new DefaultAction();
    PlainArrowDropDownButton autoWireDropDownButton = PlainArrowDropDownButton.makeDropDownButton(nullAction);

    for (String[] popupItem : (String[][]) ArrayUtils.addAll(regexpConstructs, regexpShortcuts)) {
        String shortcut = popupItem[0].length() > 14 ? popupItem[0].substring(0, 14) + "..." : popupItem[0];
        autoWireDropDownButton
                .add(new InsertionAction("<html><table border=0 cellpadding=0 cellspacing=0><tr><td width=100>"
                        + shortcut + "</td><td>" + popupItem[1] + "</td></tr></table></html>", popupItem[0]));
    }
    c.insets = new Insets(4, 0, 4, 0);
    c.gridx = 1;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    regexpPanel.add(autoWireDropDownButton.getDropDownArrowButton(), c);

    // make delete button
    c.insets = new Insets(4, 0, 4, 4);
    c.gridx = 2;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    JButton clearRegexpTextFieldButton = new JButton(SwingTools.createIcon("16/delete2.png"));
    clearRegexpTextFieldButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            regexpTextField.setText("");
            fireRegularExpressionUpdated();
            regexpTextField.requestFocusInWindow();
        }
    });

    regexpPanel.add(clearRegexpTextFieldButton, c);

    errorMessage = new JLabel(NO_ERROR_MESSAGE, NO_ERROR_ICON, SwingConstants.LEFT);
    errorMessage.setFocusable(false);
    c.insets = new Insets(4, 8, 4, 4);
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    regexpPanel.add(errorMessage, c);

    // create replacement panel
    JPanel replacementPanel = new JPanel(new GridBagLayout());
    replacementPanel.setBorder(createTitledBorder(
            I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.replacement.border")));

    JPanel testerPanel = new JPanel(new GridBagLayout());

    c.insets = new Insets(4, 4, 4, 0);
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    replacementPanel.add(replacementTextField, c);

    // create inline search panel
    JPanel inlineSearchPanel = new JPanel(new GridBagLayout());

    c.insets = new Insets(8, 4, 4, 4);
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    inlineSearchPanel.add(
            new JLabel(
                    I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.inline_search.search")),
            c);

    c.insets = new Insets(0, 0, 0, 0);
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    inlineSearchPanel.add(new JScrollPane(new JTextPane(inlineSearchDocument)), c);

    c.insets = new Insets(8, 4, 4, 4);
    c.gridx = 0;
    c.gridy = 2;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    inlineSearchPanel.add(
            new JLabel(
                    I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.inline_search.replaced")),
            c);

    c.insets = new Insets(0, 0, 0, 0);
    c.gridx = 0;
    c.gridy = 3;
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    JTextPane replaceTextPane = new JTextPane(inlineReplaceDocument);
    replaceTextPane.setEditable(false);
    inlineSearchPanel.add(new JScrollPane(replaceTextPane), c);

    // create regexp options panel
    ItemListener defaultOptionListener = new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            fireRegexpOptionsChanged();
        }
    };

    cbCaseInsensitive = new JCheckBox(I18N.getMessage(I18N.getGUIBundle(),
            "gui.dialog.parameter.regexp.regular_expression.regexp_options.case_insensitive"));
    cbCaseInsensitive.setToolTipText(I18N.getMessage(I18N.getGUIBundle(),
            "gui.dialog.parameter.regexp.regular_expression.regexp_options.case_insensitive.tip"));
    cbCaseInsensitive.addItemListener(defaultOptionListener);

    cbMultiline = new JCheckBox(I18N.getMessage(I18N.getGUIBundle(),
            "gui.dialog.parameter.regexp.regular_expression.regexp_options.multiline_mode"));
    cbMultiline.setToolTipText(I18N.getMessage(I18N.getGUIBundle(),
            "gui.dialog.parameter.regexp.regular_expression.regexp_options.multiline_mode.tip"));
    cbMultiline.addItemListener(defaultOptionListener);

    cbDotall = new JCheckBox(I18N.getMessage(I18N.getGUIBundle(),
            "gui.dialog.parameter.regexp.regular_expression.regexp_options.dotall_mode"));
    cbDotall.setToolTipText(I18N.getMessage(I18N.getGUIBundle(),
            "gui.dialog.parameter.regexp.regular_expression.regexp_options.dotall_mode.tip"));
    cbDotall.addItemListener(defaultOptionListener);

    cbUnicodeCase = new JCheckBox(I18N.getMessage(I18N.getGUIBundle(),
            "gui.dialog.parameter.regexp.regular_expression.regexp_options.unicode_case"));
    cbUnicodeCase.setToolTipText(I18N.getMessage(I18N.getGUIBundle(),
            "gui.dialog.parameter.regexp.regular_expression.regexp_options.unicode_case.tip"));
    cbUnicodeCase.addItemListener(defaultOptionListener);

    JPanel regexpOptionsPanelWrapper = new JPanel(new BorderLayout());
    JPanel regexpOptionsPanel = new JPanel(new GridBagLayout());
    regexpOptionsPanelWrapper.add(regexpOptionsPanel, BorderLayout.NORTH);

    c.insets = new Insets(12, 4, 0, 4);
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    regexpOptionsPanel.add(cbMultiline, c);
    c.insets = new Insets(8, 4, 0, 4);
    c.gridy = 1;
    regexpOptionsPanel.add(cbCaseInsensitive, c);
    c.gridy = 2;
    regexpOptionsPanel.add(cbUnicodeCase, c);
    c.gridy = 3;
    regexpOptionsPanel.add(cbDotall, c);

    // create tabbed panel
    c.insets = new Insets(8, 4, 4, 4);
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.BOTH;
    testExp = new JTabbedPane();
    testExp.add(
            I18N.getMessage(I18N.getGUIBundle(),
                    "gui.dialog.parameter.regexp.regular_expression.inline_search.title"),
            new JScrollPane(inlineSearchPanel));
    testExp.add(
            I18N.getMessage(I18N.getGUIBundle(),
                    "gui.dialog.parameter.regexp.regular_expression.result_list.title"),
            new JScrollPane(regexpFindingsList));
    testExp.add(
            I18N.getMessage(I18N.getGUIBundle(),
                    "gui.dialog.parameter.regexp.regular_expression.regexp_options.title"),
            regexpOptionsPanelWrapper);
    testerPanel.add(testExp, c);

    JPanel groupPanel = new JPanel(new GridBagLayout());
    c.insets = new Insets(4, 4, 4, 4);
    c.gridx = 0;
    c.gridy = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    groupPanel.add(regexpPanel, c);

    c.insets = new Insets(4, 4, 4, 4);
    c.gridx = 0;
    c.gridy = 1;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    groupPanel.add(replacementPanel, c);

    c.insets = new Insets(4, 4, 4, 4);
    c.gridx = 0;
    c.gridy = 2;
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    groupPanel.add(testerPanel, c);

    panel.add(groupPanel, 1, 0);

    if (supportsItems) {
        // item shortcuts list
        itemShortcutsList = new JList<String>(items.toArray(new String[items.size()]));
        itemShortcutsList.setToolTipText(
                I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.item_shortcuts.tip"));
        itemShortcutsList.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        itemShortcutsList.addMouseListener(new MouseListener() {

            @Override
            public void mouseClicked(MouseEvent e) {
                if (e.getClickCount() == 2) {
                    String text = regexpTextField.getText();
                    int cursorPosition = regexpTextField.getCaretPosition();
                    int index = itemShortcutsList.getSelectedIndex();
                    if (index > -1 && index < itemShortcutsList.getModel().getSize()) {
                        String insertionString = itemShortcutsList.getModel().getElementAt(index).toString();
                        String newText = text.substring(0, cursorPosition) + insertionString
                                + (cursorPosition < text.length() ? text.substring(cursorPosition) : "");
                        regexpTextField.setText(newText);
                        regexpTextField.setCaretPosition(cursorPosition + insertionString.length());
                        regexpTextField.requestFocus();
                        fireRegularExpressionUpdated();
                    }
                }
            }

            @Override
            public void mouseEntered(MouseEvent e) {
            }

            @Override
            public void mouseExited(MouseEvent e) {
            }

            @Override
            public void mousePressed(MouseEvent e) {
            }

            @Override
            public void mouseReleased(MouseEvent e) {
            }
        });
        JScrollPane itemShortcutsPane = new JScrollPane(itemShortcutsList);
        itemShortcutsPane.setBorder(createTitledBorder(
                I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.item_shortcuts.border")));

        // matched items list
        matchedItemsListModel = new DefaultListModel<String>();
        JList<String> matchedItemsList = new JList<String>(matchedItemsListModel);
        matchedItemsList.setToolTipText(
                I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.matched_items.tip"));
        // add custom cell renderer to disallow selections
        matchedItemsList.setCellRenderer(new DefaultListCellRenderer() {

            private static final long serialVersionUID = -5795848004756768378L;

            @Override
            public Component getListCellRendererComponent(JList list, Object value, int index,
                    boolean isSelected, boolean cellHasFocus) {
                return super.getListCellRendererComponent(list, value, index, false, false);
            }
        });
        JScrollPane matchedItemsPanel = new JScrollPane(matchedItemsList);
        matchedItemsPanel.setBorder(createTitledBorder(
                I18N.getMessage(I18N.getGUIBundle(), "gui.dialog.parameter.regexp.matched_items.border")));

        // item panel on right side of dialog
        JPanel itemPanel = new JPanel(createGridLayout(1, 2));
        itemPanel.add(itemShortcutsPane, 0, 0);
        itemPanel.add(matchedItemsPanel, 0, 1);

        panel.add(itemPanel, 0, 1);
    }

    okButton = makeOkButton("regexp_property_dialog_apply");
    fireRegularExpressionUpdated();

    layoutDefault(panel, supportsItems ? NORMAL : NARROW, okButton, makeCancelButton());
}

From source file:pcgen.gui2.tabs.SummaryInfoTab.java

private void initLevelPanel(JPanel panel) {
    panel.setLayout(new GridBagLayout());
    JLabel addLabel = createLabel("in_sumAddLevels"); //$NON-NLS-1$
    JLabel removeLabel = createLabel("in_sumRemoveLevels"); //$NON-NLS-1$
    JLabel darrowLabel = new JLabel(Icons.button_arrow_down.getImageIcon());
    JLabel uarrowLabel = new JLabel(Icons.button_arrow_up.getImageIcon());

    addLevelsButton.setMargin(new Insets(0, 8, 0, 8));
    addLevelsField.setValue(1);//from   ww  w  .  j  av a  2s  . c  om
    addLevelsField.setHorizontalAlignment(SwingConstants.RIGHT);
    removeLevelsButton.setMargin(new Insets(0, 8, 0, 8));
    removeLevelsField.setValue(1);
    removeLevelsField.setHorizontalAlignment(SwingConstants.RIGHT);

    GridBagConstraints gbc1 = new GridBagConstraints();
    GridBagConstraints gbc2 = new GridBagConstraints();
    gbc1.weightx = gbc2.weightx = 0.5;
    gbc1.insets = new Insets(1, 0, 1, 0);
    gbc2.insets = new Insets(1, 0, 1, 0);
    gbc2.gridwidth = GridBagConstraints.REMAINDER;
    panel.add(addLabel, gbc1);
    panel.add(removeLabel, gbc2);
    gbc1.ipadx = 30;
    panel.add(addLevelsField, gbc1);
    gbc2.ipadx = 30;
    panel.add(removeLevelsField, gbc2);
    gbc1.ipadx = 0;
    panel.add(addLevelsButton, gbc1);
    gbc2.ipadx = 0;
    panel.add(removeLevelsButton, gbc2);
    panel.add(darrowLabel, gbc1);
    panel.add(uarrowLabel, gbc2);

    ClassLevelTableModel.initializeTable(classLevelTable);
    gbc2.weightx = 0;
    gbc2.weighty = 1;
    gbc2.fill = GridBagConstraints.BOTH;
    panel.add(new JScrollPane(classLevelTable), gbc2);
}

From source file:be.agiv.security.demo.Main.java

private void invokeClaimsAwareService() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    JPanel contentPanel = new JPanel(gridBagLayout);

    final JLabel ipStsLabel = new JLabel("IP-STS:");
    gridBagConstraints.gridx = 0;/*from  www .j av  a 2s .co m*/
    gridBagConstraints.gridy = 0;
    gridBagConstraints.anchor = GridBagConstraints.WEST;
    gridBagConstraints.ipadx = 5;
    gridBagLayout.setConstraints(ipStsLabel, gridBagConstraints);
    contentPanel.add(ipStsLabel);

    final JTextField ipStsTextField = new JTextField(
            "https://auth.beta.agiv.be/ipsts/Services/DaliSecurityTokenServiceConfiguration.svc/IWSTrust13",
            60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(ipStsTextField, gridBagConstraints);
    contentPanel.add(ipStsTextField);

    JLabel realmLabel = new JLabel("Realm:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(realmLabel, gridBagConstraints);
    contentPanel.add(realmLabel);

    JTextField realmTextField = new JTextField(AGIVSecurity.BETA_REALM, 30);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(realmTextField, gridBagConstraints);
    contentPanel.add(realmTextField);

    final CredentialPanel credentialPanel = new CredentialPanel();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(credentialPanel, gridBagConstraints);
    contentPanel.add(credentialPanel);

    final JLabel rStsLabel = new JLabel("R-STS:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = 1;
    gridBagLayout.setConstraints(rStsLabel, gridBagConstraints);
    contentPanel.add(rStsLabel);

    final JTextField rStsTextField = new JTextField(
            "https://auth.beta.agiv.be/sts/Services/SalvadorSecurityTokenServiceConfiguration.svc/IWSTrust13",
            60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(rStsTextField, gridBagConstraints);
    contentPanel.add(rStsTextField);

    JLabel serviceRealmLabel = new JLabel("Service realm:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(serviceRealmLabel, gridBagConstraints);
    contentPanel.add(serviceRealmLabel);

    JTextField serviceRealmTextField = new JTextField(ClaimsAwareServiceFactory.SERVICE_REALM, 60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(serviceRealmTextField, gridBagConstraints);
    contentPanel.add(serviceRealmTextField);

    JLabel urlLabel = new JLabel("Service URL:");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagLayout.setConstraints(urlLabel, gridBagConstraints);
    contentPanel.add(urlLabel);

    JTextField urlTextField = new JTextField(ClaimsAwareServiceFactory.SERVICE_LOCATION, 60);
    gridBagConstraints.gridx++;
    gridBagLayout.setConstraints(urlTextField, gridBagConstraints);
    contentPanel.add(urlTextField);

    final JCheckBox noWsPolicyCheckBox = new JCheckBox("WSDL without WS-Policy");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(noWsPolicyCheckBox, gridBagConstraints);
    contentPanel.add(noWsPolicyCheckBox);

    final JCheckBox useWsSecureConversationCheckBox = new JCheckBox("Use WS-SecureConversation");
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(useWsSecureConversationCheckBox, gridBagConstraints);
    contentPanel.add(useWsSecureConversationCheckBox);

    final JCheckBox usePreviousSecurityCheckBox = new JCheckBox("Use previous AGIV Security");
    final JCheckBox cancelPreviousSecureConversationToken = new JCheckBox("Cancel previous conversation token");
    usePreviousSecurityCheckBox.setEnabled(null != this.agivSecurity);
    cancelPreviousSecureConversationToken.setEnabled(false);
    usePreviousSecurityCheckBox.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            LOG.debug("use previous security: " + usePreviousSecurityCheckBox.isSelected());
            boolean newSecurity = !usePreviousSecurityCheckBox.isSelected();
            ipStsLabel.setEnabled(newSecurity);
            ipStsTextField.setEditable(newSecurity);
            credentialPanel.setEnabled(newSecurity);
            rStsLabel.setEnabled(newSecurity);
            rStsTextField.setEnabled(newSecurity);
            cancelPreviousSecureConversationToken.setEnabled(!newSecurity);
        }
    });
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(usePreviousSecurityCheckBox, gridBagConstraints);
    contentPanel.add(usePreviousSecurityCheckBox);

    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(cancelPreviousSecureConversationToken, gridBagConstraints);
    contentPanel.add(cancelPreviousSecureConversationToken);

    JPanel expiresPanel = new JPanel();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy++;
    gridBagConstraints.gridwidth = 2;
    gridBagLayout.setConstraints(expiresPanel, gridBagConstraints);
    contentPanel.add(expiresPanel);

    JLabel expiresLabelLabel = new JLabel("Secure conversation token expires:");
    expiresLabelLabel.setEnabled(null != this.agivSecurity);
    expiresPanel.add(expiresLabelLabel);

    JLabel expiresLabel = new JLabel();
    expiresLabel.setEnabled(null != this.agivSecurity);
    expiresPanel.add(expiresLabel);
    if (null != this.agivSecurity) {
        if (false == this.agivSecurity.getSecureConversationTokens().isEmpty()) {
            SecurityToken secureConversationToken = this.agivSecurity.getSecureConversationTokens().values()
                    .iterator().next();
            expiresLabel.setText(secureConversationToken.getExpires().toString());
        }
    }

    int dialogResult = JOptionPane.showConfirmDialog(this, contentPanel, "Claims Aware Service",
            JOptionPane.OK_CANCEL_OPTION);
    if (dialogResult == JOptionPane.CANCEL_OPTION) {
        return;
    }

    final String location = urlTextField.getText();
    final String serviceRealm = serviceRealmTextField.getText();
    final String ipStsLocation = ipStsTextField.getText();
    final String rStsLocation = rStsTextField.getText();
    final String username = credentialPanel.getUsername();
    final String password = credentialPanel.getPassword();
    final File pkcs12File = credentialPanel.getPKCS12File();
    final String realm = realmTextField.getText();

    ExecutorService executor = Executors.newFixedThreadPool(1);
    FutureTask<ArrayOfClaimInfo> futureTask = new FutureTask<ArrayOfClaimInfo>(
            new Callable<ArrayOfClaimInfo>() {

                public ArrayOfClaimInfo call() throws Exception {
                    Service service;
                    if (noWsPolicyCheckBox.isSelected()) {
                        service = ClaimsAwareServiceFactory.getInstanceNoWSPolicy();
                    } else {
                        service = ClaimsAwareServiceFactory.getInstance();
                    }
                    IService iservice = service.getWS2007FederationHttpBindingIService(new AddressingFeature());
                    BindingProvider bindingProvider = (BindingProvider) iservice;

                    if (false == usePreviousSecurityCheckBox.isSelected()) {
                        if (null != username) {
                            Main.this.agivSecurity = new AGIVSecurity(ipStsLocation, rStsLocation, realm,
                                    username, password);
                        } else {
                            Main.this.agivSecurity = new AGIVSecurity(ipStsLocation, rStsLocation, realm,
                                    pkcs12File, password);
                        }
                        Main.this.agivSecurity.addSTSListener(Main.this);
                        if (Main.this.proxyEnable) {
                            agivSecurity.setProxy(Main.this.proxyHost, Main.this.proxyPort,
                                    Main.this.proxyType);
                        }
                    }
                    if (cancelPreviousSecureConversationToken.isSelected()) {
                        Main.this.agivSecurity.cancelSecureConversationTokens();
                    }
                    Main.this.agivSecurity.enable(bindingProvider, location,
                            useWsSecureConversationCheckBox.isSelected(), serviceRealm);

                    ArrayOfClaimInfo result = iservice.getData(0);
                    return result;
                }
            }) {

        @Override
        protected void done() {
            try {
                ArrayOfClaimInfo result = get();
                List<ClaimInfo> claims = result.getClaimInfo();
                StringBuffer message = new StringBuffer();
                for (ClaimInfo claim : claims) {
                    message.append(claim.getName());
                    message.append(" = ");
                    message.append(claim.getValue());
                    message.append("\n");
                }

                JOptionPane.showMessageDialog(Main.this, message.toString(), "Claims Aware Service Result",
                        JOptionPane.INFORMATION_MESSAGE);
            } catch (final Exception e) {
                try {
                    SwingUtilities.invokeAndWait(new Runnable() {

                        public void run() {
                            Main.this.statusBar.setErrorStatus(e.getMessage());
                        }
                    });
                } catch (Exception e1) {
                }
                showException(e);
            }
        }
    };
    executor.execute(futureTask);
}

From source file:com.ciphertool.zodiacengine.gui.view.SwingUserInterface.java

private void appendCrossoverRateSpinner(GridBagLayout gridBagLayout, GridBagConstraints constraints,
        JPanel mainPanel) {/*w w w. ja v a 2  s  .  c om*/
    SpinnerModel crossoverRateModel = new SpinnerNumberModel(crossoverInitial, CROSSOVER_MIN, CROSSOVER_MAX,
            CROSSOVER_STEP);
    crossoverRateSpinner = new JSpinner(crossoverRateModel);
    JLabel crossoverRateLabel = new JLabel(crossoverRateText);
    crossoverRateLabel.setLabelFor(crossoverRateSpinner);

    constraints.weightx = LAYOUT_LABEL_WEIGHT;
    constraints.gridwidth = GridBagConstraints.RELATIVE;
    gridBagLayout.setConstraints(crossoverRateLabel, constraints);
    mainPanel.add(crossoverRateLabel);
    constraints.weightx = LAYOUT_INPUT_WEIGHT;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(crossoverRateSpinner, constraints);
    mainPanel.add(crossoverRateSpinner);
}

From source file:com.ciphertool.zodiacengine.gui.view.SwingUserInterface.java

private void appendMutateDuringCrossoverCheckBox(GridBagLayout gridBagLayout, GridBagConstraints constraints,
        JPanel mainPanel) {/* w  w w.  ja  va2s.  c  om*/
    mutateDuringCrossoverCheckBox = new JCheckBox(mutateDuringCrossoverText);
    mutateDuringCrossoverCheckBox.setSelected(true);

    constraints.weightx = LAYOUT_LABEL_WEIGHT;
    constraints.gridwidth = GridBagConstraints.RELATIVE;
    JLabel dummyJLabel = new JLabel();
    gridBagLayout.setConstraints(dummyJLabel, constraints);
    mainPanel.add(dummyJLabel);
    constraints.weightx = LAYOUT_INPUT_WEIGHT;
    constraints.gridwidth = GridBagConstraints.REMAINDER;
    gridBagLayout.setConstraints(mutateDuringCrossoverCheckBox, constraints);
    mainPanel.add(mutateDuringCrossoverCheckBox);
}

From source file:pcgen.gui2.tabs.SummaryInfoTab.java

private void resetBasicsPanel() {
    basicsPanel.removeAll();//  w w  w . java  2 s.c o m
    GridBagConstraints gbc = new GridBagConstraints();
    {
        JLabel label = createLabel("in_sumName"); //$NON-NLS-1$
        gbc.anchor = GridBagConstraints.WEST;
        gbc.insets = new Insets(0, 0, 3, 0);
        basicsPanel.add(label, gbc);

        random.setText(LanguageBundle.getString("in_randomButton")); //$NON-NLS-1$
        random.setMargin(new Insets(0, 0, 0, 0));
        gbc.insets = new Insets(0, 2, 3, 2);
        basicsPanel.add(random, gbc);

        gbc.insets = new Insets(0, 0, 3, 2);
        gbc.gridwidth = GridBagConstraints.REMAINDER;
        gbc.fill = GridBagConstraints.BOTH;
        gbc.weightx = 1.0;
        basicsPanel.add(characterNameField, gbc);
    }
    Insets insets = new Insets(0, 0, 3, 2);
    Font labelFont = null;
    addGridBagLayer(basicsPanel, labelFont, insets, "in_sumCharType", characterTypeComboBox); //$NON-NLS-1$
    addGridBagLayer(basicsPanel, labelFont, insets, "in_sumPlayer", playerNameField); //$NON-NLS-1$
    addGridBagLayer(basicsPanel, labelFont, insets, "in_sumTabLabel", tabLabelField); //$NON-NLS-1$
    if (genderComboBox.getModel().getSize() != 0) {
        addGridBagLayer(basicsPanel, labelFont, insets, "in_sumGender", genderComboBox); //$NON-NLS-1$
    }
    if (handsComboBox.getModel().getSize() != 0) {
        addGridBagLayer(basicsPanel, labelFont, insets, "in_sumHanded", handsComboBox); //$NON-NLS-1$
    }
    if (alignmentComboBox.getModel().getSize() != 0) {
        addGridBagLayer(basicsPanel, labelFont, insets, "in_sumAlignment", alignmentComboBox); //$NON-NLS-1$
    }
    if (deityComboBox.getModel().getSize() != 0) {
        addGridBagLayer(basicsPanel, labelFont, insets, "in_domDeityLabel", deityComboBox); //$NON-NLS-1$
    }

    gbc = new GridBagConstraints();
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 1;
    gbc.insets = new Insets(6, 2, 2, 2);
    langScroll = new JScrollPane(languageTable);
    basicsPanel.add(langScroll, gbc);
    basicsPanel.revalidate();
}

From source file:savant.view.dialog.LoadGenomeDialog.java

private void updateAuxiliaryList() {
    Genome curGenome = (Genome) genomesCombo.getSelectedItem();
    auxiliaryPanel.removeAll();/* w  w  w  .java  2  s .  co  m*/
    Auxiliary[] auxes = curGenome.getAuxiliaries();
    if (auxes.length > 0) {
        GridBagConstraints gbc = new GridBagConstraints();
        gbc.gridx = 0;
        gbc.gridwidth = GridBagConstraints.REMAINDER;
        gbc.gridy = GridBagConstraints.RELATIVE;
        gbc.anchor = GridBagConstraints.WEST;
        gbc.weightx = 1.0;
        gbc.fill = GridBagConstraints.HORIZONTAL;
        for (Auxiliary aux : auxes) {
            JCheckBox cb = new JCheckBox(aux.toString());
            cb.setSelected(aux.type == AuxiliaryType.SEQUENCE); // Sequence track is checked by default.
            auxiliaryPanel.add(cb, gbc);
        }
    }
    pack();
}