Example usage for java.awt GridBagConstraints HORIZONTAL

List of usage examples for java.awt GridBagConstraints HORIZONTAL

Introduction

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

Prototype

int HORIZONTAL

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

Click Source Link

Document

Resize the component horizontally but not vertically.

Usage

From source file:analysers.FilterValidatedDialog.java

/**
 * Create the dialog./*from   ww  w.j  ava 2s .  c om*/
 */
public FilterValidatedDialog() {
    setTitle("Validated Lineages: Export Filter");
    setBounds(100, 100, 632, 348);
    getContentPane().setLayout(new BorderLayout());
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    GridBagLayout gbl_contentPanel = new GridBagLayout();
    gbl_contentPanel.columnWidths = new int[] { 160, 440, 0 };
    gbl_contentPanel.rowHeights = new int[] { 1, 28, 28, 28, 0, 0 };
    gbl_contentPanel.columnWeights = new double[] { 1.0, 1.0, Double.MIN_VALUE };
    gbl_contentPanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 0.0, Double.MIN_VALUE };
    contentPanel.setLayout(gbl_contentPanel);
    {
        JLabel lblCriterion = new JLabel("Lineage Criterion");
        lblCriterion.setFont(new Font("Lucida Grande", Font.BOLD, 13));
        GridBagConstraints gbc_lblCriterion = new GridBagConstraints();
        gbc_lblCriterion.insets = new Insets(0, 0, 5, 5);
        gbc_lblCriterion.gridx = 0;
        gbc_lblCriterion.gridy = 0;
        contentPanel.add(lblCriterion, gbc_lblCriterion);
    }
    {
        JLabel lblValue = new JLabel("Value");
        lblValue.setFont(new Font("Lucida Grande", Font.BOLD, 13));
        GridBagConstraints gbc_lblValue = new GridBagConstraints();
        gbc_lblValue.insets = new Insets(0, 0, 5, 0);
        gbc_lblValue.gridx = 1;
        gbc_lblValue.gridy = 0;
        contentPanel.add(lblValue, gbc_lblValue);
    }
    {
        lblMinLineageLength = new JLabel("Min. Length (frames)");
        GridBagConstraints gbc_lblMinLineageLength = new GridBagConstraints();
        gbc_lblMinLineageLength.fill = GridBagConstraints.BOTH;
        gbc_lblMinLineageLength.insets = new Insets(0, 0, 5, 5);
        gbc_lblMinLineageLength.gridx = 0;
        gbc_lblMinLineageLength.gridy = 1;
        contentPanel.add(lblMinLineageLength, gbc_lblMinLineageLength);
    }
    {
        minLinLen = new JTextField();
        GridBagConstraints gbc_minLinLen = new GridBagConstraints();
        gbc_minLinLen.anchor = GridBagConstraints.NORTH;
        gbc_minLinLen.fill = GridBagConstraints.HORIZONTAL;
        gbc_minLinLen.insets = new Insets(0, 0, 5, 0);
        gbc_minLinLen.gridx = 1;
        gbc_minLinLen.gridy = 1;
        contentPanel.add(minLinLen, gbc_minLinLen);
        minLinLen.setText("1");
        minLinLen.setColumns(3);
    }
    {
        lblStartFrameOf = new JLabel("Max. Start Frame");
        GridBagConstraints gbc_lblStartFrameOf = new GridBagConstraints();
        gbc_lblStartFrameOf.fill = GridBagConstraints.HORIZONTAL;
        gbc_lblStartFrameOf.insets = new Insets(0, 0, 5, 5);
        gbc_lblStartFrameOf.gridx = 0;
        gbc_lblStartFrameOf.gridy = 2;
        contentPanel.add(lblStartFrameOf, gbc_lblStartFrameOf);
    }
    {
        startLin = new JTextField();
        GridBagConstraints gbc_startLin = new GridBagConstraints();
        gbc_startLin.insets = new Insets(0, 0, 5, 0);
        gbc_startLin.fill = GridBagConstraints.HORIZONTAL;
        gbc_startLin.gridx = 1;
        gbc_startLin.gridy = 2;
        contentPanel.add(startLin, gbc_startLin);
        startLin.setText("-1");
        startLin.setColumns(3);
    }
    {
        JButton btnPreview = new JButton("Preview");
        btnPreview.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent arg0) {
                preview.setText(makePreview());
            }
        });
        GridBagConstraints gbc_btnPreview = new GridBagConstraints();
        gbc_btnPreview.insets = new Insets(0, 0, 5, 5);
        gbc_btnPreview.gridx = 0;
        gbc_btnPreview.gridy = 3;
        contentPanel.add(btnPreview, gbc_btnPreview);
    }
    {
        JScrollPane scrollPane = new JScrollPane();
        GridBagConstraints gbc_scrollPane = new GridBagConstraints();
        gbc_scrollPane.insets = new Insets(0, 0, 5, 0);
        gbc_scrollPane.fill = GridBagConstraints.BOTH;
        gbc_scrollPane.gridx = 1;
        gbc_scrollPane.gridy = 3;
        contentPanel.add(scrollPane, gbc_scrollPane);
        {
            preview = new JTextArea();
            scrollPane.setViewportView(preview);
            preview.setEditable(false);
            preview.setColumns(10);
            preview.setTabSize(4);
        }
    }
    {
        JLabel lblOptions = new JLabel("Options");
        GridBagConstraints gbc_lblOptions = new GridBagConstraints();
        gbc_lblOptions.insets = new Insets(0, 0, 0, 5);
        gbc_lblOptions.gridx = 0;
        gbc_lblOptions.gridy = 4;
        contentPanel.add(lblOptions, gbc_lblOptions);
    }
    {
        JPanel panel = new JPanel();
        GridBagConstraints gbc_panel = new GridBagConstraints();
        gbc_panel.anchor = GridBagConstraints.NORTH;
        gbc_panel.fill = GridBagConstraints.HORIZONTAL;
        gbc_panel.gridx = 1;
        gbc_panel.gridy = 4;
        contentPanel.add(panel, gbc_panel);
        GridBagLayout gbl_panel = new GridBagLayout();
        gbl_panel.columnWidths = new int[] { 69, 169, 162, 0 };
        gbl_panel.rowHeights = new int[] { 23, 23, 0 };
        gbl_panel.columnWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
        gbl_panel.rowWeights = new double[] { 0.0, 0.0, Double.MIN_VALUE };
        panel.setLayout(gbl_panel);
        {
            rdbtnExportMeanIntensity = new JRadioButton("Export Mean Intensity");
            rdbtnExportMeanIntensity.setSelected(true);
            buttonGroup.add(rdbtnExportMeanIntensity);
            GridBagConstraints gbc_rdbtnExportMeanIntensity = new GridBagConstraints();
            gbc_rdbtnExportMeanIntensity.anchor = GridBagConstraints.NORTHWEST;
            gbc_rdbtnExportMeanIntensity.insets = new Insets(0, 0, 5, 5);
            gbc_rdbtnExportMeanIntensity.gridx = 1;
            gbc_rdbtnExportMeanIntensity.gridy = 0;
            panel.add(rdbtnExportMeanIntensity, gbc_rdbtnExportMeanIntensity);
        }
        {
            rdbtnExportMaxIntensity = new JRadioButton("Export Max Intensity");
            buttonGroup.add(rdbtnExportMaxIntensity);
            GridBagConstraints gbc_rdbtnExportMaxIntensity = new GridBagConstraints();
            gbc_rdbtnExportMaxIntensity.anchor = GridBagConstraints.NORTHWEST;
            gbc_rdbtnExportMaxIntensity.insets = new Insets(0, 0, 5, 0);
            gbc_rdbtnExportMaxIntensity.gridx = 2;
            gbc_rdbtnExportMaxIntensity.gridy = 0;
            panel.add(rdbtnExportMaxIntensity, gbc_rdbtnExportMaxIntensity);
        }
        {
            chckbxExportPositions = new JCheckBox("Export Cell Positions and Areas in CSV");
            GridBagConstraints gbc_chckbxExportPositions = new GridBagConstraints();
            gbc_chckbxExportPositions.anchor = GridBagConstraints.NORTH;
            gbc_chckbxExportPositions.gridwidth = 2;
            gbc_chckbxExportPositions.gridx = 1;
            gbc_chckbxExportPositions.gridy = 1;
            panel.add(chckbxExportPositions, gbc_chckbxExportPositions);
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            JButton okButton = new JButton("OK");
            okButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent arg0) {
                    if (validateFields()) {
                        Prefs.set("TrackApp.FilterValidatedDialog.startLin", valStartLin);
                        Prefs.set("TrackApp.FilterValidatedDialog.minLinLen", valMinLinLen);
                        Prefs.set("TrackApp.FilterValidatedDialog.exportMean", doExportMean);
                        Prefs.set("TrackApp.FilterValidatedDialog.exportPositions", doExportPositions);
                        Prefs.savePreferences();
                        dispose();
                    }
                }
            });
            okButton.setActionCommand("OK");
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            JButton cancelButton = new JButton("Cancel");
            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    dispose();
                }
            });
            cancelButton.setActionCommand("Cancel");
            buttonPane.add(cancelButton);
        }
    }
}

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

