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:org.openconcerto.erp.core.finance.accounting.ui.PlanComptableGPanel.java

private void uiInit() {
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();

    this.setOpaque(false);
    this.panelCompte.setOpaque(false);
    this.panelInfosCompte.setOpaque(false);
    this.panelDetails.setOpaque(false);

    this.panelCompte.setLayout(new GridBagLayout());
    this.panelInfosCompte.setLayout(new GridBagLayout());
    this.panelDetails.setLayout(new GridBagLayout());

    /*******************************************************************************************
     * * RadioButton Selection du mode d'affichage du PCG abrege, base ou developp Panel
     * Details//www.j av a2s .c  o m
     ******************************************************************************************/
    this.panelDetails.add(this.radioCompteBase, c);
    this.radioCompteBase.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCompteTable();
        }
    });

    c.gridy++;
    this.panelDetails.add(this.radioCompteAbrege, c);
    this.radioCompteAbrege.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCompteTable();
        }
    });

    c.gridy++;
    this.panelDetails.add(this.radioCompteDeveloppe, c);
    this.radioCompteDeveloppe.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateCompteTable();
        }

    });

    ButtonGroup grp1 = new ButtonGroup();
    grp1.add(this.radioCompteBase);
    grp1.add(this.radioCompteAbrege);
    grp1.add(this.radioCompteDeveloppe);

    this.radioCompteBase.setSelected(true);

    /*******************************************************************************************
     * ** Panel Compte
     ******************************************************************************************/
    c.insets = new Insets(2, 2, 1, 2);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0;
    c.weighty = 0;
    this.panelDetails.setBorder(BorderFactory.createTitledBorder("Dtails"));
    this.panelCompte.add(this.panelDetails, c);

    /*******************************************************************************************
     * * Affichage du plan comptable
     ******************************************************************************************/
    SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
    SQLTable classeCompteTable = base.getTable("CLASSE_COMPTE");

    SQLSelect selClasse = new SQLSelect(base);

    selClasse.addSelect(classeCompteTable.getField("ID"));
    selClasse.addSelect(classeCompteTable.getField("NOM"));
    selClasse.addSelect(classeCompteTable.getField("TYPE_NUMERO_COMPTE"));

    selClasse.addRawOrder("\"CLASSE_COMPTE\".\"TYPE_NUMERO_COMPTE\"");

    String reqClasse = selClasse.asString();
    Object obClasse = base.getDataSource().execute(reqClasse, new ArrayListHandler());

    List myListClasse = (List) obClasse;

    if (myListClasse.size() != 0) {
        for (int k = 0; k < myListClasse.size(); k++) {
            Object[] objTmp = (Object[]) myListClasse.get(k);
            ClasseCompte ccTmp = new ClasseCompte(Integer.parseInt(objTmp[0].toString()), objTmp[1].toString(),
                    objTmp[2].toString());
            this.classeComptes.add(ccTmp);

            JTable tab = creerJTable(ccTmp);
            this.tables.add(tab);
            this.tabbedClasse.add(ccTmp.getNom(), new JScrollPane(tab));
        }
    }
    c.gridwidth = 4;
    c.gridheight = 6;
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1;
    c.weighty = 1;
    c.gridx++;
    c.gridy = 0;
    this.panelCompte.add(this.tabbedClasse, c);

    /*******************************************************************************************
     * * Informations sur le compte selectionn Panel Infos Compte
     ******************************************************************************************/
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridheight = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1;
    c.weighty = 0;
    c.gridy = 0;
    c.gridx = 0;
    TitledSeparator sep = new TitledSeparator("Informations sur le compte");
    this.panelInfosCompte.add(sep, c);

    GridBagConstraints cInfos = new GridBagConstraints();
    cInfos.insets = new Insets(0, 0, 0, 0);
    cInfos.fill = GridBagConstraints.BOTH;
    cInfos.anchor = GridBagConstraints.NORTHWEST;
    cInfos.gridx = 0;
    cInfos.gridy = 0;
    cInfos.gridwidth = 1;
    cInfos.gridheight = 1;
    cInfos.weightx = 1;
    cInfos.weighty = 1;
    this.textInfos.setFont(this.getFont());
    this.textInfos.setEditable(false);
    JPanel infos = new JPanel(new GridBagLayout());
    infos.add(this.textInfos, cInfos);

    JScrollPane scrollInfos = new JScrollPane(infos);
    c.insets = new Insets(0, 0, 0, 0);
    c.gridx = 0;
    c.gridy++;
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = GridBagConstraints.REMAINDER;

    this.panelInfosCompte.add(scrollInfos, c);
    this.panelInfosCompte.setMinimumSize(new Dimension(100, 80));

    JSplitPane split = new JSplitPane(JSplitPane.VERTICAL_SPLIT, this.panelCompte, this.panelInfosCompte);
    split.setBorder(null);
    this.add(split, c);
}

