Example usage for java.awt GridBagConstraints WEST

List of usage examples for java.awt GridBagConstraints WEST

Introduction

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

Prototype

int WEST

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

Click Source Link

Document

Put the component on the left side of its display area, centered vertically.

Usage

From source file:net.sf.taverna.t2.workbench.cagrid.CaGridComponent.java

private void addRefreshButton() {
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 1;/*from   w  w  w.  j ava  2s  . c o  m*/
    c.gridy = row;
    c.anchor = GridBagConstraints.WEST;
    refreshButton = new JButton("Refresh Selected Execution", WorkbenchIcons.refreshIcon);
    refreshButton.setEnabled(true);
    refreshButton.setActionCommand("refresh");
    refreshButton.addActionListener(this);
    add(refreshButton, c);

}

From source file:com.att.aro.ui.view.menu.tools.RegexWizard.java

private JPanel getFieldPanel() {
    if (fieldPanel == null) {

        fieldPanel = new JPanel();
        fieldPanel.addComponentListener(this);
        fieldPanel.setLayout(new GridBagLayout());

        GridBagConstraints constraint = new GridBagConstraints();
        constraint.gridx = 0;//  w  w w .j a  v  a 2s. com
        constraint.gridy = 0;
        constraint.insets = new Insets(0, 5, 0, 5);
        constraint.anchor = GridBagConstraints.FIRST_LINE_START;
        constraint.weightx = 1;
        constraint.fill = GridBagConstraints.HORIZONTAL;

        cbRequest = new JCheckBox(ResourceBundleHelper.getMessageString("videotab.label.checkbox"), true);
        cbRequest.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                requestField.setEditable(cbRequest.isSelected());
            }
        });
        cbHeader = new JCheckBox(ResourceBundleHelper.getMessageString("videotab.label.checkbox"), true);
        cbHeader.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                headerField.setEditable(cbHeader.isSelected());
            }
        });
        cbResponse = new JCheckBox(ResourceBundleHelper.getMessageString("videotab.label.checkbox"), true);
        cbResponse.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                responseField.setEditable(cbResponse.isSelected());
            }
        });

        compileResultsField = new JTextField();
        compileResultsField.setEditable(false);
        compileResultsField.setBackground(fieldPanel.getBackground());
        compileResultsField.setForeground(Color.red);
        compileResultsField.setFont(compileResultsField.getFont().deriveFont(Font.BOLD));

        requestField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.request"));
        requestField.setName(ResourceBundleHelper.getMessageString("videotab.field.request"));
        regexRequestField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.regex.request"));
        regexRequestField.setName(ResourceBundleHelper.getMessageString("videotab.field.regex.request"));
        responseField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.response"));
        responseField.setName(ResourceBundleHelper.getMessageString("videotab.field.response"));
        regexResponseField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.regex.response"));
        regexResponseField.setName(ResourceBundleHelper.getMessageString("videotab.field.regex.response"));
        headerField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.header"));
        headerField.setName(ResourceBundleHelper.getMessageString("videotab.field.header"));
        regexHeaderField = createTextAreaAndProperties(
                ResourceBundleHelper.getMessageString("videotab.label.regex.header"));
        regexHeaderField.setName(ResourceBundleHelper.getMessageString("videotab.field.regex.header"));

        fieldPanel.add(compileResultsField, constraint);

        constraint.gridy = 1;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.fill = GridBagConstraints.NONE;
        constraint.anchor = GridBagConstraints.EAST;
        fieldPanel.add(cbRequest, constraint);

        constraint.gridy = 2;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.fill = GridBagConstraints.HORIZONTAL;
        fieldPanel.add(requestField, constraint);

        constraint.gridy = 3;
        constraint.fill = GridBagConstraints.HORIZONTAL;
        constraint.anchor = GridBagConstraints.WEST;
        fieldPanel.add(regexRequestField, constraint);

        constraint.gridy = 4;
        constraint.fill = GridBagConstraints.NONE;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.anchor = GridBagConstraints.EAST;
        fieldPanel.add(cbHeader, constraint);
        constraint.gridy = 5;
        constraint.fill = GridBagConstraints.HORIZONTAL;
        fieldPanel.add(headerField, constraint);
        constraint.gridy = 6;
        fieldPanel.add(regexHeaderField, constraint);

        constraint.gridy = 7;
        constraint.fill = GridBagConstraints.NONE;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.anchor = GridBagConstraints.EAST;
        fieldPanel.add(cbResponse, constraint);

        constraint.gridy = 8;
        constraint.anchor = GridBagConstraints.WEST;
        constraint.fill = GridBagConstraints.HORIZONTAL;
        fieldPanel.add(responseField, constraint);

        constraint.gridy = 9;
        constraint.fill = GridBagConstraints.HORIZONTAL;
        fieldPanel.add(regexResponseField, constraint);
    }
    return fieldPanel;
}

From source file:org.pentaho.reporting.libraries.designtime.swing.table.ArrayCellEditorDialog.java