private void updateImportSPDXList() {
    getJPanelImportSPDX().removeAll();//  ww w  .j  a  v  a 2s.  c om
    int index = 0;
    for (index = 0; index < getJPanSPDXLocationList().size(); index++) {
        JPanLocation tmpLocation = getJPanSPDXLocationList().get(index);
        if (tmpLocation != null) {
            GridBagConstraints tmpGridBagConstraints = new GridBagConstraints();
            tmpGridBagConstraints.insets = new Insets(5, 5, 0, 5); //Insets(int top, int left, int bottom, int right) 
            tmpGridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
            tmpGridBagConstraints.gridx = 0;
            tmpGridBagConstraints.gridy = index;

            getJPanelImportSPDX().add(tmpLocation, tmpGridBagConstraints);
        }
    }

    GridBagConstraints tmpGridBagConstraints = new GridBagConstraints();
    tmpGridBagConstraints.fill = GridBagConstraints.BOTH;
    tmpGridBagConstraints.gridx = 0;
    tmpGridBagConstraints.gridy = index;
    tmpGridBagConstraints.weighty = 1.0;
    getJPanelImportSPDX().add(new JLabel(), tmpGridBagConstraints);

    checkValid();

    getJPanelImportSPDX().updateUI();
}

From source file:be.ac.ua.comp.scarletnebula.gui.addserverwizard.ChooseImagePage.java

private JPanel getSearchPanel(final TableRowSorter<MachineImageTableModel> sorter) {
    final JPanel searchPanel = new JPanel(new GridBagLayout());
    searchPanel.setBorder(BorderFactory.createEmptyBorder(10, 20, 5, 20));

    add(searchPanel, BorderLayout.NORTH);
    final PlatformComboBox platformComboBox = new PlatformComboBox();

    final GridBagConstraints c = new GridBagConstraints();
    c.weightx = 0.0;//  w  w w . jav a2  s  . co m
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy = 0;
    c.insets = new Insets(0, 0, 0, 5);

    searchPanel.add(platformComboBox, c);
    final ArchitectureComboBox architectureComboBox = new ArchitectureComboBox();

    c.gridx = 1;
    searchPanel.add(architectureComboBox, c);

    final BetterTextField searchField = new BetterTextField();
    searchField.setPlaceHolder("Search terms");

    searchField.setBorder(BorderFactory.createBevelBorder(BevelBorder.LOWERED));

    c.gridx = 2;
    c.weightx = 1.0;
    c.insets = new Insets(0, 0, 0, 0);
    searchPanel.add(searchField, c);

    searchField.addActionListener(
            new SearchFieldListener(architectureComboBox, sorter, platformComboBox, searchField));

    return searchPanel;
}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanProxySetting.java