From source file:org.openconcerto.erp.core.sales.order.component.CommandeClientSQLComponent.java

public void addViews() {
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();

    // Numero du commande
    c.gridx = 0;/*ww  w  .j  a v  a2 s. co m*/
    this.add(new JLabel(getLabelFor("NUMERO"), SwingConstants.RIGHT), c);

    this.numeroUniqueCommande = new JUniqueTextField(16);
    c.fill = GridBagConstraints.NONE;
    c.gridx++;
    c.weightx = 1;
    this.add(this.numeroUniqueCommande, c);

    // Date
    JLabel labelDate = new JLabel(getLabelFor("DATE"));
    labelDate.setHorizontalAlignment(SwingConstants.RIGHT);
    c.gridx = 2;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    this.add(labelDate, c);

    JDate dateCommande = new JDate(true);
    c.gridx++;
    c.fill = GridBagConstraints.NONE;
    this.add(dateCommande, c);

    // Champ Module
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();

    this.setAdditionalFieldsPanel(new FormLayouter(addP, 2));
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    this.add(addP, c);

    c.gridy++;
    c.gridwidth = 1;

    this.comboDevis = new ElementComboBox();

    // Reference
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.fill = GridBagConstraints.HORIZONTAL;

    JLabel labelObjet = new JLabel(getLabelFor("NOM"));
    labelObjet.setHorizontalAlignment(SwingConstants.RIGHT);
    c.weightx = 0;
    this.add(labelObjet, c);

    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.BOTH;
    this.add(this.textObjet, c);

    String field;
    field = "ID_COMMERCIAL";
    c.fill = GridBagConstraints.HORIZONTAL;
    // Commercial
    JLabel labelCommercial = new JLabel(getLabelFor(field));
    labelCommercial.setHorizontalAlignment(SwingConstants.RIGHT);

    c.gridx++;
    c.weightx = 0;
    this.add(labelCommercial, c);

    this.comboCommercial = new ElementComboBox(false, 25);
    this.comboCommercial.setListIconVisible(false);
    c.gridx++;
    c.fill = GridBagConstraints.NONE;
    c.weightx = 1;
    this.add(this.comboCommercial, c);
    addRequiredSQLObject(this.comboCommercial, field);

    // Ligne 3: Client
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT), c);

    this.comboClient = new ElementComboBox();
    c.gridx = GridBagConstraints.RELATIVE;
    c.gridwidth = 3;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;
    this.add(this.comboClient, c);
    final ElementComboBox boxTarif = new ElementComboBox();
    this.comboClient.addValueListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (!isFilling() && comboClient.getValue() != null) {
                Integer id = comboClient.getValue();

                if (id > 1) {

                    SQLRow row = comboClient.getElement().getTable().getRow(id);
                    if (comboClient.getElement().getTable().getFieldsName().contains("ID_TARIF")) {

                        SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
                        if (!foreignRow.isUndefined()
                                && (boxTarif.getSelectedRow() == null
                                        || boxTarif.getSelectedId() != foreignRow.getID())
                                && JOptionPane.showConfirmDialog(null,
                                        "Appliquer les tarifs associs au client?") == JOptionPane.YES_OPTION) {
                            boxTarif.setValue(foreignRow.getID());
                            // SaisieVenteFactureSQLComponent.this.tableFacture.setTarif(foreignRow,
                            // true);
                        } else {
                            boxTarif.setValue(foreignRow.getID());
                        }
                        // SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
                        // if (foreignRow.isUndefined() &&
                        // !row.getForeignRow("ID_DEVISE").isUndefined()) {
                        // SQLRowValues rowValsD = new SQLRowValues(foreignRow.getTable());
                        // rowValsD.put("ID_DEVISE", row.getObject("ID_DEVISE"));
                        // foreignRow = rowValsD;
                        //
                        // }
                        // table.setTarif(foreignRow, true);
                    }
                }
            }

        }
    });
    // tarif
    if (this.getTable().getFieldsName().contains("ID_TARIF")) {
        // TARIF
        c.gridy++;
        c.gridx = 0;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        this.add(new JLabel("Tarif  appliquer"), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;

        c.weightx = 1;
        this.add(boxTarif, c);
        this.addView(boxTarif, "ID_TARIF");
        boxTarif.addModelListener("wantedID", new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                SQLRow selectedRow = boxTarif.getRequest().getPrimaryTable().getRow(boxTarif.getWantedID());
                table.setTarif(selectedRow, false);
            }
        });
    }

    // Table d'lment
    this.table = new CommandeClientItemTable();
    c.fill = GridBagConstraints.BOTH;
    c.gridy++;
    c.gridx = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    this.add(this.table, c);

    DeviseField textPortHT = new DeviseField();
    DeviseField textRemiseHT = new DeviseField();

    // INfos
    c.gridx = 0;
    c.gridy++;
    c.gridheight = 1;
    c.weighty = 0;
    c.weightx = 1;
    c.anchor = GridBagConstraints.WEST;
    c.gridwidth = 2;
    this.add(new TitledSeparator(getLabelFor("INFOS")), c);

    c.gridy++;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.BOTH;
    final JScrollPane scrollPane = new JScrollPane(this.infos);
    scrollPane.setBorder(null);
    this.add(scrollPane, c);

    // Poids
    c.gridwidth = 1;

    DefaultProps props = DefaultNXProps.getInstance();
    Boolean b = props.getBooleanValue("ArticleShowPoids");
    final JTextField textPoidsTotal = new JTextField(8);
    if (b) {
        JPanel panel = new JPanel();

        panel.add(new JLabel(getLabelFor("T_POIDS")), c);

        textPoidsTotal.setEnabled(false);
        textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT);
        textPoidsTotal.setDisabledTextColor(Color.BLACK);
        panel.add(textPoidsTotal, c);

        panel.setOpaque(false);
        DefaultGridBagConstraints.lockMinimumSize(panel);

        c.gridx = 2;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        c.fill = GridBagConstraints.NONE;
        c.anchor = GridBagConstraints.NORTHEAST;
        this.add(panel, c);
    }

    // Total
    DeviseField fieldHT = new DeviseField();
    DeviseField fieldTVA = new DeviseField();
    DeviseField fieldTTC = new DeviseField();
    DeviseField fieldDevise = new DeviseField();
    DeviseField fieldService = new DeviseField();
    DeviseField fieldHA = new DeviseField();
    fieldHT.setOpaque(false);
    fieldHA.setOpaque(false);
    fieldTVA.setOpaque(false);
    fieldTTC.setOpaque(false);
    fieldService.setOpaque(false);
    addSQLObject(fieldDevise, "T_DEVISE");
    addRequiredSQLObject(fieldHT, "T_HT");
    addRequiredSQLObject(fieldTVA, "T_TVA");
    addRequiredSQLObject(fieldTTC, "T_TTC");
    addRequiredSQLObject(fieldService, "T_SERVICE");
    if (getTable().contains("PREBILAN")) {
        addSQLObject(fieldHA, "PREBILAN");
    } else if (getTable().contains("T_HA")) {
        addSQLObject(fieldHA, "T_HA");
    }

    JTextField poids = new JTextField();
    // addSQLObject(poids, "T_POIDS");
    final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT,
            textRemiseHT, fieldService, fieldHA, fieldDevise, poids, null);

    c.gridx = GridBagConstraints.RELATIVE;
    c.gridy--;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 2;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.fill = GridBagConstraints.NONE;
    c.weighty = 0;

    this.add(totalTTC, c);

    this.panelOO = new PanelOOSQLComponent(this);
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.EAST;
    c.gridx = 0;
    c.gridy += 3;
    c.weightx = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    this.add(this.panelOO, c);

    textPortHT.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void removeUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void insertUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });

    textRemiseHT.getDocument().addDocumentListener(new DocumentListener() {
        public void changedUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void removeUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }

        public void insertUpdate(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });

    addRequiredSQLObject(this.comboClient, "ID_CLIENT");
    addSQLObject(this.textObjet, "NOM");
    addSQLObject(textPoidsTotal, "T_POIDS");
    addRequiredSQLObject(dateCommande, "DATE");
    // addRequiredSQLObject(radioEtat, "ID_ETAT_DEVIS");
    addRequiredSQLObject(this.numeroUniqueCommande, "NUMERO");
    addSQLObject(this.infos, "INFOS");
    addSQLObject(this.comboDevis, "ID_DEVIS");

    this.numeroUniqueCommande
            .setText(NumerotationAutoSQLElement.getNextNumero(CommandeClientSQLElement.class, new Date()));

    this.table.getModel().addTableModelListener(new TableModelListener() {

        public void tableChanged(TableModelEvent e) {
            textPoidsTotal.setText(String.valueOf(CommandeClientSQLComponent.this.table.getPoidsTotal()));
        }
    });
    DefaultGridBagConstraints.lockMinimumSize(comboClient);
    DefaultGridBagConstraints.lockMinimumSize(comboCommercial);
    DefaultGridBagConstraints.lockMinimumSize(comboDevis);
    DefaultGridBagConstraints.lockMinimumSize(totalTTC);
    DefaultGridBagConstraints.lockMaximumSize(totalTTC);
    DefaultGridBagConstraints.lockMinimumSize(numeroUniqueCommande);

}