private void configurePanelWithSelection() {
    final ListSelectionModel selectionModel = table.getSelectionModel();
    final JLabel columnsLabel = new JLabel(
            Messages.getInstance().getString("ArrayCellEditorDialog.SelectedItems"));

    final Action addGroupAction = new AddEntryAction(tableModel);
    final Action removeGroupAction = new RemoveEntryAction(tableModel, selectionModel);
    final Action sortUpAction = new SortBulkUpAction(tableModel, selectionModel, table);
    final Action sortDownAction = new SortBulkDownAction(tableModel, selectionModel, table);

    final JPanel tablesPane = new JPanel();
    tablesPane.setLayout(new GridBagLayout());

    final JLabel tablesColumnsLabel = new JLabel(
            Messages.getInstance().getString("ArrayCellEditorDialog.AvailableSelection"));
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = 0;/*from   ww  w.java 2s .com*/
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    gbc.anchor = GridBagConstraints.WEST;
    tablesPane.add(tablesColumnsLabel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 0;
    gbc.gridy = 3;
    gbc.weighty = 5;
    gbc.gridheight = 1;
    gbc.weightx = 2;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(0, 5, 5, 5);
    final JScrollPane comp = new JScrollPane(paletteList, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    tablesPane.add(comp, gbc);

    gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.gridx = 2;
    gbc.gridy = 2;
    gbc.weightx = 1;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(columnsLabel, gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 3;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(sortUpAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 4;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(sortDownAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 5;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(addGroupAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 6;
    gbc.gridy = 2;
    gbc.insets = new Insets(5, 5, 5, 5);
    tablesPane.add(new BorderlessButton(removeGroupAction), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 2;
    gbc.gridy = 3;
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridwidth = 5;
    gbc.insets = new Insets(0, 5, 5, 0);
    tablesPane.add(new JScrollPane(table, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED), gbc);

    gbc = new GridBagConstraints();
    gbc.gridx = 1;
    gbc.gridy = 3;
    gbc.insets = new Insets(5, 5, 5, 0);
    tablesPane.add(new BorderlessButton(new AddSelectionAction(paletteList.getSelectionModel())), gbc);

    contentPane.removeAll();
    contentPane.add(tablesPane);
    contentPane.invalidate();
    contentPane.revalidate();
    contentPane.repaint();
}

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

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

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();/*from   ww  w  .java 2s . c  om*/
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("SaveBagFrame.title"));
    titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Define the Bag " + "settings")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    // TODO: Add bag name field
    // TODO: Add save name file selection button
    final JLabel location = new JLabel("Save in:");
    final JButton browseButton = new JButton(getMessage("bag.button.browse"));
    browseButton.addActionListener(new SaveBagAsHandler());
    browseButton.setEnabled(true);
    browseButton.setToolTipText(getMessage("bag.button.browse.help"));
    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        bagNameField = new JTextField(bag.getName());
        bagNameField.setCaretPosition(bag.getName().length());
        bagNameField.setEditable(false);
        bagNameField.setEnabled(false);
    }

    // Holey bag control
    final JLabel holeyLabel = new JLabel(bagView.getPropertyMessage("bag.label.isholey"));
    holeyLabel.setToolTipText(bagView.getPropertyMessage("bag.isholey.help"));
    final JCheckBox holeyCheckbox = new JCheckBox(bagView.getPropertyMessage("bag.checkbox" + ".isholey"));
    holeyCheckbox.setBorder(border);
    holeyCheckbox.addActionListener(new HoleyBagHandler());
    holeyCheckbox.setToolTipText(bagView.getPropertyMessage("bag.isholey.help"));

    urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    urlField = new JTextField("");
    try {
        assert bag != null;
        urlField.setText(bag.getFetch().getBaseURL());
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }
    urlField.setEnabled(false);

    // TODO: Add format label
    final JLabel serializeLabel;
    serializeLabel = new JLabel(getMessage("bag.label.ispackage"));
    serializeLabel.setToolTipText(getMessage("bag.serializetype.help"));

    // TODO: Add format selection panel
    noneButton = new JRadioButton(getMessage("bag.serializetype.none"));
    noneButton.setEnabled(true);
    final AbstractAction serializeListener = new SerializeBagHandler();
    noneButton.addActionListener(serializeListener);
    noneButton.setToolTipText(getMessage("bag.serializetype.none.help"));

    zipButton = new JRadioButton(getMessage("bag.serializetype.zip"));
    zipButton.setEnabled(true);
    zipButton.addActionListener(serializeListener);
    zipButton.setToolTipText(getMessage("bag.serializetype.zip.help"));

    /*
     * tarButton = new JRadioButton(getMessage("bag.serializetype.tar"));
     * tarButton.setEnabled(true);
     * tarButton.addActionListener(serializeListener);
     * tarButton.setToolTipText(getMessage("bag.serializetype.tar.help"));
     *
     * tarGzButton = new JRadioButton(getMessage("bag.serializetype.targz"));
     * tarGzButton.setEnabled(true);
     * tarGzButton.addActionListener(serializeListener);
     * tarGzButton.setToolTipText(getMessage("bag.serializetype.targz.help"));
     *
     * tarBz2Button = new JRadioButton(getMessage("bag.serializetype.tarbz2"));
     * tarBz2Button.setEnabled(true);
     * tarBz2Button.addActionListener(serializeListener);
     * tarBz2Button.setToolTipText(getMessage("bag.serializetype.tarbz2.help"));
     */

    short mode = 2;
    if (bag != null) {
        mode = bag.getSerialMode();
    }
    if (mode == DefaultBag.NO_MODE) {
        this.noneButton.setEnabled(true);
    } else if (mode == DefaultBag.ZIP_MODE) {
        this.zipButton.setEnabled(true);
    } else {
        this.noneButton.setEnabled(true);
    }

    final ButtonGroup serializeGroup = new ButtonGroup();
    serializeGroup.add(noneButton);
    serializeGroup.add(zipButton);
    // serializeGroup.add(tarButton);
    // serializeGroup.add(tarGzButton);
    // serializeGroup.add(tarBz2Button);
    final JPanel serializeGroupPanel = new JPanel(new FlowLayout());
    serializeGroupPanel.add(serializeLabel);
    serializeGroupPanel.add(noneButton);
    serializeGroupPanel.add(zipButton);
    // serializeGroupPanel.add(tarButton);
    // serializeGroupPanel.add(tarGzButton);
    // serializeGroupPanel.add(tarBz2Button);
    serializeGroupPanel.setBorder(border);
    serializeGroupPanel.setEnabled(true);
    serializeGroupPanel.setToolTipText(bagView.getPropertyMessage("bag.serializetype.help"));

    final JLabel tagLabel = new JLabel(getMessage("bag.label.istag"));
    tagLabel.setToolTipText(getMessage("bag.label.istag.help"));
    final JCheckBox isTagCheckbox = new JCheckBox();
    isTagCheckbox.setBorder(border);
    isTagCheckbox.addActionListener(new TagManifestHandler());
    isTagCheckbox.setToolTipText(getMessage("bag.checkbox.istag.help"));

    final JLabel tagAlgorithmLabel = new JLabel(getMessage("bag.label.tagalgorithm"));
    tagAlgorithmLabel.setToolTipText(getMessage("bag.label.tagalgorithm.help"));
    final ArrayList<String> listModel = new ArrayList<>();
    for (final Algorithm algorithm : Algorithm.values()) {
        listModel.add(algorithm.bagItAlgorithm);
    }
    final JComboBox<String> tagAlgorithmList = new JComboBox<>(listModel.toArray(new String[listModel.size()]));
    tagAlgorithmList.setName(getMessage("bag.tagalgorithmlist"));
    tagAlgorithmList.addActionListener(new TagAlgorithmListHandler());
    tagAlgorithmList.setToolTipText(getMessage("bag.tagalgorithmlist.help"));

    final JLabel payloadLabel = new JLabel(getMessage("bag.label.ispayload"));
    payloadLabel.setToolTipText(getMessage("bag.ispayload.help"));
    final JCheckBox isPayloadCheckbox = new JCheckBox();
    isPayloadCheckbox.setBorder(border);
    isPayloadCheckbox.addActionListener(new PayloadManifestHandler());
    isPayloadCheckbox.setToolTipText(getMessage("bag.ispayload.help"));

    final JLabel payAlgorithmLabel = new JLabel(bagView.getPropertyMessage("bag.label" + ".payalgorithm"));
    payAlgorithmLabel.setToolTipText(getMessage("bag.payalgorithm.help"));
    final JComboBox<String> payAlgorithmList = new JComboBox<String>(
            listModel.toArray(new String[listModel.size()]));
    payAlgorithmList.setName(getMessage("bag.payalgorithmlist"));
    payAlgorithmList.addActionListener(new PayAlgorithmListHandler());
    payAlgorithmList.setToolTipText(getMessage("bag.payalgorithmlist.help"));

    //only if bag is not null
    if (bag != null) {
        final String fileName = bag.getName();
        bagNameField = new JTextField(fileName);
        bagNameField.setCaretPosition(fileName.length());

        holeyCheckbox.setSelected(bag.isHoley());
        urlLabel.setEnabled(bag.isHoley());
        isTagCheckbox.setSelected(bag.isBuildTagManifest());
        tagAlgorithmList.setSelectedItem(bag.getTagManifestAlgorithm());
        isPayloadCheckbox.setSelected(bag.isBuildPayloadManifest());
        payAlgorithmList.setSelectedItem(bag.getPayloadManifestAlgorithm());
    }

    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;

    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(location, glbc);
    panel.add(location);

    buildConstraints(glbc, 2, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.EAST);
    glbc.ipadx = 5;
    layout.setConstraints(browseButton, glbc);
    glbc.ipadx = 0;
    panel.add(browseButton);

    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    glbc.ipadx = 5;
    layout.setConstraints(bagNameField, glbc);
    glbc.ipadx = 0;
    panel.add(bagNameField);

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(holeyLabel, glbc);
    panel.add(holeyLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.WEST, GridBagConstraints.WEST);
    layout.setConstraints(holeyCheckbox, glbc);
    panel.add(holeyCheckbox);
    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(serializeLabel, glbc);
    panel.add(serializeLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    layout.setConstraints(serializeGroupPanel, glbc);
    panel.add(serializeGroupPanel);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(tagLabel, glbc);
    panel.add(tagLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(isTagCheckbox, glbc);
    panel.add(isTagCheckbox);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(tagAlgorithmLabel, glbc);
    panel.add(tagAlgorithmLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(tagAlgorithmList, glbc);
    panel.add(tagAlgorithmList);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(payloadLabel, glbc);
    panel.add(payloadLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(isPayloadCheckbox, glbc);
    panel.add(isPayloadCheckbox);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(payAlgorithmLabel, glbc);
    panel.add(payAlgorithmLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(payAlgorithmList, glbc);
    panel.add(payAlgorithmList);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:com.dbschools.quickquiz.client.giver.MainWindow.java

/** This method is called from within the constructor to
 * initialize the form.//from  ww  w . j a va 2  s . c o m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the Form Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    java.awt.GridBagConstraints gridBagConstraints;

    pnlPlayers = new javax.swing.JPanel();
    pnlChat = new javax.swing.JPanel();
    jLabel4 = new javax.swing.JLabel();
    txtChatLine = new javax.swing.JTextField();
    btnSendChatLine = new javax.swing.JButton();
    chkChatEnabled = new javax.swing.JCheckBox();
    pnlMessages = new javax.swing.JPanel();
    scpMessages = new javax.swing.JScrollPane();
    lstMessages = new javax.swing.JList();
    pnlQA = new javax.swing.JPanel();
    jLabel2 = new javax.swing.JLabel();
    countdownMeter = new com.dbschools.gui.CountdownMeter();
    pnlButtons = new javax.swing.JPanel();
    jPanel2 = new javax.swing.JPanel();
    jLabel3 = new javax.swing.JLabel();
    txtTimeLimit = new javax.swing.JFormattedTextField();
    btnSendQuestion = new javax.swing.JButton();
    pnlAward = new javax.swing.JPanel();
    btnAwardPoints = new javax.swing.JButton();
    sprPoints = new javax.swing.JSpinner();
    cbxQuestions = new javax.swing.JComboBox();
    jMenuBar1 = new javax.swing.JMenuBar();
    jMenu1 = new javax.swing.JMenu();
    mnuReset = new javax.swing.JMenuItem();
    jMenuItem1 = new javax.swing.JMenuItem();
    jMenu2 = new javax.swing.JMenu();
    mnuLoad = new javax.swing.JMenuItem();

    addWindowListener(new java.awt.event.WindowAdapter() {
        public void windowClosing(java.awt.event.WindowEvent evt) {
            exitForm(evt);
        }
    });
    getContentPane().setLayout(new java.awt.GridBagLayout());

    java.util.ResourceBundle bundle = java.util.ResourceBundle
            .getBundle("com/dbschools/quickquiz/client/giver/Bundle"); // NOI18N
    pnlPlayers.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("takers"))); // NOI18N
    pnlPlayers.setPreferredSize(new java.awt.Dimension(600, 250));
    pnlPlayers.setRequestFocusEnabled(false);
    pnlPlayers.setLayout(new javax.swing.BoxLayout(pnlPlayers, javax.swing.BoxLayout.LINE_AXIS));
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.weighty = 0.6;
    gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2);
    getContentPane().add(pnlPlayers, gridBagConstraints);

    pnlChat.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("chat"))); // NOI18N
    pnlChat.setLayout(new java.awt.GridBagLayout());

    jLabel4.setDisplayedMnemonic('m');
    jLabel4.setLabelFor(txtChatLine);
    jLabel4.setText(bundle.getString("chatMessage")); // NOI18N
    pnlChat.add(jLabel4, new java.awt.GridBagConstraints());

    txtChatLine.setColumns(40);
    java.util.ResourceBundle bundle1 = java.util.ResourceBundle.getBundle("quickquiz"); // NOI18N
    txtChatLine.setToolTipText(bundle1.getString("tttChatMessage")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
    pnlChat.add(txtChatLine, gridBagConstraints);

    btnSendChatLine.setText(bundle.getString("sendChatLine")); // NOI18N
    btnSendChatLine.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnSendChatLineActionPerformed(evt);
        }
    });
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 0;
    gridBagConstraints.insets = new java.awt.Insets(0, 2, 0, 2);
    pnlChat.add(btnSendChatLine, gridBagConstraints);

    chkChatEnabled.setSelected(true);
    chkChatEnabled.setText("Enabled");
    chkChatEnabled.addItemListener(new java.awt.event.ItemListener() {
        public void itemStateChanged(java.awt.event.ItemEvent evt) {
            chatEnable(evt);
        }
    });
    pnlChat.add(chkChatEnabled, new java.awt.GridBagConstraints());

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 5;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.insets = new java.awt.Insets(5, 2, 2, 2);
    getContentPane().add(pnlChat, gridBagConstraints);

    pnlMessages.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("messages"))); // NOI18N
    pnlMessages.setLayout(new javax.swing.BoxLayout(pnlMessages, javax.swing.BoxLayout.LINE_AXIS));

    lstMessages.setFont(new java.awt.Font("SansSerif", 0, 10));
    lstMessages.setModel(new MessagesListModel());
    lstMessages.setFocusable(false);
    lstMessages.setRequestFocusEnabled(false);
    scpMessages.setViewportView(lstMessages);

    pnlMessages.add(scpMessages);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 6;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.weighty = 0.4;
    gridBagConstraints.insets = new java.awt.Insets(5, 2, 0, 2);
    getContentPane().add(pnlMessages, gridBagConstraints);

    pnlQA.setBorder(javax.swing.BorderFactory.createTitledBorder(bundle.getString("qa"))); // NOI18N
    pnlQA.setLayout(new java.awt.GridBagLayout());

    jLabel2.setDisplayedMnemonic('q');
    jLabel2.setLabelFor(cbxQuestions);
    jLabel2.setText(bundle.getString("question")); // NOI18N
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
    pnlQA.add(jLabel2, gridBagConstraints);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 2;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 1.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
    pnlQA.add(countdownMeter, gridBagConstraints);

    pnlButtons.setLayout(new javax.swing.BoxLayout(pnlButtons, javax.swing.BoxLayout.LINE_AXIS));

    jLabel3.setDisplayedMnemonic('l');
    jLabel3.setLabelFor(txtTimeLimit);
    jLabel3.setText(bundle.getString("timeLimit")); // NOI18N
    jPanel2.add(jLabel3);

    txtTimeLimit.setColumns(3);
    txtTimeLimit.setToolTipText(bundle1.getString("tttTimeLimit")); // NOI18N
    txtTimeLimit.setValue(new Integer(20));
    jPanel2.add(txtTimeLimit);

    btnSendQuestion.setMnemonic('s');
    btnSendQuestion.setText(bundle.getString("sendQuestion")); // NOI18N
    btnSendQuestion.setToolTipText(bundle1.getString("tttSendQuestion")); // NOI18N
    btnSendQuestion.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnSendQuestionActionPerformed(evt);
        }
    });
    jPanel2.add(btnSendQuestion);

    pnlButtons.add(jPanel2);

    btnAwardPoints.setMnemonic('a');
    btnAwardPoints.setText(bundle.getString("winnerButton")); // NOI18N
    btnAwardPoints.setToolTipText(bundle.getString("tttAssignWinner")); // NOI18N
    btnAwardPoints.setEnabled(false);
    btnAwardPoints.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            btnAwardPointsActionPerformed(evt);
        }
    });
    pnlAward.add(btnAwardPoints);

    sprPoints.setToolTipText(bundle.getString("tttWinnerPoints")); // NOI18N
    sprPoints.setPreferredSize(new java.awt.Dimension(50, 24));
    pnlAward.add(sprPoints);

    pnlButtons.add(pnlAward);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 4;
    gridBagConstraints.gridwidth = 3;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    pnlQA.add(pnlButtons, gridBagConstraints);

    cbxQuestions.setEditable(true);
    cbxQuestions.setMaximumRowCount(100);
    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 1;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.HORIZONTAL;
    gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
    gridBagConstraints.weightx = 2.0;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
    pnlQA.add(cbxQuestions, gridBagConstraints);

    gridBagConstraints = new java.awt.GridBagConstraints();
    gridBagConstraints.gridx = 0;
    gridBagConstraints.gridy = 2;
    gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
    gridBagConstraints.insets = new java.awt.Insets(2, 2, 2, 2);
    getContentPane().add(pnlQA, gridBagConstraints);

    jMenu1.setText(bundle.getString("quiz")); // NOI18N

    mnuReset.setText(bundle.getString("resetButton")); // NOI18N
    mnuReset.setToolTipText(bundle.getString("tttResetButton")); // NOI18N
    mnuReset.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuResetActionPerformed(evt);
        }
    });
    jMenu1.add(mnuReset);

    jMenuItem1.setText("Add Simulated Takers");
    jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            addSimulatedTakers(evt);
        }
    });
    jMenu1.add(jMenuItem1);

    jMenuBar1.add(jMenu1);

    jMenu2.setText(bundle.getString("questions")); // NOI18N

    mnuLoad.setText(bundle.getString("load")); // NOI18N
    mnuLoad.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(java.awt.event.ActionEvent evt) {
            mnuLoadActionPerformed(evt);
        }
    });
    jMenu2.add(mnuLoad);

    jMenuBar1.add(jMenu2);

    setJMenuBar(jMenuBar1);

    pack();
}

From source file:junk.gui.HazardDataSetCalcCondorApp.java

private void jbInit() throws Exception {
    border1 = new EtchedBorder(EtchedBorder.RAISED, new Color(248, 254, 255), new Color(121, 124, 136));
    this.setSize(new Dimension(564, 834));
    this.getContentPane().setLayout(borderLayout1);
    mainPanel.setBorder(border1);//from   ww  w  .  jav a  2  s .  c o  m
    mainPanel.setLayout(gridBagLayout);
    mainSplitPane.setOrientation(JSplitPane.VERTICAL_SPLIT);
    buttonPanel.setLayout(borderLayout3);
    eqkRupPanel.setLayout(gridBagLayout);
    imr_IMTSplit.setOrientation(JSplitPane.VERTICAL_SPLIT);
    imrPanel.setLayout(borderLayout2);
    imtPanel.setLayout(gridBagLayout);
    buttonPanel.setMinimumSize(new Dimension(391, 50));
    gridRegionSitePanel.setLayout(gridBagLayout);
    imrSelectionPanel.setLayout(gridBagLayout);
    //controlComboBox.setBackground(Color.white);
    dataPanel.setLayout(gridBagLayout4);
    imgPanel.setLayout(gridBagLayout7);
    addButton.setBorder(null);
    addButton.setText("Start Calc");
    addButton.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(ActionEvent e) {
            addButton_actionPerformed(e);
        }
    });
    controlComboBox.addActionListener(new java.awt.event.ActionListener() {
        public void actionPerformed(ActionEvent e) {
            controlComboBox_actionPerformed(e);
        }
    });
    emailLabel.setText("Email:");
    datasetLabel.setText("Dataset Id:");
    emailText.setText("");
    dataPanel.setMinimumSize(new Dimension(548, 150));
    dataPanel.setPreferredSize(new Dimension(549, 150));
    this.getContentPane().add(mainPanel, BorderLayout.CENTER);
    mainPanel.add(mainSplitPane, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(1, 1, 2, 3), 0, 431));
    mainSplitPane.add(buttonPanel, JSplitPane.BOTTOM);
    buttonPanel.add(dataPanel, BorderLayout.CENTER);
    dataPanel.add(datasetIdText, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(34, 19, 81, 0), 162, 7));
    dataPanel.add(datasetLabel, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(34, 7, 81, 0), 28, 10));
    dataPanel.add(emailText, new GridBagConstraints(1, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(43, 19, 0, 0), 162, 7));
    dataPanel.add(controlComboBox, new GridBagConstraints(2, 0, 1, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(43, 48, 0, 24), 35, 2));
    dataPanel.add(emailLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(43, 7, 0, 15), 43, 12));
    dataPanel.add(addButton, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, new Insets(27, 51, 81, 24), 79, 12));
    buttonPanel.add(imgPanel, BorderLayout.SOUTH);
    imgPanel.add(imgLabel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(15, 235, 3, 246), 57, 28));
    mainSplitPane.add(parameterTabbedPanel, JSplitPane.TOP);
    imr_IMTSplit.add(imtPanel, JSplitPane.BOTTOM);
    imr_IMTSplit.add(imrSelectionPanel, JSplitPane.TOP);
    imrPanel.add(imr_IMTSplit, BorderLayout.CENTER);
    parameterTabbedPanel.addTab("Intensity-Measure Relationship", imrPanel);
    parameterTabbedPanel.addTab("Region & Site Params", gridRegionSitePanel);
    parameterTabbedPanel.addTab("Earthquake Rupture Forecast", eqkRupPanel);
    mainSplitPane.setDividerLocation(550);
    imr_IMTSplit.setDividerLocation(300);
    imgLabel.addMouseListener(new java.awt.event.MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            imgLabel_mouseClicked(e);
        }
    });

}

From source file:net.sf.taverna.t2.workbench.cagrid.CaGridComponent.java

private void addServiceURLButton() {
    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 2;//from   w  w  w . j  a v  a 2s  .  c  om
    c.gridy = row;
    c.anchor = GridBagConstraints.WEST;
    caGridTransferDownloadButton = new JButton("Download Result File", WorkbenchIcons.updateIcon);
    caGridTransferDownloadButton.setEnabled(true);
    caGridTransferDownloadButton.setActionCommand("download");
    caGridTransferDownloadButton.addActionListener(this);
    add(caGridTransferDownloadButton, c);

}

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

/**
 * This method initializes jPanel2   //  w ww. j a  v a2 s  .co m
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelProjectCombo() {
    if (jPanelProjectCombo == null) {
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.fill = GridBagConstraints.NONE;
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.weightx = 1.0;
        gridBagConstraints1.insets = new Insets(0, 0, 0, 0);
        gridBagConstraints1.gridwidth = 1;
        gridBagConstraints1.anchor = GridBagConstraints.WEST;
        gridBagConstraints1.gridx = 1;
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.insets = new Insets(0, 0, 0, 5);
        gridBagConstraints2.weightx = 1.0;
        gridBagConstraints2.anchor = GridBagConstraints.EAST;
        gridBagConstraints2.gridy = 0;
        jLabelProject = new JLabel();
        jLabelProject.setText("Project :");
        jPanelProjectCombo = new JPanel();
        jPanelProjectCombo.setLayout(new GridBagLayout());
        jPanelProjectCombo.setPreferredSize(new Dimension(1000, 37));
        jPanelProjectCombo.add(jLabelProject, gridBagConstraints2);
        jPanelProjectCombo.add(getJComboProject(), gridBagConstraints1);
    }
    return jPanelProjectCombo;
}

From source file:ro.nextreports.designer.querybuilder.QueryBuilderPanel.java

private void initUI() {
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.setDividerLocation(250);// www  .  ja v a2s. co  m
    split.setOneTouchExpandable(true);

    JToolBar toolBar = new JToolBar();
    toolBar.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders
    toolBar.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
    toolBar.setBorderPainted(false);

    // add refresh action
    toolBar.add(new AbstractAction() {

        public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
                return ImageUtil.getImageIcon("refresh");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
                return I18NSupport.getString("querybuilder.refresh");
            }

            return super.getValue(key);
        }

        public void actionPerformed(ActionEvent e) {
            try {
                if (Globals.getConnection() == null) {
                    return;
                }

                // refresh tables, views, procedures
                TreeUtil.refreshDatabase();

                // add new queries to tree
                TreeUtil.refreshQueries();

                // add new reports to tree
                TreeUtil.refreshReports();

                // add new charts to tree
                TreeUtil.refreshCharts();

            } catch (Exception ex) {
                Show.error(ex);
            }
        }

    });

    // add expand action
    toolBar.add(new AbstractAction() {

        public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
                return ImageUtil.getImageIcon("expandall");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
                return I18NSupport.getString("querybuilder.expand.all");
            }

            return super.getValue(key);
        }

        public void actionPerformed(ActionEvent e) {
            TreeUtil.expandAll(dbBrowserTree);
        }

    });

    // add collapse action
    toolBar.add(new AbstractAction() {

        public Object getValue(String key) {
            if (AbstractAction.SMALL_ICON.equals(key)) {
                return ImageUtil.getImageIcon("collapseall");
            } else if (AbstractAction.SHORT_DESCRIPTION.equals(key)) {
                return I18NSupport.getString("querybuilder.collapse.all");
            }

            return super.getValue(key);
        }

        public void actionPerformed(ActionEvent e) {
            TreeUtil.collapseAll(dbBrowserTree);
        }

    });

    // add properties button
    /*
      JButton propButton = new MagicButton(new AbstractAction() {
            
      public Object getValue(String key) {
          if (AbstractAction.SMALL_ICON.equals(key)) {
              return ImageUtil.getImageIcon("properties");
          }
            
          return super.getValue(key);
      }
            
      public void actionPerformed(ActionEvent e) {
          DBBrowserPropertiesPanel joinPanel = new DBBrowserPropertiesPanel();
          JDialog dlg = new DBBrowserPropertiesDialog(joinPanel);
          dlg.pack();
          dlg.setResizable(false);
          Show.centrateComponent(Globals.getMainFrame(), dlg);
          dlg.setVisible(true);
      }
            
      });
      propButton.setToolTipText(I18NSupport.getString("querybuilder.properties"));
      */
    //browserButtonsPanel.add(propButton);

    //        ro.nextreports.designer.util.SwingUtil.registerButtonsForFocus(browserButtonsPanel);

    browserPanel = new JXPanel(new BorderLayout());
    browserPanel.add(toolBar, BorderLayout.NORTH);

    // browser tree
    JScrollPane scroll = new JScrollPane(dbBrowserTree);
    browserPanel.add(scroll, BorderLayout.CENTER);
    split.setLeftComponent(browserPanel);

    tabbedPane = new JTabbedPane(JTabbedPane.BOTTOM);
    //        tabbedPane.putClientProperty(Options.EMBEDDED_TABS_KEY, Boolean.TRUE); // look like eclipse

    JSplitPane split2 = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
    split2.setResizeWeight(0.66);
    split2.setOneTouchExpandable(true);

    // desktop pane
    desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE);
    desktop.setDropTarget(
            new DropTarget(desktop, DnDConstants.ACTION_MOVE, new DesktopPaneDropTargetListener(), true));

    // create the toolbar
    JToolBar toolBar2 = new JToolBar();
    toolBar2.putClientProperty("JToolBar.isRollover", Boolean.TRUE); // hide buttons borders
    toolBar2.putClientProperty(Options.HEADER_STYLE_KEY, HeaderStyle.BOTH);
    toolBar2.setBorderPainted(false);

    Action distinctAction = new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            if (distinctButton.isSelected()) {
                selectQuery.setDistinct(true);
            } else {
                selectQuery.setDistinct(false);
            }
        }

    };
    distinctAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("query.distinct"));
    distinctAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("querybuilder.distinct"));
    toolBar2.add(distinctButton = new JToggleButton(distinctAction));

    Action groupByAction = new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            groupBy = groupByButton.isSelected();
            Globals.getEventBus().publish(new GroupByEvent(QueryBuilderPanel.this.desktop, groupBy));
        }

    };
    groupByAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("query.group_by"));
    groupByAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("querybuilder.group.by"));
    toolBar2.add(groupByButton = new JToggleButton(groupByAction));

    Action clearAction = new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            clear(false);
        }

    };
    clearAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("clear"));
    clearAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("querybuilder.clear"));
    toolBar2.add(clearAction);

    // add separator
    SwingUtil.addCustomSeparator(toolBar2);

    // add run button
    Action runQueryAction = new AbstractAction() {

        public void actionPerformed(ActionEvent e) {
            selectSQLViewTab();
            sqlView.doRun();
        }

    };
    runQueryAction.putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("run"));
    KeyStroke ks = KeyStroke.getKeyStroke(ShortcutsUtil.getShortcut("query.run.accelerator", "control 4"));
    runQueryAction.putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("run.query") + " ("
            + ShortcutsUtil.getShortcut("query.run.accelerator.display", "Ctrl 4") + ")");
    runQueryAction.putValue(Action.ACCELERATOR_KEY, ks);
    toolBar2.add(runQueryAction);
    // register run query shortcut
    GlobalHotkeyManager hotkeyManager = GlobalHotkeyManager.getInstance();
    InputMap inputMap = hotkeyManager.getInputMap();
    ActionMap actionMap = hotkeyManager.getActionMap();
    inputMap.put((KeyStroke) runQueryAction.getValue(Action.ACCELERATOR_KEY), "runQueryAction");
    actionMap.put("runQueryAction", runQueryAction);

    JScrollPane scroll2 = new JScrollPane(desktop, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    scroll2.setPreferredSize(DBTablesDesktopPane.PREFFERED_SIZE);
    DecoratedScrollPane.decorate(scroll2);

    JPanel topPanel = new JPanel();
    topPanel.setLayout(new GridBagLayout());
    topPanel.add(toolBar2, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    topPanel.add(scroll2, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    split2.setTopComponent(topPanel);
    designPanel = new DesignerTablePanel(selectQuery);
    split2.setBottomComponent(designPanel);
    split2.setDividerLocation(400);

    tabbedPane.addTab(I18NSupport.getString("querybuilder.query.designer"), ImageUtil.getImageIcon("designer"),
            split2);
    tabbedPane.setMnemonicAt(0, 'D');

    sqlView = new SQLViewPanel();
    sqlView.getEditorPane().setDropTarget(new DropTarget(sqlView.getEditorPane(), DnDConstants.ACTION_MOVE,
            new SQLViewDropTargetListener(), true));
    tabbedPane.addTab(I18NSupport.getString("querybuilder.query.editor"), ImageUtil.getImageIcon("sql"),
            sqlView);
    tabbedPane.setMnemonicAt(1, 'E');

    split.setRightComponent(tabbedPane);

    // register a change listener
    tabbedPane.addChangeListener(new ChangeListener() {

        // this method is called whenever the selected tab changes
        public void stateChanged(ChangeEvent ev) {
            if (ev.getSource() == QueryBuilderPanel.this.tabbedPane) {
                // get current tab
                int sel = QueryBuilderPanel.this.tabbedPane.getSelectedIndex();
                if (sel == 1) { // sql view
                    String query;
                    if (!synchronizedPanels) {
                        query = sqlView.getQueryString();
                        synchronizedPanels = true;
                    } else {
                        if (Globals.getConnection() != null) {
                            query = getSelectQuery().toString();
                        } else {
                            query = "";
                        }
                        //                     if (query.equals("")) {
                        //                        query = sqlView.getQueryString();
                        //                     }
                    }
                    if (resetTable) {
                        sqlView.clear();
                        resetTable = false;
                    }
                    //System.out.println("query="+query);
                    sqlView.setQueryString(query);
                } else if (sel == 0) { // design view
                    if (queryWasModified(false)) {
                        Object[] options = { I18NSupport.getString("optionpanel.yes"),
                                I18NSupport.getString("optionpanel.no") };
                        String m1 = I18NSupport.getString("querybuilder.lost");
                        String m2 = I18NSupport.getString("querybuilder.continue");
                        int option = JOptionPane.showOptionDialog(Globals.getMainFrame(),
                                "<HTML>" + m1 + "<BR>" + m2 + "</HTML>",
                                I18NSupport.getString("querybuilder.confirm"), JOptionPane.YES_NO_OPTION,
                                JOptionPane.QUESTION_MESSAGE, null, options, options[1]);

                        if (option != JOptionPane.YES_OPTION) {
                            synchronizedPanels = false;
                            tabbedPane.setSelectedIndex(1);
                        } else {
                            resetTable = true;
                        }
                    }
                } else if (sel == 2) { // report view

                }
            }
        }

    });

    //        this.add(split, BorderLayout.CENTER);

    parametersPanel = new ParametersPanel();
}

From source file:com.vgi.mafscaling.LogPlay.java

private JButton addPlayerButton(int column, ImageIcon icon) {
    JButton button = new JButton(icon);
    button.putClientProperty("Nimbus.Overrides", zeroInsets);
    button.setMargin(insets0);/* ww w.  java  2s  . c  om*/
    button.setBorderPainted(false);
    button.setContentAreaFilled(false);
    button.addActionListener(this);
    GridBagConstraints gbc_button = new GridBagConstraints();
    gbc_button.insets = insets0;
    gbc_button.anchor = GridBagConstraints.WEST;
    gbc_button.gridx = column;
    gbc_button.gridy = 1;
    playerPanel.add(button, gbc_button);
    return button;
}