private JPanel getJPanelValue() {
    if (jPanelValue == null) {

        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridx = 1;//from w  w w . ja  v a2 s .c o m
        gridBagConstraints3.weighty = 1.0;
        gridBagConstraints3.weightx = 0.0;
        gridBagConstraints3.gridy = 4;
        jLabelEmpty = new JLabel();
        jLabelEmpty.setText("");
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.gridy = 3;
        jPanelValue = new JPanel();
        jPanelValue.setLayout(new GridBagLayout());
        jPanelValue.setBorder(BorderFactory.createTitledBorder(null, "", TitledBorder.DEFAULT_JUSTIFICATION,
                TitledBorder.DEFAULT_POSITION, new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelValue.setPreferredSize(new Dimension(400, 200));
        jPanelValue.add(jLabelEmpty, gridBagConstraints3);

        JLabel jLabelProxyHost = new JLabel("Proxy Host : ", JLabel.RIGHT);
        GridBagConstraints gridBagConstraintsjLabelProxyHost = new GridBagConstraints();
        gridBagConstraintsjLabelProxyHost.gridx = 0;
        gridBagConstraintsjLabelProxyHost.insets = new Insets(10, 20, 5, 0);
        gridBagConstraintsjLabelProxyHost.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelProxyHost.weightx = 0.0;
        gridBagConstraintsjLabelProxyHost.weighty = 0.0;
        gridBagConstraintsjLabelProxyHost.gridy = 1;
        jPanelValue.add(jLabelProxyHost, gridBagConstraintsjLabelProxyHost);

        GridBagConstraints gridBagConstraintsgetJTextFieldProxyHost = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldProxyHost.gridx = 1;
        gridBagConstraintsgetJTextFieldProxyHost.weightx = 1.0;
        gridBagConstraintsgetJTextFieldProxyHost.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldProxyHost.insets = new Insets(10, 5, 5, 100);
        gridBagConstraintsgetJTextFieldProxyHost.gridwidth = 2;
        gridBagConstraintsgetJTextFieldProxyHost.gridy = 1;
        jPanelValue.add(getJTextFieldProxyHost(), gridBagConstraintsgetJTextFieldProxyHost);

        JLabel jLabelProxyPort = new JLabel("Proxy Port : ", JLabel.RIGHT);
        GridBagConstraints gridBagConstraintsjLabelProxyPort = new GridBagConstraints();
        gridBagConstraintsjLabelProxyPort.gridx = 0;
        gridBagConstraintsjLabelProxyPort.insets = new Insets(0, 20, 0, 0);
        gridBagConstraintsjLabelProxyPort.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelProxyPort.weighty = 0.0;
        gridBagConstraintsjLabelProxyPort.gridy = 2;
        jPanelValue.add(jLabelProxyPort, gridBagConstraintsjLabelProxyPort);

        GridBagConstraints gridBagConstraintsgetJTextFieldProxyPort = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldProxyPort.gridx = 1;
        gridBagConstraintsgetJTextFieldProxyPort.weightx = 1.0;
        gridBagConstraintsgetJTextFieldProxyPort.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldProxyPort.insets = new Insets(5, 5, 5, 220);
        gridBagConstraintsgetJTextFieldProxyPort.weighty = 0.0;
        gridBagConstraintsgetJTextFieldProxyPort.anchor = GridBagConstraints.CENTER;
        gridBagConstraintsgetJTextFieldProxyPort.gridy = 2;
        jPanelValue.add(getJTextFieldProxyPort(), gridBagConstraintsgetJTextFieldProxyPort);

        JLabel jLabelProxyBypass = new JLabel("Proxy Bypass : ", JLabel.RIGHT);
        GridBagConstraints gridBagConstraintsjLabelProxyBypass = new GridBagConstraints();
        gridBagConstraintsjLabelProxyBypass.gridx = 0;
        gridBagConstraintsjLabelProxyBypass.insets = new Insets(0, 20, 0, 0);
        gridBagConstraintsjLabelProxyBypass.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelProxyBypass.weighty = 0.0;
        gridBagConstraintsjLabelProxyBypass.gridy = 3;
        jPanelValue.add(jLabelProxyBypass, gridBagConstraintsjLabelProxyBypass);

        GridBagConstraints gridBagConstraintsgetJTextFieldProxyBypass = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldProxyBypass.gridx = 1;
        gridBagConstraintsgetJTextFieldProxyBypass.weightx = 1.0;
        gridBagConstraintsgetJTextFieldProxyBypass.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldProxyBypass.insets = new Insets(5, 5, 5, 100);
        gridBagConstraintsgetJTextFieldProxyBypass.weighty = 0.0;
        gridBagConstraintsgetJTextFieldProxyBypass.anchor = GridBagConstraints.CENTER;
        gridBagConstraintsgetJTextFieldProxyBypass.gridy = 3;
        jPanelValue.add(getJTextFieldProxyBypass(), gridBagConstraintsgetJTextFieldProxyBypass);

        //jPanelValue.add(getJPanel(), gridBagConstraints2);

    }
    return jPanelValue;
}

From source file:com.digitalgeneralists.assurance.ui.components.ScanDefinitionPanel.java

@Override
protected void initializeComponent() {
    if (!this.initialized) {
        if (this.definition == null) {
            mode = AssuranceDialogMode.ADD;
            this.dialogTitle = "Add New Scan Definition";
            this.definition = new ScanDefinition();
        } else {//www.  ja  v a 2  s  .c  o m
            mode = AssuranceDialogMode.EDIT;
            this.dialogTitle = "Edit Scan Definition";
        }

        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

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

        Border optionsBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        optionsBorder = BorderFactory.createTitledBorder(optionsBorder, "Merge Options", TitledBorder.CENTER,
                TitledBorder.TOP);

        GridBagConstraints nameTextFieldConstraints = new GridBagConstraints();
        nameTextFieldConstraints.anchor = GridBagConstraints.NORTH;
        nameTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        nameTextFieldConstraints.gridx = 0;
        nameTextFieldConstraints.gridy = 0;
        nameTextFieldConstraints.weightx = 1.0;
        nameTextFieldConstraints.weighty = 1.0;
        nameTextFieldConstraints.gridheight = 1;
        nameTextFieldConstraints.gridwidth = 2;
        nameTextFieldConstraints.insets = new Insets(10, 5, 0, 5);

        this.nameTextField.setText(this.definition.getName());
        this.nameTextField.getDocument().addDocumentListener(this.textPropertyValidationListener);
        this.add(this.nameTextField, nameTextFieldConstraints);

        Border existingScanMappingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        existingScanMappingsPanelBorder = BorderFactory.createTitledBorder(existingScanMappingsPanelBorder,
                "Paths", TitledBorder.CENTER, TitledBorder.TOP);

        GridBagConstraints existingScanMappingsPanelConstraints = new GridBagConstraints();
        existingScanMappingsPanelConstraints.anchor = GridBagConstraints.WEST;
        existingScanMappingsPanelConstraints.fill = GridBagConstraints.BOTH;
        existingScanMappingsPanelConstraints.gridx = 0;
        existingScanMappingsPanelConstraints.gridy = 1;
        existingScanMappingsPanelConstraints.weightx = 1.0;
        existingScanMappingsPanelConstraints.weighty = 1.0;
        existingScanMappingsPanelConstraints.gridheight = 1;
        existingScanMappingsPanelConstraints.gridwidth = 2;
        existingScanMappingsPanelConstraints.insets = new Insets(5, 5, 0, 5);

        JPanel existingScanMappingsPanel = new JPanel();
        GridBagLayout panelGridbag = new GridBagLayout();
        existingScanMappingsPanel.setLayout(panelGridbag);
        existingScanMappingsPanel.setBorder(existingScanMappingsPanelBorder);
        this.add(existingScanMappingsPanel, existingScanMappingsPanelConstraints);

        GridBagConstraints existingScanMappingsListConstraints = new GridBagConstraints();
        existingScanMappingsListConstraints.anchor = GridBagConstraints.WEST;
        existingScanMappingsListConstraints.fill = GridBagConstraints.BOTH;
        existingScanMappingsListConstraints.gridx = 0;
        existingScanMappingsListConstraints.gridy = 0;
        existingScanMappingsListConstraints.weightx = 1.0;
        existingScanMappingsListConstraints.weighty = 0.9;
        existingScanMappingsListConstraints.gridheight = 1;
        existingScanMappingsListConstraints.gridwidth = 2;
        existingScanMappingsListConstraints.insets = new Insets(5, 5, 5, 5);

        this.definition = (ScanDefinition) ModelUtils.initializeEntity(this.definition,
                ScanDefinition.SCAN_MAPPING_PROPERTY);
        this.scanMappingsList = new ListInputPanel<ScanMappingDefinition>(this.definition, this);
        existingScanMappingsPanel.add(this.scanMappingsList, existingScanMappingsListConstraints);

        GridBagConstraints optionsPanelConstraints = new GridBagConstraints();
        optionsPanelConstraints.anchor = GridBagConstraints.SOUTH;
        optionsPanelConstraints.fill = GridBagConstraints.HORIZONTAL;
        optionsPanelConstraints.gridx = 0;
        optionsPanelConstraints.gridy = 3;
        optionsPanelConstraints.weightx = 1.0;
        optionsPanelConstraints.weighty = 1.0;
        optionsPanelConstraints.gridheight = 1;
        optionsPanelConstraints.gridwidth = 2;
        optionsPanelConstraints.insets = new Insets(5, 5, 5, 5);

        optionsPanel.setBorder(optionsBorder);
        this.add(optionsPanel, optionsPanelConstraints);

        GridBagConstraints strategyLabelConstraints = new GridBagConstraints();
        strategyLabelConstraints.anchor = GridBagConstraints.WEST;
        strategyLabelConstraints.fill = GridBagConstraints.BOTH;
        strategyLabelConstraints.gridx = 0;
        strategyLabelConstraints.gridy = 0;
        strategyLabelConstraints.weightx = 1.0;
        strategyLabelConstraints.weighty = 1.0;
        strategyLabelConstraints.gridheight = 1;
        strategyLabelConstraints.gridwidth = 1;
        strategyLabelConstraints.insets = new Insets(5, 5, 0, 5);

        final JLabel strategyLabel = new JLabel("Strategy", SwingConstants.RIGHT);
        optionsPanel.add(strategyLabel, strategyLabelConstraints);

        GridBagConstraints strategyComboBoxConstraints = new GridBagConstraints();
        strategyComboBoxConstraints.anchor = GridBagConstraints.WEST;
        strategyComboBoxConstraints.fill = GridBagConstraints.VERTICAL;
        strategyComboBoxConstraints.gridx = 1;
        strategyComboBoxConstraints.gridy = 0;
        strategyComboBoxConstraints.weightx = 1.0;
        strategyComboBoxConstraints.weighty = 1.0;
        strategyComboBoxConstraints.gridheight = 1;
        strategyComboBoxConstraints.gridwidth = 1;
        strategyComboBoxConstraints.insets = new Insets(5, 5, 0, 5);

        String[] strategyLabels = { "Source", "Target", "Both" };
        this.strategyComboBox = new JComboBox<String>(strategyLabels);
        // NOTE: We should have better validation of the data state for these controls.
        // We could run into problems as the application versions over time.
        this.strategyComboBox.setSelectedIndex(this.definition.getMergeStrategy().ordinal());
        this.strategyComboBox.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.strategyComboBox, strategyComboBoxConstraints);

        GridBagConstraints autoMergeCheckBoxConstraints = new GridBagConstraints();
        autoMergeCheckBoxConstraints.gridx = 0;
        autoMergeCheckBoxConstraints.gridy = 1;
        autoMergeCheckBoxConstraints.weightx = 1.0;
        autoMergeCheckBoxConstraints.weighty = 1.0;
        autoMergeCheckBoxConstraints.gridheight = 1;
        autoMergeCheckBoxConstraints.gridwidth = 2;
        autoMergeCheckBoxConstraints.insets = new Insets(2, 5, 5, 5);

        this.autoMergeCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        this.autoMergeCheckBox.setSelected(this.definition.getAutoResolveConflicts());
        this.autoMergeCheckBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.autoMergeCheckBox, autoMergeCheckBoxConstraints);

        GridBagConstraints includeNonCreationTimestampsCheckBoxConstraints = new GridBagConstraints();
        includeNonCreationTimestampsCheckBoxConstraints.gridx = 0;
        includeNonCreationTimestampsCheckBoxConstraints.gridy = 2;
        includeNonCreationTimestampsCheckBoxConstraints.weightx = 1.0;
        includeNonCreationTimestampsCheckBoxConstraints.weighty = 1.0;
        includeNonCreationTimestampsCheckBoxConstraints.gridheight = 1;
        includeNonCreationTimestampsCheckBoxConstraints.gridwidth = 2;
        includeNonCreationTimestampsCheckBoxConstraints.insets = new Insets(2, 5, 5, 5);

        this.includeNonCreationTimestampCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        this.includeNonCreationTimestampCheckBox.setSelected(this.definition.getIncludeNonCreationTimestamps());
        this.includeNonCreationTimestampCheckBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.includeNonCreationTimestampCheckBox,
                includeNonCreationTimestampsCheckBoxConstraints);

        GridBagConstraints advancedAttributesCheckBoxConstraints = new GridBagConstraints();
        advancedAttributesCheckBoxConstraints.gridx = 0;
        advancedAttributesCheckBoxConstraints.gridy = 3;
        advancedAttributesCheckBoxConstraints.weightx = 1.0;
        advancedAttributesCheckBoxConstraints.weighty = 1.0;
        advancedAttributesCheckBoxConstraints.gridheight = 1;
        advancedAttributesCheckBoxConstraints.gridwidth = 2;
        advancedAttributesCheckBoxConstraints.insets = new Insets(2, 5, 5, 5);

        this.includeAdvancedAttributesCheckBox.setHorizontalTextPosition(SwingConstants.LEFT);
        this.includeAdvancedAttributesCheckBox.setSelected(this.definition.getAutoResolveConflicts());
        this.includeAdvancedAttributesCheckBox.addItemListener(new ItemListener() {
            public void itemStateChanged(ItemEvent e) {
                validateFormState();
            }
        });
        optionsPanel.add(this.includeAdvancedAttributesCheckBox, advancedAttributesCheckBoxConstraints);

        this.scanMappingsList.loadData();

        if (this.getMode() == AssuranceDialogMode.EDIT) {
            this.validateFormState();
        }

        this.initialized = true;
    }
}