From source file:org.jets3t.apps.cockpit.gui.LoginLocalFolderPanel.java

private void initGui() {
    // Textual information.
    String descriptionText = "<html><center>" + "Your credentials are stored in encrypted files in a folder on "
            + "your computer. Each stored login has a nickname."
            + "<br><font size=\"-2\">You need to store your credentials before you can use this login method.</font>"
            + "</center></html>";
    String folderTooltipText = "The folder containing your credentials";
    String browseButtonText = "Change Folder";
    String accountNicknameText = "Stored logins";
    String accountNicknameTooltipText = "Nicknames of the login credentials you have stored";
    String passwordLabelText = "Password";
    String passwordTooltipText = "The password that protects your encrypted file. "
            + "This password may be left empty if you are sure your computer cannot be compromised";

    // Components.
    JHtmlLabel descriptionLabel = new JHtmlLabel(descriptionText, hyperlinkListener);
    descriptionLabel.setHorizontalAlignment(JLabel.CENTER);
    folderPathTextField = new JTextField(this.cockpitHomeFolder.getAbsolutePath());
    folderPathTextField.setEnabled(false);
    folderPathTextField.setToolTipText(folderTooltipText);
    JButton browseButton = new JButton(browseButtonText);
    browseButton.addActionListener(this);
    JHtmlLabel accountNicknamesLabel = new JHtmlLabel(accountNicknameText, hyperlinkListener);
    nicknamesTableModel = new ProviderCredentialsFileTableModel();
    accountNicknameTable = new JTable(nicknamesTableModel);
    accountNicknameTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    accountNicknameTable.setShowHorizontalLines(true);
    accountNicknameTable.getTableHeader().setVisible(false);
    JScrollPane accountNicknamesScrollPane = new JScrollPane(accountNicknameTable);
    accountNicknamesScrollPane.setToolTipText(accountNicknameTooltipText);
    JHtmlLabel passwordLabel = new JHtmlLabel(passwordLabelText, hyperlinkListener);
    passwordPasswordField = new JPasswordField();
    passwordPasswordField.setToolTipText(passwordTooltipText);

    int row = 0;/* ww w. ja  va2  s .c o m*/
    add(descriptionLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(folderPathTextField, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    add(browseButton, new GridBagConstraints(1, row++, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    add(accountNicknamesLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(accountNicknamesScrollPane, new GridBagConstraints(0, row++, 2, 1, 0, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(passwordLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    add(passwordPasswordField, new GridBagConstraints(0, row++, 2, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
}

From source file:org.jets3t.apps.cockpitlite.ToggleAclDialog.java

/**
 * Initialises all GUI elements./* ww  w . ja v a2s. c o  m*/
 */
private void initGui() {
    // Initialise skins factory.
    skinsFactory = SkinsFactory.getInstance(applicationProperties);

    // Set Skinned Look and Feel.
    LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme("SkinnedLookAndFeel");
    try {
        UIManager.setLookAndFeel(lookAndFeel);
    } catch (UnsupportedLookAndFeelException e) {
        log.error("Unable to set skinned LookAndFeel", e);
    }

    this.setResizable(false);
    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);

    JHtmlLabel messageLabel = skinsFactory.createSkinnedJHtmlLabel("ToggleAclDialogMessage", hyperlinkListener);
    messageLabel.setText("File privacy setting:");
    messageLabel.setHorizontalAlignment(JLabel.CENTER);

    privateRadioButton = skinsFactory.createSkinnedJRadioButton("ToggleAclDialogPrivateRadioButton");
    privateRadioButton.setText("Private file");
    publicRadioButton = skinsFactory.createSkinnedJRadioButton("ToggleAclDialogPublicRadioButton");
    publicRadioButton.setText("Public file");
    ButtonGroup buttonGroup = new ButtonGroup();
    buttonGroup.add(privateRadioButton);
    buttonGroup.add(publicRadioButton);

    publicRadioButton.setSelected(isPublicObject);
    privateRadioButton.setSelected(!isPublicObject);

    JButton okButton = skinsFactory.createSkinnedJButton("ToggleAclDialogOkButton");
    okButton.setName("OK");
    okButton.setText("OK");
    okButton.addActionListener(this);
    this.getRootPane().setDefaultButton(okButton);

    JPanel buttonsPanel = skinsFactory.createSkinnedJPanel("ToggleAclDialogButtonsPanel");
    buttonsPanel.setLayout(new GridBagLayout());
    buttonsPanel.add(privateRadioButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    buttonsPanel.add(publicRadioButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    buttonsPanel.add(okButton, new GridBagConstraints(0, 1, 2, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsZero, 0, 0));

    int row = 0;
    this.getContentPane().setLayout(new GridBagLayout());
    this.getContentPane().add(messageLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0));
    this.getContentPane().add(buttonsPanel, new GridBagConstraints(0, row++, 1, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    this.pack();
    this.setLocationRelativeTo(this.getOwner());
}

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

private void initGui() {
    // Textual information.
    String descriptionText = "<html><center>"
            + "Your AWS Credentials are stored in encrypted files in a folder on "
            + "your computer. Each stored login has a nickname."
            + "<br><font size=\"-2\">You need to store your AWS credentials before you can use this login method.</font>"
            + "</center></html>";
    String folderTooltipText = "The folder containing your AWS Credentials";
    String browseButtonText = "Change Folder";
    String accountNicknameText = "Stored logins";
    String accountNicknameTooltipText = "Nicknames of the login credentials you have stored";
    String passwordLabelText = "Password";
    String passwordTooltipText = "The password that protects your encrypted file. "
            + "This password may be left empty if you are sure your computer cannot be compromised";

    // Components.
    JHtmlLabel descriptionLabel = new JHtmlLabel(descriptionText, hyperlinkListener);
    descriptionLabel.setHorizontalAlignment(JLabel.CENTER);
    folderPathTextField = new JTextField(this.cockpitHomeFolder.getAbsolutePath());
    folderPathTextField.setEnabled(false);
    folderPathTextField.setToolTipText(folderTooltipText);
    JButton browseButton = new JButton(browseButtonText);
    browseButton.addActionListener(this);
    JHtmlLabel accountNicknamesLabel = new JHtmlLabel(accountNicknameText, hyperlinkListener);
    nicknamesTableModel = new AWSCredentialsFileTableModel();
    accountNicknameTable = new JTable(nicknamesTableModel);
    accountNicknameTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    accountNicknameTable.setShowHorizontalLines(true);
    accountNicknameTable.getTableHeader().setVisible(false);
    JScrollPane accountNicknamesScrollPane = new JScrollPane(accountNicknameTable);
    accountNicknamesScrollPane.setToolTipText(accountNicknameTooltipText);
    JHtmlLabel passwordLabel = new JHtmlLabel(passwordLabelText, hyperlinkListener);
    passwordPasswordField = new JPasswordField();
    passwordPasswordField.setToolTipText(passwordTooltipText);

    int row = 0;/*from w w  w  . java  2 s  . co m*/
    add(descriptionLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(folderPathTextField, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    add(browseButton, new GridBagConstraints(1, row++, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    add(accountNicknamesLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(accountNicknamesScrollPane, new GridBagConstraints(0, row++, 2, 1, 0, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    add(passwordLabel, new GridBagConstraints(0, row++, 2, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    add(passwordPasswordField, new GridBagConstraints(0, row++, 2, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
}

From source file:com.oracle.tutorial.jdbc.CoffeesFrame.java

public CoffeesFrame(JDBCTutorialUtilities settingsArg) throws SQLException {

    super("The Coffee Break: COFFEES Table"); // Set window title

    this.settings = settingsArg;
    connection = settings.getConnection();

    // Close connections exit the application when the user
    // closes the window

    addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {

            try {
                connection.close();/*from  ww  w .j av  a2 s  .  co  m*/
            } catch (SQLException sqle) {
                JDBCTutorialUtilities.printSQLException(sqle);
            }
            System.exit(0);
        }
    });

    // Initialize and lay out window controls

    CachedRowSet myCachedRowSet = getContentsOfCoffeesTable();
    myCoffeesTableModel = new CoffeesTableModel(myCachedRowSet);
    myCoffeesTableModel.addEventHandlersToRowSet(this);

    table = new JTable(); // Displays the table
    table.setModel(myCoffeesTableModel);

    label_COF_NAME = new JLabel();
    label_SUP_ID = new JLabel();
    label_PRICE = new JLabel();
    label_SALES = new JLabel();
    label_TOTAL = new JLabel();

    textField_COF_NAME = new JTextField(10);
    textField_SUP_ID = new JTextField(10);
    textField_PRICE = new JTextField(10);
    textField_SALES = new JTextField(10);
    textField_TOTAL = new JTextField(10);

    button_ADD_ROW = new JButton();
    button_UPDATE_DATABASE = new JButton();
    button_DISCARD_CHANGES = new JButton();

    label_COF_NAME.setText("Coffee Name:");
    label_SUP_ID.setText("Supplier ID:");
    label_PRICE.setText("Price:");
    label_SALES.setText("Sales:");
    label_TOTAL.setText("Total Sales:");

    textField_COF_NAME.setText("Enter new coffee name");
    textField_SUP_ID.setText("101");
    textField_PRICE.setText("0");
    textField_SALES.setText("0");
    textField_TOTAL.setText("0");

    button_ADD_ROW.setText("Add row to table");
    button_UPDATE_DATABASE.setText("Update database");
    button_DISCARD_CHANGES.setText("Discard changes");

    // Place the components within the container contentPane; use GridBagLayout
    // as the layout.

    Container contentPane = getContentPane();
    contentPane.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
    contentPane.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();

    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.CENTER;
    c.weightx = 0.5;
    c.weighty = 1.0;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 2;
    contentPane.add(new JScrollPane(table), c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.25;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 1;
    contentPane.add(label_COF_NAME, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.75;
    c.weighty = 0;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = 1;
    contentPane.add(textField_COF_NAME, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.25;
    c.weighty = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = 1;
    contentPane.add(label_SUP_ID, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.75;
    c.weighty = 0;
    c.gridx = 1;
    c.gridy = 2;
    c.gridwidth = 1;
    contentPane.add(textField_SUP_ID, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.25;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = 1;
    contentPane.add(label_PRICE, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.75;
    c.weighty = 0;
    c.gridx = 1;
    c.gridy = 3;
    c.gridwidth = 1;
    contentPane.add(textField_PRICE, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.25;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 4;
    c.gridwidth = 1;
    contentPane.add(label_SALES, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.75;
    c.weighty = 0;
    c.gridx = 1;
    c.gridy = 4;
    c.gridwidth = 1;
    contentPane.add(textField_SALES, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.25;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 5;
    c.gridwidth = 1;
    contentPane.add(label_TOTAL, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.75;
    c.weighty = 0;
    c.gridx = 1;
    c.gridy = 5;
    c.gridwidth = 1;
    contentPane.add(textField_TOTAL, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.5;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 6;
    c.gridwidth = 1;
    contentPane.add(button_ADD_ROW, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_END;
    c.weightx = 0.5;
    c.weighty = 0;
    c.gridx = 1;
    c.gridy = 6;
    c.gridwidth = 1;
    contentPane.add(button_UPDATE_DATABASE, c);

    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.LINE_START;
    c.weightx = 0.5;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 7;
    c.gridwidth = 1;
    contentPane.add(button_DISCARD_CHANGES, c);

    // Add listeners for the buttons in the application

    button_ADD_ROW.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {

            JOptionPane.showMessageDialog(CoffeesFrame.this, new String[] { "Adding the following row:",
                    "Coffee name: [" + textField_COF_NAME.getText() + "]",
                    "Supplier ID: [" + textField_SUP_ID.getText() + "]",
                    "Price: [" + textField_PRICE.getText() + "]", "Sales: [" + textField_SALES.getText() + "]",
                    "Total: [" + textField_TOTAL.getText() + "]" });

            try {

                myCoffeesTableModel.insertRow(textField_COF_NAME.getText(),
                        Integer.parseInt(textField_SUP_ID.getText().trim()),
                        Float.parseFloat(textField_PRICE.getText().trim()),
                        Integer.parseInt(textField_SALES.getText().trim()),
                        Integer.parseInt(textField_TOTAL.getText().trim()));
            } catch (SQLException sqle) {
                displaySQLExceptionDialog(sqle);
            }
        }
    });

    button_UPDATE_DATABASE.addActionListener(new ActionListener() {

        public void actionPerformed(ActionEvent e) {
            try {
                myCoffeesTableModel.coffeesRowSet.acceptChanges();
            } catch (SQLException sqle) {
                displaySQLExceptionDialog(sqle);
                // Now revert back changes
                try {
                    createNewTableModel();
                } catch (SQLException sqle2) {
                    displaySQLExceptionDialog(sqle2);
                }
            }
        }
    });

    button_DISCARD_CHANGES.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            try {
                createNewTableModel();
            } catch (SQLException sqle) {
                displaySQLExceptionDialog(sqle);
            }
        }
    });
}

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

protected void createControlPanel(JPanel dataPanel) {
    JPanel cntlPanel = new JPanel();
    GridBagConstraints gbl_ctrlPanel = new GridBagConstraints();
    gbl_ctrlPanel.insets = insets3;//w w w.j  ava 2s  .c om
    gbl_ctrlPanel.anchor = GridBagConstraints.NORTH;
    gbl_ctrlPanel.fill = GridBagConstraints.HORIZONTAL;
    gbl_ctrlPanel.gridx = 0;
    gbl_ctrlPanel.gridy = 0;
    gbl_ctrlPanel.weightx = 1.0;
    gbl_ctrlPanel.gridwidth = 2;
    dataPanel.add(cntlPanel, gbl_ctrlPanel);

    GridBagLayout gbl_cntlPanel = new GridBagLayout();
    gbl_cntlPanel.columnWidths = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    gbl_cntlPanel.rowHeights = new int[] { 0 };
    gbl_cntlPanel.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            1.0 };
    gbl_cntlPanel.rowWeights = new double[] { 0 };
    cntlPanel.setLayout(gbl_cntlPanel);

    addButton(cntlPanel, 0, "Load Log", "loadlog", GridBagConstraints.WEST);
    addButton(cntlPanel, 1, "Clear SD Data", "clearorig", GridBagConstraints.WEST);
    addButton(cntlPanel, 2, "Clear Run Data", "clearlog", GridBagConstraints.WEST);
    addButton(cntlPanel, 3, "Clear All", "clearall", GridBagConstraints.WEST);
    addLabel(cntlPanel, 4, "SD");
    sdType = addComboBox(cntlPanel, 5, new String[] { "RR SD", "Cobb SD" });
    addLabel(cntlPanel, 6, "MP");
    mpType = addComboBox(cntlPanel, 7,
            new String[] { "Torr/mmHG Abs", "Torr/mmHG Rel Sea Lvl", "Psi Abs", "Psi Rel Sea Lvl" });
    addLabel(cntlPanel, 8, "Run");
    dataType = addComboBox(cntlPanel, 9, new String[] { "MAF Builder", "AFR Tuner" });
    addCheckBox(cntlPanel, 10, "Hide Log Table", "hidelogtable");
    compareTableCheckBox = addCheckBox(cntlPanel, 11, "Compare Tables", "comparetables");
    addButton(cntlPanel, 12, "GO", "go", GridBagConstraints.EAST);
}

From source file:com.choicemaker.cm.modelmaker.gui.panels.StatisticsHistogramPanel.java

private void layoutPanel() {
    GridBagLayout layout = new GridBagLayout();
    setLayout(layout);//w  w w. ja v a2s.  c  o  m
    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(2, 10, 5, 10);

    //Row 0..........................................................
    //histo
    c.gridy = 0;
    c.gridx = 0;
    c.gridwidth = 5;
    c.weightx = 1;
    c.weighty = 1;
    c.fill = GridBagConstraints.BOTH;
    add(histoPanel, c);

    //Row 1..........................................................
    //binWidthLabel
    c.gridy = 1;
    c.gridx = 1;
    c.gridwidth = 1;
    c.weightx = 0;
    c.weighty = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.EAST;
    layout.setConstraints(binWidthLabel, c);
    add(binWidthLabel);
    //binWidthField
    c.gridx = 2;
    c.ipadx = 10;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.WEST;
    layout.setConstraints(binWidthField, c);
    add(binWidthField);
}

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

private void initialize() {
    GridBagConstraints gridBagConstraints = new GridBagConstraints();
    gridBagConstraints.gridx = 0;//from  w w w  .  j a  v a  2  s .  c  om
    gridBagConstraints.gridy = 0;
    gridBagConstraints.gridwidth = 5;
    gridBagConstraints.weightx = 0.7;
    gridBagConstraints.insets = new Insets(10, 300, 0, 0); //(int top, int left, int bottom, int right)
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
    gridBagConstraints7.gridx = 5;
    gridBagConstraints7.gridy = 0;
    gridBagConstraints7.weightx = 0.3;
    gridBagConstraints7.insets = new Insets(10, 0, 0, 90);
    gridBagConstraints.fill = GridBagConstraints.HORIZONTAL;
    GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
    gridBagConstraints3.gridx = 0;
    gridBagConstraints3.gridy = 1;
    gridBagConstraints3.weightx = 1.0;
    gridBagConstraints3.gridwidth = 6;
    GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
    gridBagConstraints5.fill = GridBagConstraints.BOTH;
    gridBagConstraints5.gridx = 0;
    gridBagConstraints5.gridy = 2;
    gridBagConstraints5.weightx = 1.0;
    gridBagConstraints5.weighty = 1.0;
    gridBagConstraints5.gridwidth = 6;
    this.setSize(920, 700);
    this.setLayout(new GridBagLayout());
    this.add(getJPanelProjectCombo(), gridBagConstraints);
    this.add(getJPanelAutoIdentify(), gridBagConstraints7);
    this.add(JPanPendingTypeSelection(), gridBagConstraints3);
    this.add(getJSplitPaneMain(), gridBagConstraints5);
}

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

/**
 * This method initializes jPanelValue   
 *    /*from  www  .  j a v a  2 s. c o m*/
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelValue() {
    if (jPanelValue == null) {

        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));

        // Default Report Location

        jLabelDefaultReportLocation = new JLabel();
        jLabelDefaultReportLocation.setText("Default Report Location:");
        jLabelDefaultReportLocation.setHorizontalAlignment(SwingConstants.RIGHT);

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

        GridBagConstraints gridBagConstraintsjpanelDefaultReportLocation = new GridBagConstraints();
        gridBagConstraintsjpanelDefaultReportLocation.fill = GridBagConstraints.BOTH;
        gridBagConstraintsjpanelDefaultReportLocation.gridy = 1;
        gridBagConstraintsjpanelDefaultReportLocation.weightx = 1.0;
        gridBagConstraintsjpanelDefaultReportLocation.insets = new Insets(10, 5, 5, 15);
        gridBagConstraintsjpanelDefaultReportLocation.gridx = 1;

        // reciprocal license

        jLabelReciprocalLicense = new JLabel();
        jLabelReciprocalLicense.setText("Reciprocal License (RED):");
        jLabelReciprocalLicense.setHorizontalAlignment(SwingConstants.RIGHT);

        GridBagConstraints gridBagConstraintsjLabelReciprocalLicense = new GridBagConstraints();
        gridBagConstraintsjLabelReciprocalLicense.gridx = 0;
        gridBagConstraintsjLabelReciprocalLicense.insets = new Insets(0, 15, 0, 0);
        gridBagConstraintsjLabelReciprocalLicense.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelReciprocalLicense.gridy = 2;
        jPanelValue.add(jLabelDefaultReportLocation, gridBagConstraintsjLabelDefaultReportLocation);
        jPanelValue.add(getJPanelDefaultReportLocation(), gridBagConstraintsjpanelDefaultReportLocation);
        jPanelValue.add(jLabelReciprocalLicense, gridBagConstraintsjLabelReciprocalLicense);

        GridBagConstraints gridBagConstraintsgetJTextFieldReciprocalLicense = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldReciprocalLicense.gridx = 1;
        gridBagConstraintsgetJTextFieldReciprocalLicense.weightx = 1.0;
        gridBagConstraintsgetJTextFieldReciprocalLicense.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldReciprocalLicense.insets = new Insets(5, 5, 5, 15);
        gridBagConstraintsgetJTextFieldReciprocalLicense.gridy = 2;
        jPanelValue.add(getJTextFieldReciprocalLicense(), gridBagConstraintsgetJTextFieldReciprocalLicense);

        // major license

        jLabelMajorLicense = new JLabel();
        jLabelMajorLicense.setText("Major License (ORANGE):");
        jLabelMajorLicense.setHorizontalAlignment(SwingConstants.RIGHT);

        GridBagConstraints gridBagConstraintsjLabelMajorLicense = new GridBagConstraints();
        gridBagConstraintsjLabelMajorLicense.gridx = 0;
        gridBagConstraintsjLabelMajorLicense.insets = new Insets(0, 15, 0, 0);
        gridBagConstraintsjLabelMajorLicense.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraintsjLabelMajorLicense.gridy = 3;
        jPanelValue.add(jLabelMajorLicense, gridBagConstraintsjLabelMajorLicense);

        GridBagConstraints gridBagConstraintsgetJTextFieldMajorLicense = new GridBagConstraints();
        gridBagConstraintsgetJTextFieldMajorLicense.gridx = 1;
        gridBagConstraintsgetJTextFieldMajorLicense.weightx = 1.0;
        gridBagConstraintsgetJTextFieldMajorLicense.fill = GridBagConstraints.BOTH;
        gridBagConstraintsgetJTextFieldMajorLicense.insets = new Insets(5, 5, 5, 15);
        gridBagConstraintsgetJTextFieldMajorLicense.gridy = 3;
        jPanelValue.add(getJTextFieldMajorLicense(), gridBagConstraintsgetJTextFieldMajorLicense);

        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridx = 1;
        gridBagConstraints3.weighty = 1.0;
        gridBagConstraints3.weightx = 0.0;
        gridBagConstraints3.gridy = 4;
        JLabel jLabelEmpty = new JLabel();
        jLabelEmpty.setText("");
        jPanelValue.add(jLabelEmpty, gridBagConstraints3);
    }
    return jPanelValue;
}