From source file:net.sourceforge.squirrel_sql.client.preferences.WikiTablePreferencesPanel.java

/**
 * Creates the user Interface/*w w w.  j a va2s  .  c  o m*/
 */
private void createUserInterface() {
    JPanel jp = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(4, 4, 4, 4);
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.weightx = 0;
    gbc.weighty = 1;
    jp.add(createOverviewPanel(), gbc);

    gbc.gridy = 1;
    gbc.weighty = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    jp.add(createNotePanel(), gbc);

    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.gridheight = 2;
    gbc.gridy = 0;
    gbc.gridx = 1;
    gbc.fill = GridBagConstraints.BOTH;

    jp.add(createDetailPanel(), gbc);

    gbc.weightx = 1;
    gbc.weighty = 1;
    gbc.gridheight = 2;
    gbc.gridy = 0;
    gbc.gridx = 2;
    gbc.fill = GridBagConstraints.BOTH;

    jp.add(createExamplePanel(), gbc);

    JScrollPane sp = new JScrollPane(jp);
    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 1;
    gbc.weighty = 1;
    add(sp, gbc);

}

From source file:org.executequery.gui.ExecuteSqlScriptPanel.java

private void init() throws Exception {

    fileNameField = WidgetFactory.createTextField();
    connectionsCombo = WidgetFactory.createComboBox();
    combosGroup = new TableSelectionCombosGroup(connectionsCombo);

    actionOnErrorCombo = WidgetFactory.createComboBox();

    ActionOnError[] actionsOnError = { ActionOnError.HALT, ActionOnError.CONTINUE };

    actionOnErrorCombo.setModel(new DefaultComboBoxModel(actionsOnError));

    outputPanel = new LoggingOutputPanel();
    statusBar = new SqlTextPaneStatusBar();
    statusBar.setBorder(BorderFactory.createEmptyBorder(2, 0, 0, 1));

    JButton button = WidgetFactory.createInlineFieldButton("Browse");
    button.setActionCommand("browse");
    button.addActionListener(this);
    button.setMnemonic('r');

    logOutputCheckBox = new JCheckBox(
            "<html>&nbsp;&nbsp;<i>Note:</i> This will slow down the process significantly </html>");

    JPanel mainPanel = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridy = 0;/* w w w  .  ja  va  2s.com*/
    gbc.gridx = 0;
    gbc.gridheight = 1;
    gbc.insets.top = 7;
    gbc.insets.bottom = 5;
    gbc.insets.right = 5;
    gbc.insets.left = 5;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    mainPanel.add(new JLabel("Connection:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.top = 5;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(connectionsCombo, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 5;
    mainPanel.add(new JLabel("Action on Error:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets.top = 0;
    mainPanel.add(actionOnErrorCombo, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 5;
    mainPanel.add(new JLabel("Input File:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.top = 0;
    mainPanel.add(fileNameField, gbc);
    gbc.gridx = 2;
    gbc.weightx = 0;
    gbc.insets.left = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(button, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.insets.top = 5;
    gbc.insets.left = 5;
    mainPanel.add(new JLabel("Log output:"), gbc);
    gbc.gridx = 1;
    gbc.insets.top = 2;
    gbc.insets.left = 0;
    mainPanel.add(logOutputCheckBox, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weighty = 1.0;
    gbc.weightx = 1.0;
    gbc.insets.top = 5;
    gbc.insets.left = 5;
    gbc.insets.bottom = 0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.BOTH;
    mainPanel.add(outputPanel, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weighty = 0;
    gbc.insets.bottom = 5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(statusBar, gbc);

    mainPanel.setBorder(BorderFactory.createEtchedBorder());

    int minimumButtonWidth = 85;
    startButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Start", "start");
    rollbackButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Commit", "commit");
    commitButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Rollback", "rollback");
    stopButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Stop", "stop");

    rollbackButton.setEnabled(false);
    commitButton.setEnabled(false);
    stopButton.setEnabled(false);

    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 2, 5));
    buttonPanel.add(startButton);
    buttonPanel.add(rollbackButton);
    buttonPanel.add(commitButton);
    buttonPanel.add(stopButton);

    add(mainPanel, BorderLayout.CENTER);
    add(buttonPanel, BorderLayout.SOUTH);
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    EventMediator.registerListener(this);
}

From source file:org.opendatakit.briefcase.ui.CharsetConverterDialog.java

/**
 * Create the dialog./*from  w w  w .j ava 2s  .c o  m*/
 */
public CharsetConverterDialog(Window owner) {
    super(owner, ModalityType.DOCUMENT_MODAL);
    setTitle(DIALOG_TITLE);
    setBounds(100, 100, 600, 530);
    getContentPane().setLayout(new BorderLayout());
    JPanel contentPanel = new JPanel();
    contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
    getContentPane().add(contentPanel, BorderLayout.CENTER);
    GridBagLayout gbl_contentPanel = new GridBagLayout();
    contentPanel.setLayout(gbl_contentPanel);
    {
        JLabel lblNewLabel = new JLabel(SELECT_FILE_LABEL);
        GridBagConstraints gbc_lblNewLabel = new GridBagConstraints();
        gbc_lblNewLabel.anchor = GridBagConstraints.WEST;
        gbc_lblNewLabel.gridwidth = 2;
        gbc_lblNewLabel.insets = new Insets(0, 0, 5, 0);
        gbc_lblNewLabel.gridx = 0;
        gbc_lblNewLabel.gridy = 0;
        contentPanel.add(lblNewLabel, gbc_lblNewLabel);
    }
    {
        tfFile = new JTextField();
        tfFile.setEditable(false);
        GridBagConstraints gbc_tfFile = new GridBagConstraints();
        gbc_tfFile.weightx = 1.0;
        gbc_tfFile.insets = new Insets(0, 0, 5, 5);
        gbc_tfFile.fill = GridBagConstraints.HORIZONTAL;
        gbc_tfFile.gridx = 0;
        gbc_tfFile.gridy = 1;
        contentPanel.add(tfFile, gbc_tfFile);
        tfFile.setColumns(10);
    }
    {
        JButton btnBrowse = new JButton(SELECT_FILE_BUTTON);
        btnBrowse.setActionCommand(BROWSE_COMMAND);
        btnBrowse.addActionListener(this);
        GridBagConstraints gbc_btnBrowse = new GridBagConstraints();
        gbc_btnBrowse.insets = new Insets(0, 0, 5, 0);
        gbc_btnBrowse.gridx = 1;
        gbc_btnBrowse.gridy = 1;
        contentPanel.add(btnBrowse, gbc_btnBrowse);
    }
    {
        JLabel lblEncoding = new JLabel(SELECT_SOURCE_ENCODING_LABEL);
        GridBagConstraints gbc_lblEncoding = new GridBagConstraints();
        gbc_lblEncoding.anchor = GridBagConstraints.WEST;
        gbc_lblEncoding.insets = new Insets(0, 0, 5, 5);
        gbc_lblEncoding.gridx = 0;
        gbc_lblEncoding.gridy = 2;
        contentPanel.add(lblEncoding, gbc_lblEncoding);
    }
    {
        listCharset = new JList<CharsetEntry>();
        listCharset.setVisibleRowCount(7);
        listCharset.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        GridBagConstraints gbc_cbCharset = new GridBagConstraints();
        gbc_cbCharset.gridwidth = 2;
        gbc_cbCharset.insets = new Insets(0, 0, 5, 0);
        gbc_cbCharset.fill = GridBagConstraints.BOTH;
        gbc_cbCharset.gridx = 0;
        gbc_cbCharset.gridy = 3;
        JScrollPane listScrollPane = new JScrollPane(listCharset);
        contentPanel.add(listScrollPane, gbc_cbCharset);
    }
    {
        JLabel lblPreview = new JLabel(PREVIEW_LABEL);
        GridBagConstraints gbc_lblPreview = new GridBagConstraints();
        gbc_lblPreview.anchor = GridBagConstraints.WEST;
        gbc_lblPreview.insets = new Insets(0, 0, 5, 5);
        gbc_lblPreview.gridx = 0;
        gbc_lblPreview.gridy = 4;
        contentPanel.add(lblPreview, gbc_lblPreview);
    }
    {
        JScrollPane scrollPane = new JScrollPane();
        GridBagConstraints gbc_scrollPane = new GridBagConstraints();
        gbc_scrollPane.weighty = 1.0;
        gbc_scrollPane.weightx = 1.0;
        gbc_scrollPane.gridwidth = 2;
        gbc_scrollPane.fill = GridBagConstraints.BOTH;
        gbc_scrollPane.gridx = 0;
        gbc_scrollPane.gridy = 5;
        contentPanel.add(scrollPane, gbc_scrollPane);
        {
            previewArea = new JTextArea();
            previewArea.setLineWrap(true);
            previewArea.setRows(10);
            previewArea.setFont(UIManager.getDefaults().getFont("Label.font").deriveFont(Font.PLAIN));
            previewArea.setEditable(false);
            scrollPane.setViewportView(previewArea);
        }
    }
    {
        JPanel buttonPane = new JPanel();
        buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
        getContentPane().add(buttonPane, BorderLayout.SOUTH);
        {
            cbOverride = new JCheckBox(REPLACE_EXISTING_FILE_LABEL);
            cbOverride.setSelected(false);
            buttonPane.add(cbOverride);
        }
        {
            JButton okButton = new JButton(CONVERT_BUTTON_LABEL);
            okButton.setActionCommand(CONVERT_COMMAND);
            okButton.addActionListener(this);
            buttonPane.add(okButton);
            getRootPane().setDefaultButton(okButton);
        }
        {
            cancelButton = new JButton(CANCEL_BUTTON_LABEL);
            cancelButton.setActionCommand(CANCEL_COMMAND);
            cancelButton.addActionListener(this);
            buttonPane.add(cancelButton);
        }
    }
}

From source file:de.codesourcery.jasm16.ide.ui.utils.UIUtils.java

/**
 * /*  w  w  w  .ja v a2  s .c  o m*/
 * @param parent
 * @param title
 * @param message
 * @return <code>true</code> if project should also be physically deleted,
 * <code>false</code> is project should be deleted but all files should be left alone,
 * <code>null</code> if user cancelled the dialog/project should not be deleted
 */
public static Boolean showDeleteProjectDialog(IAssemblyProject project) {
    final JDialog dialog = new JDialog((Window) null, "Delete project " + project.getName());

    dialog.setModal(true);

    final JTextArea message = createMultiLineLabel(
            "Do you really want to delete project '" + project.getName() + " ?");
    final JCheckBox checkbox = new JCheckBox("Delete project files");

    final DialogResult[] outcome = { DialogResult.CANCEL };

    final JButton yesButton = new JButton("Yes");
    yesButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            outcome[0] = DialogResult.YES;
            dialog.dispose();
        }
    });

    final JButton noButton = new JButton("No");
    noButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            outcome[0] = DialogResult.NO;
            dialog.dispose();
        }
    });
    final JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            outcome[0] = DialogResult.CANCEL;
            dialog.dispose();
        }
    });

    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout());
    buttonPanel.add(yesButton);
    buttonPanel.add(noButton);
    buttonPanel.add(cancelButton);

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

    GridBagConstraints cnstrs = constraints(0, 0, true, false, GridBagConstraints.NONE);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.weighty = 0;
    cnstrs.gridheight = 1;
    messagePanel.add(message, cnstrs);

    cnstrs = constraints(0, 1, true, true, GridBagConstraints.NONE);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = 1;
    cnstrs.weighty = 0;
    messagePanel.add(checkbox, cnstrs);

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

    cnstrs = constraints(0, 0, true, false, GridBagConstraints.NONE);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = 1;
    cnstrs.weighty = 0;
    cnstrs.insets = new Insets(5, 2, 5, 2); // top,left,bottom,right         
    panel.add(messagePanel, cnstrs);

    cnstrs = constraints(0, 1, true, true, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = 1;
    cnstrs.weighty = 0;
    cnstrs.insets = new Insets(0, 2, 10, 2); // top,left,bottom,right      
    panel.add(buttonPanel, cnstrs);

    dialog.getContentPane().add(panel);
    dialog.pack();
    dialog.setVisible(true);

    if (outcome[0] != DialogResult.YES) {
        return null;
    }
    return checkbox.isSelected();
}

From source file:com._17od.upm.gui.OptionsDialog.java

public OptionsDialog(JFrame frame) {
    super(frame, Translator.translate("options"), true);

    Container container = getContentPane();

    // Create a pane with an empty border for spacing
    Border emptyBorder = BorderFactory.createEmptyBorder(2, 5, 5, 5);
    JPanel emptyBorderPanel = new JPanel();
    emptyBorderPanel.setLayout(new BoxLayout(emptyBorderPanel, BoxLayout.Y_AXIS));
    emptyBorderPanel.setBorder(emptyBorder);
    container.add(emptyBorderPanel);//ww w  .ja  v  a  2s .  c o  m

    // ******************
    // *** The DB TO Load On Startup Section
    // ******************
    // Create a pane with an title etched border
    Border etchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    Border etchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder,
            ' ' + Translator.translate("general") + ' ');
    JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setBorder(etchedTitleBorder);
    emptyBorderPanel.add(mainPanel);

    GridBagConstraints c = new GridBagConstraints();

    // The "Database to Load on Startup" row
    JLabel urlLabel = new JLabel(Translator.translate("dbToLoadOnStartup"));
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(urlLabel, c);

    // The "Database to Load on Startup" input field row
    dbToLoadOnStartup = new JTextField(Preferences.get(Preferences.ApplicationOptions.DB_TO_LOAD_ON_STARTUP),
            25);
    dbToLoadOnStartup.setHorizontalAlignment(JTextField.LEFT);
    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(dbToLoadOnStartup, c);

    JButton dbToLoadOnStartupButton = new JButton("...");
    dbToLoadOnStartupButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            getDBToLoadOnStartup();
        }
    });
    c.gridx = 1;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_END;
    c.insets = new Insets(0, 0, 5, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(dbToLoadOnStartupButton, c);

    // The "Language" label row
    JLabel localeLabel = new JLabel(Translator.translate("language"));
    c.gridx = 0;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(localeLabel, c);

    // The "Locale" field row
    localeComboBox = new JComboBox(getSupportedLocaleNames());
    for (int i = 0; i < localeComboBox.getItemCount(); i++) {
        // If the locale language is blank then set it to the English language
        // I'm not sure why this happens. Maybe it's because the default locale
        // is English???
        String currentLanguage = Translator.getCurrentLocale().getLanguage();
        if (currentLanguage.equals("")) {
            currentLanguage = "en";
        }

        if (currentLanguage.equals(Translator.SUPPORTED_LOCALES[i].getLanguage())) {
            localeComboBox.setSelectedIndex(i);
            break;
        }
    }
    c.gridx = 0;
    c.gridy = 3;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 8, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(localeComboBox, c);

    // The "Hide account password" row
    Boolean hideAccountPassword = new Boolean(
            Preferences.get(Preferences.ApplicationOptions.ACCOUNT_HIDE_PASSWORD, "true"));
    hideAccountPasswordCheckbox = new JCheckBox(Translator.translate("hideAccountPassword"),
            hideAccountPassword.booleanValue());
    c.gridx = 0;
    c.gridy = 4;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 2, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(hideAccountPasswordCheckbox, c);

    // The "Database auto lock" row
    Boolean databaseAutoLock = new Boolean(
            Preferences.get(Preferences.ApplicationOptions.DATABASE_AUTO_LOCK, "false"));
    databaseAutoLockCheckbox = new JCheckBox(Translator.translate("databaseAutoLock"),
            databaseAutoLock.booleanValue());
    c.gridx = 0;
    c.gridy = 5;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 2, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(databaseAutoLockCheckbox, c);
    databaseAutoLockCheckbox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            databaseAutoLockTime.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });

    // The "Database auto lock" field row
    databaseAutoLockTime = new JTextField(
            Preferences.get(Preferences.ApplicationOptions.DATABASE_AUTO_LOCK_TIME), 5);
    c.gridx = 1;
    c.gridy = 5;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(databaseAutoLockTime, c);
    databaseAutoLockTime.setEnabled(databaseAutoLockCheckbox.isSelected());

    // The "Generated password length" row
    accountPasswordLengthLabel = new JLabel(Translator.translate("generatedPasswodLength"));
    c.gridx = 0;
    c.gridy = 6;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 2, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(accountPasswordLengthLabel, c);

    accountPasswordLength = new JTextField(
            Preferences.get(Preferences.ApplicationOptions.ACCOUNT_PASSWORD_LENGTH, "8"), 5);
    c.gridx = 1;
    c.gridy = 6;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(accountPasswordLength, c);

    // Some spacing
    emptyBorderPanel.add(Box.createVerticalGlue());

    // ******************
    // *** The HTTPS Section
    // ******************
    // Create a pane with an title etched border
    Border httpsEtchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder, " HTTPS ");
    final JPanel httpsPanel = new JPanel(new GridBagLayout());
    httpsPanel.setBorder(httpsEtchedTitleBorder);
    emptyBorderPanel.add(httpsPanel);

    // The "Accept Self Sigend Certificates" checkbox row
    Boolean acceptSelfSignedCerts = new Boolean(
            Preferences.get(Preferences.ApplicationOptions.HTTPS_ACCEPT_SELFSIGNED_CERTS, "false"));
    acceptSelfSignedCertsCheckbox = new JCheckBox(Translator.translate("acceptSelfSignedCerts"),
            acceptSelfSignedCerts.booleanValue());
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 2, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    httpsPanel.add(acceptSelfSignedCertsCheckbox, c);

    // ******************
    // *** The Proxy Section
    // ******************
    // Create a pane with an title etched border
    Border proxyEtchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder,
            ' ' + Translator.translate("httpProxy") + ' ');
    final JPanel proxyPanel = new JPanel(new GridBagLayout());
    proxyPanel.setBorder(proxyEtchedTitleBorder);
    emptyBorderPanel.add(proxyPanel);

    // The "Enable Proxy" row
    Boolean proxyEnabled = new Boolean(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_ENABLED));
    enableProxyCheckbox = new JCheckBox(Translator.translate("enableProxy"), proxyEnabled.booleanValue());
    enableProxyCheckbox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                enableProxyComponents(true);
            } else {
                enableProxyComponents(false);
            }
        }
    });
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 2, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(enableProxyCheckbox, c);

    // The "HTTP Proxy" label row
    proxyLabel = new JLabel(Translator.translate("httpProxy"));
    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(proxyLabel, c);

    // The "HTTP Proxy Port" label
    proxyPortLabel = new JLabel(Translator.translate("port"));
    c.gridx = 1;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(proxyPortLabel, c);

    // The "HTTP Proxy" field row
    httpProxyHost = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_HOST), 20);
    c.gridx = 0;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    proxyPanel.add(httpProxyHost, c);

    httpProxyPort = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_PORT), 6);
    c.gridx = 1;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    proxyPanel.add(httpProxyPort, c);

    // The "HTTP Proxy Username" label row
    proxyUsernameLabel = new JLabel(Translator.translate("httpProxyUsername"));
    c.gridx = 0;
    c.gridy = 3;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(proxyUsernameLabel, c);

    // The "HTTP Proxy Username" field row
    httpProxyUsername = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_USERNAME), 20);
    c.gridx = 0;
    c.gridy = 4;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.HORIZONTAL;
    proxyPanel.add(httpProxyUsername, c);

    // The "HTTP Proxy Password" label row
    proxyPasswordLabel = new JLabel(Translator.translate("httpProxyPassword"));
    c.gridx = 0;
    c.gridy = 5;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(proxyPasswordLabel, c);

    // The "HTTP Proxy Password" field row
    String encodedPassword = Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_PASSWORD);
    String decodedPassword = null;
    if (encodedPassword != null) {
        decodedPassword = new String(Base64.decodeBase64(encodedPassword.getBytes()));
    }
    httpProxyPassword = new JPasswordField(decodedPassword, 20);
    c.gridx = 0;
    c.gridy = 6;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    proxyPanel.add(httpProxyPassword, c);

    hidePasswordCheckbox = new JCheckBox(Translator.translate("hide"), true);
    defaultEchoChar = httpProxyPassword.getEchoChar();
    hidePasswordCheckbox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                httpProxyPassword.setEchoChar(defaultEchoChar);
            } else {
                httpProxyPassword.setEchoChar((char) 0);
            }
        }
    });
    c.gridx = 1;
    c.gridy = 6;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 0);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(hidePasswordCheckbox, c);

    // Some spacing
    emptyBorderPanel.add(Box.createVerticalGlue());

    // The buttons row
    JPanel buttonPanel = new JPanel(new FlowLayout());
    emptyBorderPanel.add(buttonPanel);
    JButton okButton = new JButton(Translator.translate("ok"));
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            okButtonAction();
        }
    });
    buttonPanel.add(okButton);

    JButton cancelButton = new JButton(Translator.translate("cancel"));
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
            dispose();
        }
    });
    buttonPanel.add(cancelButton);

    enableProxyComponents(proxyEnabled.booleanValue());
}