Example usage for java.awt GridBagConstraints BOTH

List of usage examples for java.awt GridBagConstraints BOTH

Introduction

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

Prototype

int BOTH

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

Click Source Link

Document

Resize the component both horizontally and vertically.

Usage

From source file:com.pingtel.sipviewer.SIPViewerFrame.java

protected void layoutComponents() {
    Container rootPane = this.getContentPane();

    // this is the vertical container to which all the
    // windows are added
    Container verticalContainer = new Container();
    verticalContainer.setLayout(new GridBagLayout());

    m_scrollPaneTimeIndex.setMinimumSize(new Dimension(150, 50));
    m_scrollPaneTimeIndexSecond.setMinimumSize(new Dimension(150, 50));

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weightx = 0;/* w  ww .  j ava  2  s  .c  o m*/
    gbc.weighty = 1.0;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridwidth = 1;

    verticalContainer.add(m_scrollPaneTimeIndex, gbc);
    gbc.gridx = 1;
    verticalContainer.add(m_scrollPane, gbc);

    gbc.gridx = 0;
    gbc.gridy = 1;
    verticalContainer.add(m_scrollPaneTimeIndexSecond, gbc);

    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.gridx = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    verticalContainer.add(m_scrollPaneSecond, gbc);

    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridwidth = 2;
    gbc.gridx = 0;
    gbc.gridy = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    verticalContainer.add(m_infoPanel, gbc);

    rootPane.add(verticalContainer, BorderLayout.CENTER);
}

From source file:zet.gui.assignmentEditor.JAssignmentPanel.java

/**
 * Returns the panel on the right side of the {@code JAssignmentPanel} that
 * contains distributions for all properties and a plot of the distribution
 * with the current parameters./*from  www .  ja va2s  . c  o m*/
 * @return the panel on the right side of the {@code JAssignmentPanel}
 */
private JPanel getRightPanel() {
    final JPanel rightPanel = new JPanel(new GridBagLayout());

    final JPanel tableContainer = new JPanel(new BorderLayout());
    tableContainer.add(distributionTable.getTableHeader(), BorderLayout.PAGE_START);
    tableContainer.add(distributionTable, BorderLayout.CENTER);

    rightPanel.add(tableContainer, new GridBagConstraints(0, 0, 1, 1, 1.0, 0.0, GridBagConstraints.NORTH,
            GridBagConstraints.BOTH, new Insets(16, 0, 0, 16), 0, 0));

    XYSeriesCollection c = new XYSeriesCollection();
    chart = ChartFactory.createXYLineChart(loc.getStringWithoutPrefix("gui.AssignmentEditor.plot.Title"),
            loc.getStringWithoutPrefix("gui.AssignmentEditor.plot.Values"), // x axis label
            loc.getStringWithoutPrefix("gui.AssignmentEditor.plot.Probability"), // y axis label
            c, // Dataset
            PlotOrientation.VERTICAL, false, true, false // Show legend, tooltips, url
    );

    chartPanel = new ChartPanel(chart);
    rightPanel.add(chartPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(16, 0, 0, 16), 0, 0));

    rightPanel.add(chartPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(16, 0, 0, 16), 0, 0));

    return rightPanel;
}

From source file:org.openconcerto.erp.core.sales.invoice.component.SaisieVenteFactureSQLComponent.java

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

    this.checkPrevisionnelle = new JCheckBox();
    this.checkComplement = new JCheckBox();
    this.fieldTTC = new DeviseField();

    final ComptaPropsConfiguration comptaPropsConfiguration = ((ComptaPropsConfiguration) Configuration
            .getInstance());/*from  w  w  w  .  j  a v a2  s.  c o  m*/

    this.textAvoirTTC = new DeviseField();

    // Champ Module
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();
    this.setAdditionalFieldsPanel(new FormLayouter(addP, 1));
    this.add(addP, c);

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

    if (getTable().contains("ID_POLE_PRODUIT")) {
        JLabel labelPole = new JLabel(getLabelFor("ID_POLE_PRODUIT"));
        labelPole.setHorizontalAlignment(SwingConstants.RIGHT);
        this.add(labelPole, c);
        c.gridx++;
        ElementComboBox pole = new ElementComboBox();

        this.add(pole, c);
        this.addSQLObject(pole, "ID_POLE_PRODUIT");
        c.gridy++;
        c.gridwidth = 1;
        c.gridx = 0;
    }

    /*******************************************************************************************
     * * RENSEIGNEMENTS
     ******************************************************************************************/
    // Ligne 1 : Numero de facture
    JLabel labelNum = new JLabel(getLabelFor("NUMERO"));
    labelNum.setHorizontalAlignment(SwingConstants.RIGHT);
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    this.add(labelNum, c);

    this.textNumeroUnique = new JUniqueTextField(16);
    c.gridx++;
    c.weightx = 0;
    c.fill = GridBagConstraints.NONE;
    DefaultGridBagConstraints.lockMinimumSize(this.textNumeroUnique);
    this.add(textNumeroUnique, c);

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

    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    final JDate dateSaisie = new JDate(true);

    // listener permettant la mise  jour du numro de facture en fonction de la date
    // slectionne
    dateSaisie.addValueListener(new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (!isFilling() && dateSaisie.getValue() != null) {

                final String nextNumero = NumerotationAutoSQLElement
                        .getNextNumero(SaisieVenteFactureSQLElement.class, dateSaisie.getValue());

                if (textNumeroUnique.getText().trim().length() > 0
                        && !nextNumero.equalsIgnoreCase(textNumeroUnique.getText())) {

                    int answer = JOptionPane.showConfirmDialog(SaisieVenteFactureSQLComponent.this,
                            "Voulez vous actualiser le numro de la facture?",
                            "Changement du numro de facture", JOptionPane.YES_NO_OPTION);
                    if (answer == JOptionPane.NO_OPTION) {
                        return;
                    }
                }

                textNumeroUnique.setText(nextNumero);

            }

        }
    });
    this.add(dateSaisie, c);

    // Ligne 2 : reference
    c.gridx = 0;
    c.gridwidth = 1;
    c.gridy++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    JLabel labelLibelle = new JLabel(getLabelFor("NOM"));
    labelLibelle.setHorizontalAlignment(SwingConstants.RIGHT);
    this.add(labelLibelle, c);

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

    this.addSQLObject(textLibelle, "NOM");
    c.fill = GridBagConstraints.HORIZONTAL;
    this.comboCommercial = new ElementComboBox(false);
    // Commercial
    String field;
    field = "ID_COMMERCIAL";
    c.gridx++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel(getLabelFor(field), SwingConstants.RIGHT), c);

    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;

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

    c.gridx++;
    c.weightx = 1;
    c.fill = GridBagConstraints.NONE;
    this.comboClient = new ElementComboBox();

    this.add(this.comboClient, c);

    if (getTable().contains("ID_ECHEANCIER_CCI")) {
        // Echeancier
        c.gridx++;
        c.weightx = 0;
        c.fill = GridBagConstraints.HORIZONTAL;
        this.add(new JLabel(getLabelFor("ID_ECHEANCIER_CCI"), SwingConstants.RIGHT), c);

        c.gridx++;
        c.weightx = 1;
        c.fill = GridBagConstraints.NONE;
        final ElementComboBox echeancier = new ElementComboBox();
        final SQLElement contactElement = Configuration.getInstance().getDirectory()
                .getElement("ECHEANCIER_CCI");
        echeancier.init(contactElement, contactElement.getComboRequest(true));
        DefaultGridBagConstraints.lockMinimumSize(echeancier);
        this.addView(echeancier, "ID_ECHEANCIER_CCI");

        selAffaire.addValueListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent arg0) {
                // TODO Raccord de mthode auto-gnr
                if (selAffaire.getSelectedRow() != null) {
                    echeancier.getRequest().setWhere(new Where(contactElement.getTable().getField("ID_AFFAIRE"),
                            "=", selAffaire.getSelectedRow().getID()));

                    if (!isFilling()) {
                        SQLRow rowPole = selAffaire.getSelectedRow().getForeignRow("ID_POLE_PRODUIT");
                        comboCommercial.setValue(rowPole);
                    }
                } else {
                    echeancier.getRequest().setWhere(null);
                }
            }
        });
        this.add(echeancier, c);

    }

    this.comboClient.addValueListener(this.changeClientListener);

    this.comboAdresse = new ElementComboBox();
    this.comboAdresse.setAddIconVisible(false);
    this.comboAdresse.setListIconVisible(false);
    JLabel labelAdresse = new JLabel(getLabelFor("ID_ADRESSE"), SwingConstants.RIGHT);
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 1;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    labelAdresse.setHorizontalAlignment(SwingConstants.RIGHT);
    this.add(labelAdresse, c);

    c.gridx++;
    c.fill = GridBagConstraints.NONE;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1;
    this.add(this.comboAdresse, c);

    // Acompte
    this.checkAcompte = new JCheckBox(getLabelFor("ACOMPTE"));
    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    // this.add(this.checkAcompte, c);
    c.gridwidth = 1;
    this.addView(this.checkAcompte, "ACOMPTE");

    // Compte Service
    this.checkCompteServiceAuto = new JCheckBox(getLabelFor("COMPTE_SERVICE_AUTO"));
    this.addSQLObject(this.checkCompteServiceAuto, "COMPTE_SERVICE_AUTO");
    this.compteSelService = new ISQLCompteSelector();

    this.labelCompteServ = new JLabel("Compte Service");
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 1;
    c.weightx = 0;
    this.labelCompteServ.setHorizontalAlignment(SwingConstants.RIGHT);
    this.add(this.labelCompteServ, c);

    c.gridx++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1;
    this.add(this.compteSelService, c);

    String valServ = DefaultNXProps.getInstance().getStringProperty("ArticleService");
    Boolean bServ = Boolean.valueOf(valServ);

    this.checkCompteServiceAuto.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setCompteServiceVisible(!SaisieVenteFactureSQLComponent.this.checkCompteServiceAuto.isSelected());
        }
    });

    // FIXME A checker si utile pour Preventec ou KD
    setCompteServiceVisible(false);
    // setCompteServiceVisible(!(bServ != null && !bServ.booleanValue()));

    final JPanel pAcompte = new JPanel();
    final DeviseField textAcompteHT = new DeviseField();
    pAcompte.add(new JLabel("Acompte HT"));
    pAcompte.add(textAcompteHT);

    pAcompte.add(new JLabel("soit"));
    final JTextField textAcompte = new JTextField(5);
    pAcompte.add(textAcompte);
    pAcompte.add(new JLabel("%"));
    c.gridx = 0;
    c.gridy++;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.NONE;
    this.add(pAcompte, c);
    c.anchor = GridBagConstraints.WEST;
    this.addView(textAcompte, "POURCENT_ACOMPTE");

    pAcompte.setVisible(false);

    /*******************************************************************************************
     * * DETAILS
     ******************************************************************************************/
    this.tableFacture = new SaisieVenteFactureItemTable();

    final ElementComboBox boxTarif = new ElementComboBox();
    if (this.getTable().getFieldsName().contains("ID_TARIF")) {
        // TARIF
        c.gridy++;
        c.gridx = 0;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        c.fill = GridBagConstraints.HORIZONTAL;
        this.add(new JLabel("Tarif  appliquer", SwingConstants.RIGHT), c);
        c.gridx++;
        c.gridwidth = GridBagConstraints.REMAINDER;
        c.fill = GridBagConstraints.NONE;
        c.weightx = 1;
        DefaultGridBagConstraints.lockMinimumSize(boxTarif);
        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());
                tableFacture.setTarif(selectedRow, false);
            }
        });
    }
    c.gridy++;
    c.gridx = 0;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.BOTH;

    ITextArea infos = new ITextArea(4, 4);
    this.add(this.tableFacture, c);

    // FIXME
    this.addView(this.tableFacture.getRowValuesTable(), "");

    /*******************************************************************************************
     * * MODE DE REGLEMENT
     ******************************************************************************************/
    JPanel panelBottom = new JPanel(new GridBagLayout());
    GridBagConstraints cBottom = new DefaultGridBagConstraints();
    cBottom.weightx = 1;
    cBottom.anchor = GridBagConstraints.NORTHWEST;
    // Mode de rglement
    this.addView("ID_MODE_REGLEMENT", REQ + ";" + DEC + ";" + SEP);
    this.eltModeRegl = (ElementSQLObject) this.getView("ID_MODE_REGLEMENT");
    panelBottom.add(this.eltModeRegl, cBottom);

    /*******************************************************************************************
     * * FRAIS DE PORT ET REMISE
     ******************************************************************************************/
    JPanel panelFrais = new JPanel();
    panelFrais.setLayout(new GridBagLayout());

    final GridBagConstraints cFrais = new DefaultGridBagConstraints();

    this.textPortHT = new DeviseField(5);
    DefaultGridBagConstraints.lockMinimumSize(textPortHT);
    addSQLObject(this.textPortHT, "PORT_HT");
    this.textRemiseHT = new DeviseField(5);
    DefaultGridBagConstraints.lockMinimumSize(textRemiseHT);
    addSQLObject(this.textRemiseHT, "REMISE_HT");

    // Frais de port
    cFrais.gridheight = 1;
    cFrais.gridx = 1;
    SQLRequestComboBox boxTaxePort = new SQLRequestComboBox(false, 8);
    if (getTable().contains("ID_TAXE_PORT")) {

        JLabel labelPortHT = new JLabel(getLabelFor("PORT_HT"));
        labelPortHT.setHorizontalAlignment(SwingConstants.RIGHT);
        cFrais.gridy++;
        panelFrais.add(labelPortHT, cFrais);
        cFrais.gridx++;
        panelFrais.add(this.textPortHT, cFrais);

        JLabel labelTaxeHT = new JLabel(getLabelFor("ID_TAXE_PORT"));
        labelTaxeHT.setHorizontalAlignment(SwingConstants.RIGHT);
        cFrais.gridx = 1;
        cFrais.gridy++;
        panelFrais.add(labelTaxeHT, cFrais);
        cFrais.gridx++;
        panelFrais.add(boxTaxePort, cFrais);
        this.addView(boxTaxePort, "ID_TAXE_PORT", REQ);

        boxTaxePort.addValueListener(new PropertyChangeListener() {

            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                // TODO Raccord de mthode auto-gnr
                totalTTC.updateTotal();
            }
        });
    }

    // Remise
    JLabel labelRemiseHT = new JLabel(getLabelFor("REMISE_HT"));
    labelRemiseHT.setHorizontalAlignment(SwingConstants.RIGHT);
    cFrais.gridy++;
    cFrais.gridx = 1;
    panelFrais.add(labelRemiseHT, cFrais);
    cFrais.gridx++;
    panelFrais.add(this.textRemiseHT, cFrais);
    cFrais.gridy++;

    cBottom.gridx++;
    cBottom.weightx = 1;
    cBottom.anchor = GridBagConstraints.NORTHEAST;
    cBottom.fill = GridBagConstraints.NONE;
    panelBottom.add(panelFrais, cBottom);

    /*******************************************************************************************
     * * CALCUL DES TOTAUX
     ******************************************************************************************/
    DeviseField fieldHT = new DeviseField();
    final DeviseField fieldTVA = new DeviseField();
    DeviseField fieldService = new DeviseField();
    DeviseField fieldTHA = new DeviseField();

    DeviseField fieldDevise = null;
    if (getTable().getFieldsName().contains("T_DEVISE")) {
        fieldDevise = new DeviseField();
        addSQLObject(fieldDevise, "T_DEVISE");
    }
    // FIXME was required but not displayed for KD
    addSQLObject(fieldTHA, "T_HA");
    addRequiredSQLObject(fieldHT, "T_HT");
    addRequiredSQLObject(fieldTVA, "T_TVA");
    addRequiredSQLObject(this.fieldTTC, "T_TTC");
    addRequiredSQLObject(fieldService, "T_SERVICE");
    JTextField poids = new JTextField();
    addSQLObject(poids, "T_POIDS");

    totalTTC = new TotalPanel(this.tableFacture, fieldHT, fieldTVA, this.fieldTTC, this.textPortHT,
            this.textRemiseHT, fieldService, fieldTHA, fieldDevise, poids, null,
            (getTable().contains("ID_TAXE_PORT") ? boxTaxePort : null));
    DefaultGridBagConstraints.lockMinimumSize(totalTTC);
    cBottom.gridx++;
    cBottom.weightx = 1;
    cBottom.anchor = GridBagConstraints.EAST;
    cBottom.fill = GridBagConstraints.HORIZONTAL;
    panelBottom.add(totalTTC, cBottom);

    c.anchor = GridBagConstraints.WEST;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy++;
    c.weighty = 0;
    this.add(panelBottom, c);

    // Ligne : Avoir
    c.gridy++;
    c.gridx = 0;
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(createPanelAvoir(), c);

    // Infos
    c.gridy++;
    c.gridx = 0;
    c.gridwidth = 4;
    c.fill = GridBagConstraints.BOTH;
    this.add(new TitledSeparator(getLabelFor("INFOS")), c);

    c.gridy++;

    final JScrollPane comp = new JScrollPane(infos);
    infos.setBorder(null);
    DefaultGridBagConstraints.lockMinimumSize(comp);
    this.add(comp, c);

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

    this.addSQLObject(this.textAvoirTTC, "T_AVOIR_TTC");

    this.addRequiredSQLObject(dateSaisie, "DATE");
    this.addRequiredSQLObject(this.comboClient, "ID_CLIENT");
    this.addSQLObject(this.comboAdresse, "ID_ADRESSE");
    this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO");
    this.addSQLObject(infos, "INFOS");
    this.addSQLObject(this.checkPrevisionnelle, "PREVISIONNELLE");
    this.addSQLObject(this.checkComplement, "COMPLEMENT");
    this.addSQLObject(this.selAvoir, "ID_AVOIR_CLIENT");
    this.addSQLObject(this.compteSelService, "ID_COMPTE_PCE_SERVICE");
    ModeDeReglementSQLComponent modeReglComp;

    modeReglComp = (ModeDeReglementSQLComponent) this.eltModeRegl.getSQLChild();
    this.selAvoir.getRequest().setWhere(new Where(this.tableAvoir.getField("SOLDE"), "=", Boolean.FALSE));
    this.selAvoir.fillCombo();

    // Selection du compte de service
    int idCompteVenteService = rowPrefsCompte.getInt("ID_COMPTE_PCE_VENTE_SERVICE");
    if (idCompteVenteService <= 1) {
        try {
            idCompteVenteService = ComptePCESQLElement.getIdComptePceDefault("VentesServices");
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    this.compteSelService.setValue(idCompteVenteService);

    // Lock

    DefaultGridBagConstraints.lockMinimumSize(this.comboClient);
    DefaultGridBagConstraints.lockMinimumSize(this.comboCommercial);
    DefaultGridBagConstraints.lockMinimumSize(this.comboAdresse);

    // Listeners

    this.comboClient.addValueListener(this.listenerModeReglDefaut);
    this.fieldTTC.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent e) {
            refreshText();
        }

    });

    this.selAvoir.addValueListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {
            refreshText();
        }

    });

    this.checkAcompte.addPropertyChangeListener(new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {

            pAcompte.setVisible(SaisieVenteFactureSQLComponent.this.checkAcompte.isSelected());
        }
    });

    this.changeClientListener = new PropertyChangeListener() {

        public void propertyChange(PropertyChangeEvent evt) {

            if (SaisieVenteFactureSQLComponent.this.comboClient.getValue() != null) {
                final SQLRow row = SaisieVenteFactureSQLComponent.this.comboClient.getSelectedRow();
                final int id = row == null ? SQLRow.NONEXISTANT_ID : row.getID();

                SaisieVenteFactureSQLComponent.this.defaultContactRowValues.putForeignID("ID_CLIENT", row);
                if (row != null) {
                    if (SaisieVenteFactureSQLComponent.this.contact != null) {
                        Where w = new Where(
                                SaisieVenteFactureSQLComponent.this.eltContact.getTable().getField("ID_CLIENT"),
                                "=", SQLRow.NONEXISTANT_ID);
                        w = w.or(new Where(
                                SaisieVenteFactureSQLComponent.this.eltContact.getTable().getField("ID_CLIENT"),
                                "=", id));
                        SaisieVenteFactureSQLComponent.this.contact.getRequest().setWhere(w);
                    }
                    if (SaisieVenteFactureSQLComponent.this.comboAdresse != null) {

                        Where w = new Where(SaisieVenteFactureSQLComponent.TABLE_ADRESSE.getKey(), "=",
                                row.getInt("ID_ADRESSE"));

                        w = w.or(new Where(SaisieVenteFactureSQLComponent.TABLE_ADRESSE.getKey(), "=",
                                row.getInt("ID_ADRESSE_L")));
                        w = w.or(new Where(SaisieVenteFactureSQLComponent.TABLE_ADRESSE.getKey(), "=",
                                row.getInt("ID_ADRESSE_F")));

                        SQLRow rowCli = row;

                        w = w.or(new Where(SaisieVenteFactureSQLComponent.TABLE_ADRESSE.getField("ID_CLIENT"),
                                "=", rowCli.getID()));

                        SaisieVenteFactureSQLComponent.this.comboAdresse.getRequest().setWhere(w);
                    }
                } else {
                    if (SaisieVenteFactureSQLComponent.this.comboAdresse != null) {
                        SaisieVenteFactureSQLComponent.this.comboAdresse.getRequest().setWhere(null);
                    }
                }
                SaisieVenteFactureSQLComponent.this.previousClient = id;
            }

        }
    };

    this.changeCompteListener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            SQLSelect sel = new SQLSelect(getTable().getBase());
            sel.addSelect(SaisieVenteFactureSQLComponent.this.client.getTable().getKey());
            Where where = new Where(
                    SaisieVenteFactureSQLComponent.this.client.getTable().getField("ID_COMPTE_PCE"), "=",
                    SaisieVenteFactureSQLComponent.this.compteSel.getValue());
            sel.setWhere(where);

            String req = sel.asString();
            List l = getTable().getBase().getDataSource().execute(req);
            if (l != null) {
                if (l.size() == 1) {
                    Map<String, Object> m = (Map<String, Object>) l.get(0);
                    Object o = m.get(SaisieVenteFactureSQLComponent.this.client.getTable().getKey().getName());
                    System.err.println("Only one value match :: " + o);
                    if (o != null) {
                        SaisieVenteFactureSQLComponent.this.comboClient
                                .setValue(Integer.valueOf(((Number) o).intValue()));
                    }
                }
            }
        }
    };

    this.textPortHT.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });

    this.textRemiseHT.getDocument().addDocumentListener(new SimpleDocumentListener() {
        @Override
        public void update(DocumentEvent e) {
            totalTTC.updateTotal();
        }
    });
    this.comboClient.addValueListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (SaisieVenteFactureSQLComponent.this.isFilling())
                return;
            final SQLRow row = ((SQLRequestComboBox) evt.getSource()).getSelectedRow();
            if (row != null) {
                SaisieVenteFactureSQLComponent.this.defaultContactRowValues.putForeignID("ID_CLIENT", row);
                if (SaisieVenteFactureSQLComponent.this.client.getTable().contains("ID_TARIF")) {
                    SQLRowAccessor foreignRow = row.getForeignRow("ID_TARIF");
                    if (foreignRow != null && !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);
                    }

                }

                int idCpt = row.getInt("ID_COMPTE_PCE");

                if (idCpt <= 1) {
                    // Select Compte client par defaut
                    idCpt = rowPrefsCompte.getInt("ID_COMPTE_PCE_CLIENT");
                    if (idCpt <= 1) {
                        try {
                            idCpt = ComptePCESQLElement.getIdComptePceDefault("Clients");
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                }
                if (SaisieVenteFactureSQLComponent.this.compteSel != null) {
                    Integer i = SaisieVenteFactureSQLComponent.this.compteSel.getValue();
                    if (i == null || i.intValue() != idCpt) {
                        SaisieVenteFactureSQLComponent.this.compteSel.setValue(idCpt);
                    }
                }
            }

        }
    });

}

From source file:com.t3.client.ui.T3Frame.java

public T3Frame(JMenuBar menuBar) {
    // Set up the frame
    super(AppConstants.APP_NAME);

    this.menuBar = menuBar;

    setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
    addWindowListener(this);
    setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
    SwingUtil.centerOnScreen(this);
    setFocusTraversalPolicy(new T3FocusTraversalPolicy());

    try {/*from  w  ww  .  j  a  v  a2  s .c  o m*/
        setIconImage(ImageUtil.getImage(MINILOGO_IMAGE));
    } catch (IOException ioe) {
        String msg = I18N.getText("msg.error.loadingIconImage");
        log.error(msg, ioe);
        System.err.println(msg);
    }
    // Notify duration
    initializeNotifyDuration();

    // Components
    glassPane = new GlassPane();
    assetPanel = createAssetPanel();
    connectionPanel = createConnectionPanel();
    toolbox = new Toolbox();
    initiativePanel = createInitiativePanel();

    zoneRendererList = new CopyOnWriteArrayList<ZoneRenderer>();
    pointerOverlay = new PointerOverlay();
    colorPicker = new ColorPicker(this);
    textureChooserPanel = new TextureChooserPanel(colorPicker.getPaintChooser(), assetPanel.getModel(),
            "imageExplorerTextureChooser");
    colorPicker.getPaintChooser().addPaintChooser(textureChooserPanel);

    String credits = "";
    String version = "";
    Image logo = null;
    try {
        credits = new String(FileUtil.loadResource(CREDITS_HTML), "UTF-8"); // 2nd param of type Charset is Java6+
        version = TabletopTool.getVersion();
        credits = credits.replace("%VERSION%", version);
        logo = ImageUtil.getImage(T3_LOGO_IMAGE);
    } catch (Exception ioe) {
        log.error(I18N.getText("msg.error.credits"), ioe);
        ioe.printStackTrace();
    }
    aboutDialog = new AboutDialog(this, logo, credits);
    aboutDialog.setSize(354, 400);

    statusPanel = new StatusPanel();
    statusPanel.addPanel(getCoordinateStatusBar());
    statusPanel.addPanel(getZoomStatusBar());
    statusPanel.addPanel(MemoryStatusBar.getInstance());
    // statusPanel.addPanel(progressBar);
    statusPanel.addPanel(connectionStatusPanel);
    statusPanel.addPanel(activityMonitor);
    statusPanel.addPanel(new SpacerStatusBar(25));

    zoneRendererPanel = new JPanel(new PositionalLayout(5));
    zoneRendererPanel.setBackground(Color.black);
    //      zoneRendererPanel.add(zoneMiniMapPanel, PositionalLayout.Position.SE);
    //      zoneRendererPanel.add(getChatTypingLabel(), PositionalLayout.Position.NW);
    zoneRendererPanel.add(getChatTypingPanel(), PositionalLayout.Position.NW);
    zoneRendererPanel.add(getChatActionLabel(), PositionalLayout.Position.SW);

    commandPanel = new CommandPanel();
    TabletopTool.getMessageList().addObserver(commandPanel);

    rendererBorderPanel = new JPanel(new GridLayout());
    rendererBorderPanel.setBorder(BorderFactory.createLineBorder(Color.darkGray));
    rendererBorderPanel.add(zoneRendererPanel);

    // Put it all together
    setJMenuBar(menuBar);
    add(BorderLayout.NORTH, new ToolbarPanel(toolbox));
    add(BorderLayout.SOUTH, statusPanel);

    JLayeredPane glassPaneComposite = new JLayeredPane();
    glassPaneComposite.setLayout(new GridBagLayout());
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.fill = GridBagConstraints.BOTH;
    constraints.weightx = 1;
    constraints.weighty = 1;

    glassPaneComposite.add(glassPane, constraints);
    glassPaneComposite.add(dragImageGlassPane, constraints);

    setGlassPane(glassPane);
    //      setGlassPane(glassPaneComposite);

    glassPaneComposite.setVisible(true);

    if (!TabletopTool.MAC_OS_X)
        removeWindowsF10();
    else
        registerForMacOSXEvents();

    TabletopTool.getEventDispatcher().addListener(this, TabletopTool.ZoneEvent.Activated);

    restorePreferences();
    updateKeyStrokes();

    // This will cause the frame to be set to visible (BAD jide, BAD! No cookie for you!)
    configureDocking();

    new WindowPreferences(AppConstants.APP_NAME, "mainFrame", this);
    chatTyperObserver = new ChatTyperObserver();
    chatTyperTimers = new ChatNotificationTimers();
    chatTyperTimers.addObserver(chatTyperObserver);
    chatTimer = getChatTimer();
    setChatTypingLabelColor(AppPreferences.getChatNotificationColor());
}

From source file:erigo.filepump.FilePump.java

private void createAndShowGUI(String default_outputFolderI, double default_filesPerSecI,
        int default_totNumFilesI, FileMode default_modeI, String default_ftpHostI, String default_ftpUserI,
        String default_ftpPasswordI) {

    // Make sure we have nice window decorations.
    JFrame.setDefaultLookAndFeelDecorated(true);

    // Create the GUI components
    GridBagLayout framegbl = new GridBagLayout();
    filePumpGuiFrame = new JFrame("FilePump");
    GridBagLayout gbl = new GridBagLayout();
    JPanel guiPanel = new JPanel(gbl);
    outputFolderLabel = new JLabel(" ");
    Dimension preferredSize = new Dimension(200, 20);
    outputFolderLabel.setPreferredSize(preferredSize);
    filesPerSecLabel = new JLabel("1");
    totNumFilesLabel = new JLabel("unlimited");
    modeLabel = new JLabel("file system folder");
    fileCountLabel = new JLabel("0");
    endButton = new JButton("Finish test");
    endButton.addActionListener(this);
    actionButton = new JButton("Start pump");
    actionButton.setBackground(Color.GREEN);
    actionButton.addActionListener(this);

    filePumpGuiFrame.setFont(new Font("Dialog", Font.PLAIN, 12));
    guiPanel.setFont(new Font("Dialog", Font.PLAIN, 12));

    int row = 0;//from ww w  . j  ava2s  .  co  m

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;

    // ROW 1
    JLabel label = new JLabel("Output directory");
    gbc.insets = new Insets(15, 15, 0, 5);
    Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(15, 0, 0, 15);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, outputFolderLabel, gbl, gbc, 1, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // ROW 2
    label = new JLabel("Files/sec");
    gbc.insets = new Insets(15, 15, 0, 5);
    Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(15, 0, 0, 15);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, filesPerSecLabel, gbl, gbc, 1, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // ROW 3
    label = new JLabel("Tot num files");
    gbc.insets = new Insets(15, 15, 0, 5);
    Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(15, 0, 0, 15);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, totNumFilesLabel, gbl, gbc, 1, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // ROW 4
    label = new JLabel("Mode");
    gbc.insets = new Insets(15, 15, 0, 5);
    Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(15, 0, 0, 15);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, modeLabel, gbl, gbc, 1, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // ROW 5
    label = new JLabel("File count");
    gbc.insets = new Insets(15, 15, 0, 5);
    Utility.add(guiPanel, label, gbl, gbc, 0, row, 1, 1);
    gbc.insets = new Insets(15, 0, 0, 15);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weightx = 100;
    gbc.weighty = 100;
    Utility.add(guiPanel, fileCountLabel, gbl, gbc, 1, row, 1, 1);
    gbc.fill = GridBagConstraints.NONE;
    gbc.weightx = 0;
    gbc.weighty = 0;
    ++row;

    // ROW 6: command buttons
    JPanel buttonPanel = new JPanel();
    buttonPanel.add(actionButton);
    buttonPanel.add(endButton);
    gbc.insets = new Insets(15, 15, 15, 15);
    gbc.anchor = GridBagConstraints.CENTER;
    Utility.add(guiPanel, buttonPanel, gbl, gbc, 0, row, 2, 1);
    gbc.anchor = GridBagConstraints.WEST;
    ++row;

    // Now add guiPanel to filePumpGuiFrame
    gbc.anchor = GridBagConstraints.CENTER;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weightx = 100;
    gbc.weighty = 100;
    gbc.insets = new Insets(0, 0, 0, 0);
    Utility.add(filePumpGuiFrame, guiPanel, framegbl, gbc, 0, 0, 1, 1);

    // Add menu
    JMenuBar menuBar = createMenu();
    filePumpGuiFrame.setJMenuBar(menuBar);

    // Display the window.
    filePumpGuiFrame.pack();

    filePumpGuiFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);

    filePumpGuiFrame.addWindowListener(new WindowAdapter() {
        public void windowClosing(WindowEvent e) {
            exit();
        }
    });

    // Create a settings dialog box
    pumpSettings = new FilePumpSettings(filePumpGuiFrame, default_outputFolderI, default_filesPerSecI,
            default_totNumFilesI, default_modeI, default_ftpHostI, default_ftpUserI, default_ftpPasswordI);

    // Initialize information displayed on the GUI front panel
    updateMainFrame();

    filePumpGuiFrame.setVisible(true);

}

From source file:com.sec.ose.osi.ui.frm.main.manage.JPanManageMain.java

/**
 * This method initializes this//ww w.  j  a v  a  2 s  . c  om
 * 
 * @return void
 */
private void initialize() {
    GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
    gridBagConstraints11.fill = GridBagConstraints.BOTH;
    gridBagConstraints11.weighty = 1.0;
    gridBagConstraints11.gridx = 0;
    gridBagConstraints11.gridy = 0;
    gridBagConstraints11.insets = new Insets(10, 10, 10, 0);
    gridBagConstraints11.ipadx = 0;
    gridBagConstraints11.ipady = 0;
    gridBagConstraints11.weightx = 1.0;
    GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
    gridBagConstraints1.gridx = 1;
    gridBagConstraints1.insets = new Insets(10, 0, 0, 0);
    gridBagConstraints1.anchor = GridBagConstraints.NORTH;
    gridBagConstraints1.gridy = 0;
    this.setSize(600, 700);
    this.setLayout(new GridBagLayout());
    this.add(getJPanelButton(), gridBagConstraints1);
    this.add(getJSplitPane(), gridBagConstraints11);
}

From source file:net.technicpack.launcher.ui.InstallerFrame.java

private void setupStandardInstall(JPanel panel) {
    panel.setLayout(new GridBagLayout());

    JLabel standardSpiel = new JLabel("<html><body align=\"left\" style='margin-right:10px;'>"
            + resources.getString("launcher.installer.standardspiel") + "</body></html>");
    standardSpiel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    standardSpiel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    standardSpiel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel.add(standardSpiel, new GridBagConstraints(0, 0, 3, 1, 1.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(9, 0, 0, 3), 0, 0));

    panel.add(Box.createGlue(), new GridBagConstraints(0, 1, 3, 1, 1.0, 0.7, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    standardDefaultDirectory = new JCheckBox(resources.getString("launcher.installer.default"));
    standardDefaultDirectory.setOpaque(false);
    standardDefaultDirectory.setHorizontalAlignment(SwingConstants.RIGHT);
    standardDefaultDirectory.setBorder(BorderFactory.createEmptyBorder());
    standardDefaultDirectory.setIconTextGap(0);
    standardDefaultDirectory.setSelectedIcon(resources.getIcon("checkbox_closed.png"));
    standardDefaultDirectory.setIcon(resources.getIcon("checkbox_open.png"));
    standardDefaultDirectory.setFocusPainted(false);
    standardDefaultDirectory.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 16));
    standardDefaultDirectory.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    standardDefaultDirectory.setIconTextGap(6);
    standardDefaultDirectory.setSelected(settings.isPortable() || settings.getTechnicRoot().getAbsolutePath()
            .equals(SettingsFactory.getTechnicHomeDir().getAbsolutePath()));
    standardDefaultDirectory.addActionListener(new ActionListener() {
        @Override//from w w  w .ja  va2 s.c  o m
        public void actionPerformed(ActionEvent e) {
            useDefaultDirectoryChanged();
        }
    });
    panel.add(standardDefaultDirectory, new GridBagConstraints(0, 2, 3, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(0, 24, 12, 0), 0, 0));

    JLabel installFolderLabel = new JLabel(resources.getString("launcher.installer.folder"));
    installFolderLabel.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18));
    installFolderLabel.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    panel.add(installFolderLabel, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(0, 24, 0, 8), 0, 0));

    String installDir = SettingsFactory.getTechnicHomeDir().getAbsolutePath();

    if (!settings.isPortable())
        installDir = settings.getTechnicRoot().getAbsolutePath();

    standardInstallDir = new JTextField(installDir);
    standardInstallDir.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18));
    standardInstallDir.setBackground(LauncherFrame.COLOR_FORMELEMENT_INTERNAL);
    standardInstallDir.setHighlighter(null);
    standardInstallDir.setEditable(false);
    standardInstallDir.setCursor(null);
    panel.add(standardInstallDir, new GridBagConstraints(1, 3, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 0, 5), 0, 0));

    standardSelectButton = new RoundedButton(resources.getString("launcher.installer.select"));
    standardSelectButton.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18));
    standardSelectButton.setContentAreaFilled(false);
    standardSelectButton.setHoverForeground(LauncherFrame.COLOR_BLUE);
    standardSelectButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            selectStandard();
        }
    });
    panel.add(standardSelectButton, new GridBagConstraints(2, 3, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 0, 16), 0, 0));

    useDefaultDirectoryChanged();

    panel.add(Box.createGlue(), new GridBagConstraints(0, 4, 3, 1, 1.0, 1.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    String defaultLocaleText = resources.getString("launcheroptions.language.default");
    if (!resources.isDefaultLocaleSupported()) {
        defaultLocaleText = defaultLocaleText
                .concat(" (" + resources.getString("launcheroptions.language.unavailable") + ")");
    }

    standardLanguages = new JComboBox();
    standardLanguages.addItem(new LanguageItem(ResourceLoader.DEFAULT_LOCALE, defaultLocaleText, resources));
    for (int i = 0; i < ResourceLoader.SUPPORTED_LOCALES.length; i++) {
        standardLanguages
                .addItem(new LanguageItem(resources.getCodeFromLocale(ResourceLoader.SUPPORTED_LOCALES[i]),
                        ResourceLoader.SUPPORTED_LOCALES[i].getDisplayName(ResourceLoader.SUPPORTED_LOCALES[i]),
                        resources.getVariant(ResourceLoader.SUPPORTED_LOCALES[i])));
    }
    if (!settings.getLanguageCode().equalsIgnoreCase(ResourceLoader.DEFAULT_LOCALE)) {
        Locale loc = resources.getLocaleFromCode(settings.getLanguageCode());

        for (int i = 0; i < ResourceLoader.SUPPORTED_LOCALES.length; i++) {
            if (loc.equals(ResourceLoader.SUPPORTED_LOCALES[i])) {
                standardLanguages.setSelectedIndex(i + 1);
                break;
            }
        }
    }
    standardLanguages.setBorder(new RoundBorder(LauncherFrame.COLOR_SCROLL_THUMB, 1, 10));
    standardLanguages.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 14));
    standardLanguages.setUI(new LanguageCellUI(resources));
    standardLanguages.setForeground(LauncherFrame.COLOR_WHITE_TEXT);
    standardLanguages.setBackground(LauncherFrame.COLOR_SELECTOR_BACK);
    standardLanguages.setRenderer(new LanguageCellRenderer(resources, "globe.png",
            LauncherFrame.COLOR_SELECTOR_BACK, LauncherFrame.COLOR_WHITE_TEXT));
    standardLanguages.setEditable(false);
    standardLanguages.setFocusable(false);
    standardLanguages.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            standardLanguageChanged();
        }
    });
    panel.add(standardLanguages, new GridBagConstraints(0, 5, 1, 0, 0, 0, GridBagConstraints.SOUTHWEST,
            GridBagConstraints.NONE, new Insets(0, 8, 8, 0), 0, 0));

    RoundedButton install = new RoundedButton(resources.getString("launcher.installer.install"));
    install.setFont(resources.getFont(ResourceLoader.FONT_OPENSANS, 18));
    install.setContentAreaFilled(false);
    install.setForeground(LauncherFrame.COLOR_BUTTON_BLUE);
    install.setHoverForeground(LauncherFrame.COLOR_BLUE);
    install.setBorder(BorderFactory.createEmptyBorder(8, 56, 8, 56));
    install.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            standardInstall();
        }
    });
    panel.add(install, new GridBagConstraints(1, 5, 2, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.VERTICAL, new Insets(0, 0, 8, 8), 0, 0));

}

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

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

    this.frame = frame;
    hideNonHits = new JRadioButtonMenuItem(Localization.lang("Hide non-hits"),
            !Globals.prefs.getBoolean(JabRefPreferences.GRAY_OUT_NON_HITS));
    grayOut = new JRadioButtonMenuItem(Localization.lang("Gray out non-hits"),
            Globals.prefs.getBoolean(JabRefPreferences.GRAY_OUT_NON_HITS));
    ButtonGroup nonHits = new ButtonGroup();
    nonHits.add(hideNonHits);
    nonHits.add(grayOut);
    floatCb.addChangeListener(
            event -> Globals.prefs.putBoolean(JabRefPreferences.GROUP_FLOAT_SELECTIONS, floatCb.isSelected()));
    andCb.addChangeListener(event -> Globals.prefs.putBoolean(JabRefPreferences.GROUP_INTERSECT_SELECTIONS,
            andCb.isSelected()));
    invCb.addChangeListener(
            event -> Globals.prefs.putBoolean(JabRefPreferences.GROUP_INVERT_SELECTIONS, invCb.isSelected()));
    showOverlappingGroups.addChangeListener(new ChangeListener() {

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

    grayOut.addChangeListener(
            event -> Globals.prefs.putBoolean(JabRefPreferences.GRAY_OUT_NON_HITS, grayOut.isSelected()));

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

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

    showNumberOfElements.addChangeListener(new ChangeListener() {

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

    autoAssignGroup.addChangeListener(event -> Globals.prefs.putBoolean(JabRefPreferences.AUTO_ASSIGN_GROUP,
            autoAssignGroup.isSelected()));

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

    JButton openSettings = new JButton(IconTheme.JabRefIcon.PREFERENCES.getSmallIcon());
    settings.add(andCb);
    settings.add(orCb);
    settings.addSeparator();
    settings.add(invCb);
    settings.addSeparator();
    settings.add(editModeCb);
    settings.addSeparator();
    settings.add(grayOut);
    settings.add(hideNonHits);
    settings.addSeparator();
    settings.add(showOverlappingGroups);
    settings.addSeparator();
    settings.add(showNumberOfElements);
    settings.add(autoAssignGroup);
    openSettings.addActionListener(e -> {
        if (!settings.isVisible()) {
            JButton src = (JButton) e.getSource();
            showNumberOfElements
                    .setSelected(Globals.prefs.getBoolean(JabRefPreferences.GROUP_SHOW_NUMBER_OF_ELEMENTS));
            autoAssignGroup.setSelected(Globals.prefs.getBoolean(JabRefPreferences.AUTO_ASSIGN_GROUP));
            settings.show(src, 0, openSettings.getHeight());
        }
    });

    editModeCb.addActionListener(e -> setEditMode(editModeCb.getState()));

    JButton newButton = new JButton(IconTheme.JabRefIcon.ADD_NOBOX.getSmallIcon());
    int butSize = newButton.getIcon().getIconHeight() + 5;
    Dimension butDim = new Dimension(butSize, butSize);

    newButton.setPreferredSize(butDim);
    newButton.setMinimumSize(butDim);
    JButton helpButton = new HelpAction(Localization.lang("Help on groups"), HelpFile.GROUP).getHelpButton();
    helpButton.setPreferredSize(butDim);
    helpButton.setMinimumSize(butDim);
    JButton autoGroup = new JButton(IconTheme.JabRefIcon.AUTO_GROUP.getSmallIcon());
    autoGroup.setPreferredSize(butDim);
    autoGroup.setMinimumSize(butDim);
    openSettings.setPreferredSize(butDim);
    openSettings.setMinimumSize(butDim);
    Insets butIns = new Insets(0, 0, 0, 0);
    helpButton.setMargin(butIns);
    openSettings.setMargin(butIns);
    newButton.addActionListener(e -> {
        GroupDialog gd = new GroupDialog(frame, panel, null);
        gd.setVisible(true);
        if (gd.okPressed()) {
            AbstractGroup newGroup = gd.getResultingGroup();
            groupsRoot.addNewGroup(newGroup, panel.getUndoManager());
            panel.markBaseChanged();
            frame.output(Localization.lang("Created group \"%0\".", newGroup.getName()));
        }
    });
    andCb.addActionListener(e -> valueChanged(null));
    orCb.addActionListener(e -> valueChanged(null));
    invCb.addActionListener(e -> valueChanged(null));
    showOverlappingGroups.addActionListener(e -> valueChanged(null));
    autoGroup.addActionListener(e -> {
        AutoGroupDialog gd = new AutoGroupDialog(frame, panel, groupsRoot,
                Globals.prefs.get(JabRefPreferences.GROUPS_DEFAULT_FIELD), " .,",
                Globals.prefs.get(JabRefPreferences.KEYWORD_SEPARATOR));
        gd.setVisible(true);
        // gd does the operation itself
    });
    floatCb.addActionListener(e -> valueChanged(null));
    highlCb.addActionListener(e -> valueChanged(null));
    hideNonHits.addActionListener(e -> valueChanged(null));
    grayOut.addActionListener(e -> valueChanged(null));
    newButton.setToolTipText(Localization.lang("New group"));
    andCb.setToolTipText(Localization.lang("Display only entries belonging to all selected groups."));
    orCb.setToolTipText(
            Localization.lang("Display all entries belonging to one or more of the selected groups."));
    autoGroup.setToolTipText(Localization.lang("Automatically create groups for database."));
    openSettings.setToolTipText(Localization.lang("Settings"));
    invCb.setToolTipText(
            "<html>" + Localization.lang("Show entries <b>not</b> in group selection") + "</html>");
    showOverlappingGroups.setToolTipText(Localization
            .lang("Highlight groups that contain entries contained in any currently selected group"));
    floatCb.setToolTipText(Localization.lang("Move entries in group selection to the top"));
    highlCb.setToolTipText(Localization.lang("Gray out entries not in group selection"));
    editModeCb.setToolTipText(Localization.lang("Click group to toggle membership of selected entries"));
    ButtonGroup bgr = new ButtonGroup();
    bgr.add(andCb);
    bgr.add(orCb);
    ButtonGroup visMode = new ButtonGroup();
    visMode.add(floatCb);
    visMode.add(highlCb);

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

    GridBagConstraints con = new GridBagConstraints();
    con.fill = GridBagConstraints.BOTH;
    con.weightx = 1;
    con.gridwidth = 1;
    con.gridy = 0;

    con.gridx = 0;
    gbl.setConstraints(newButton, con);
    rootPanel.add(newButton);

    con.gridx = 1;
    gbl.setConstraints(autoGroup, con);
    rootPanel.add(autoGroup);

    con.gridx = 2;
    gbl.setConstraints(openSettings, con);
    rootPanel.add(openSettings);

    con.gridx = 3;
    con.gridwidth = GridBagConstraints.REMAINDER;
    gbl.setConstraints(helpButton, con);
    rootPanel.add(helpButton);

    groupsTree = new GroupsTree(this);
    groupsTree.addTreeSelectionListener(this);

    JScrollPane groupsTreePane = new JScrollPane(groupsTree, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    groupsTreePane.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
    con.gridwidth = GridBagConstraints.REMAINDER;
    con.weighty = 1;
    con.gridx = 0;
    con.gridwidth = 4;
    con.gridy = 1;
    gbl.setConstraints(groupsTreePane, con);
    rootPanel.add(groupsTreePane);

    add(rootPanel, BorderLayout.CENTER);
    setEditMode(editModeIndicator);
    definePopup();
    NodeAction moveNodeUpAction = new MoveNodeUpAction();
    moveNodeUpAction.putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.CTRL_MASK));
    NodeAction moveNodeDownAction = new MoveNodeDownAction();
    moveNodeDownAction.putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.CTRL_MASK));
    NodeAction moveNodeLeftAction = new MoveNodeLeftAction();
    moveNodeLeftAction.putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.CTRL_MASK));
    NodeAction moveNodeRightAction = new MoveNodeRightAction();
    moveNodeRightAction.putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.CTRL_MASK));

    setGroups(GroupTreeNode.fromGroup(new AllEntriesGroup()));
}

From source file:com.apatar.ui.JPublishToApatarDialog.java

private void createDialog() {

    GridBagLayout gridbag = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    this.setLayout(gridbag);

    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;//from  ww  w . ja v  a2  s.  co m
    c.weighty = 0.0;
    c.fill = GridBagConstraints.HORIZONTAL;
    //c.insets = new Insets(5, 5, 5, 5);

    JPanel panelLogin = new JPanel();
    panelLogin.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelLogin.setLayout(new BoxLayout(panelLogin, BoxLayout.X_AXIS));
    panelLogin.add(new JLabel("User Name"));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(username);
    username.setComponentPopupMenu(new JDefaultContextMenu(username));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(new JLabel("Password"));
    panelLogin.add(Box.createHorizontalStrut(5));
    panelLogin.add(password);

    JPanel panelForgotPassLink = new JPanel();
    panelForgotPassLink.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelForgotPassLink.setLayout(new BoxLayout(panelForgotPassLink, BoxLayout.X_AXIS));
    panelForgotPassLink.add(new JLabel("Lost your password? "));
    panelForgotPassLink.add(Box.createHorizontalStrut(5));
    panelForgotPassLink.add(forgotPassLinkLabel);

    forgotPassLinkLabel.setFont(UiUtils.NORMAL_SIZE_12_FONT);
    forgotPassLinkLabel.addMouseListener(new MouseHyperLinkEvent());
    forgotPassLinkLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
    forgotPassLinkLabel.setText(
            "<html><a href='http://www.apatarforge.org/profile/lostpassword.html'>Click here to retrieve it</a></html>");

    JPanel panelFile = new JPanel();
    panelFile.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelFile.setLayout(new BoxLayout(panelFile, BoxLayout.X_AXIS));
    panelFile.add(selectFromFile);
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(new JLabel("New File "));
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(nameFile);
    panelFile.add(Box.createHorizontalStrut(5));
    panelFile.add(browse);
    nameFile.setEnabled(false);
    nameFile.setComponentPopupMenu(new JDefaultContextMenu(nameFile));
    browse.setEnabled(false);

    JPanel panelLocation = new JPanel();
    panelLocation.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelLocation.setLayout(new BoxLayout(panelLocation, BoxLayout.X_AXIS));
    panelLocation.add(new JLabel("Suggest Location:"));
    panelLocation.add(Box.createHorizontalStrut(5));
    panelLocation.add(location);

    JPanel panelDMName = new JPanel();
    panelDMName.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMName.setLayout(new BoxLayout(panelDMName, BoxLayout.X_AXIS));
    JLabel datamapNameLabel = new JLabel("DataMap Name:");
    datamapNameLabel.setBorder(new EmptyBorder(0, 0, 0, 10));
    panelDMName.add(datamapNameLabel);
    panelDMName.add(Box.createHorizontalStrut(5));
    panelDMName.add(dataMapName);
    dataMapName.setComponentPopupMenu(new JDefaultContextMenu(dataMapName));

    JPanel panelDMDescription = new JPanel();
    panelDMDescription.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMDescription.setLayout(new BoxLayout(panelDMDescription, BoxLayout.X_AXIS));
    panelDMDescription.add(new JLabel("DataMap Description (16000 Chars)"));
    panelDMDescription.add(Box.createHorizontalStrut(5));
    //JScrollPane scroll = new JScrollPane(dataMapDescription);
    //scroll.setSize(300, 50);
    dataMapDescription.setLineWrap(true);
    dataMapDescription.setWrapStyleWord(true);
    panelDMDescription.add(new JScrollPane(dataMapDescription));

    JPanel panelDMShortDescription = new JPanel();
    panelDMShortDescription.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelDMShortDescription.setLayout(new BoxLayout(panelDMShortDescription, BoxLayout.X_AXIS));
    JLabel labelShort = new JLabel("Short Description:");
    labelShort.setBorder(new EmptyBorder(0, 0, 0, 85));
    panelDMShortDescription.add(labelShort);
    panelDMShortDescription.add(Box.createHorizontalStrut(5));
    shortDescription.setLineWrap(true);
    shortDescription.setWrapStyleWord(true);
    panelDMShortDescription.add(new JScrollPane(shortDescription));
    setEnableShortDescription(false);

    // -------------

    JPanel panelTitleForTags = new JPanel();
    panelTitleForTags.setBorder(new EmptyBorder(10, 10, 0, 10));
    panelTitleForTags.setLayout(new BoxLayout(panelTitleForTags, BoxLayout.X_AXIS));
    panelTitleForTags.add(new JLabel("Add tags associated with your DataMap:"));

    // -------------

    JPanel panelListAddedTags = new JPanel();
    panelListAddedTags.setBorder(new EmptyBorder(0, 10, 10, 10));
    panelListAddedTags.setLayout(new BoxLayout(panelListAddedTags, BoxLayout.X_AXIS));

    // --
    JPanel panelFrom = new JPanel();
    panelFrom.setLayout(new BoxLayout(panelFrom, BoxLayout.Y_AXIS));
    JPanel panelMiddle = new JPanel();
    panelMiddle.setLayout(new BoxLayout(panelMiddle, BoxLayout.X_AXIS));
    JPanel panelTo = new JPanel();
    panelTo.setLayout(new BoxLayout(panelTo, BoxLayout.Y_AXIS));

    // --
    JPanel panelAddNewTag = new JPanel();
    panelAddNewTag.setLayout(new BoxLayout(panelAddNewTag, BoxLayout.X_AXIS));
    panelAddNewTag.add(new JLabel("Add new tag:"));
    panelAddNewTag.add(Box.createHorizontalStrut(5));
    textfieldAddNewTag = new JTextField();
    textfieldAddNewTag.setComponentPopupMenu(new JDefaultContextMenu(textfieldAddNewTag));
    panelAddNewTag.add(textfieldAddNewTag);
    panelAddNewTag.add(Box.createHorizontalStrut(5));
    JButton buttonAddTag = new JButton("Add");
    buttonAddTag.addActionListener(addNewTagMouseListener);
    panelAddNewTag.add(buttonAddTag);

    // --
    JPanel panelDeleteTags = new JPanel();
    panelDeleteTags.setLayout(new BoxLayout(panelDeleteTags, BoxLayout.X_AXIS));

    panelDeleteTags.add(new JLabel("Delete selected tag(s):"));
    panelDeleteTags.add(Box.createHorizontalStrut(5));
    JButton buttonDeleteTag = new JButton("Delete");
    buttonDeleteTag.addActionListener(deleteTagMouseListener);
    panelDeleteTags.add(buttonDeleteTag);
    panelDeleteTags.add(new JPanel());

    // --

    JButton moveTag = new JButton(UiUtils.ARROW_ICON);
    moveTag.addActionListener(addTagsMouseListener);
    panelMiddle.add(moveTag);

    tblModelFrom = new DefaultTableModel();
    tblModelTo = new DefaultTableModel();
    tblModelFrom.addColumn("Tag Name");
    tblModelTo.addColumn("Tag Name");

    tagsTableFrom = new JTable(tblModelFrom);
    tagsTableTo = new JTable(tblModelTo);

    tagsTableFrom.setOpaque(false);
    tagsTableFrom.setBackground(null);
    tagsTableFrom.setBorder(null);
    tagsTableFrom.setShowGrid(false);

    tagsTableTo.setOpaque(false);
    tagsTableTo.setBackground(null);
    tagsTableTo.setBorder(null);
    tagsTableTo.setShowGrid(false);

    tagsTableFrom.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField()));
    tagsTableTo.getColumn("Tag Name").setCellEditor(new CellEditor(new JTextField()));

    fillTableTags();

    tagsTableFrom.setComponentPopupMenu(new JDefaultContextMenu(tagsTableFrom));
    tagsTableTo.setComponentPopupMenu(new JDefaultContextMenu(tagsTableTo));

    JScrollPane srollPane = new JScrollPane(tagsTableFrom);
    srollPane.setBorder(null);

    JScrollPane srollPane2 = new JScrollPane(tagsTableTo);
    srollPane.setBorder(null);

    panelFrom.add(srollPane);
    panelFrom.add(Box.createVerticalStrut(5));
    panelFrom.add(panelAddNewTag);

    panelTo.add(srollPane2);
    panelTo.add(Box.createVerticalStrut(5));
    panelTo.add(panelDeleteTags);

    panelListAddedTags.add(panelFrom);
    panelListAddedTags.add(Box.createHorizontalStrut(5));
    panelListAddedTags.add(panelMiddle);
    panelListAddedTags.add(Box.createHorizontalStrut(5));
    panelListAddedTags.add(panelTo);

    // -------

    JPanel panelButton = new JPanel();
    panelButton.setLayout(new BoxLayout(panelButton, BoxLayout.X_AXIS));
    panelButton.add(Box.createHorizontalGlue());
    panelButton.add(bOk);
    panelButton.add(Box.createHorizontalStrut(5));
    panelButton.add(bCancel);
    panelButton.add(Box.createHorizontalStrut(5));

    ComponentBuilder.makeComponent(new JCommentPanel(), gridbag, c, getContentPane());

    ComponentBuilder.makeComponent(panelLogin, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelForgotPassLink, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelFile, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelLocation, gridbag, c, getContentPane());
    ComponentBuilder.makeComponent(panelDMName, gridbag, c, getContentPane());

    c.fill = GridBagConstraints.BOTH;

    c.weighty = 2.0;
    ComponentBuilder.makeComponent(panelDMDescription, gridbag, c, getContentPane());

    c.weighty = 0.0;
    ComponentBuilder.makeComponent(autoGenerateShortDescription, gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelDMShortDescription, gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelTitleForTags, gridbag, c, getContentPane());

    c.weighty = 3.0;
    ComponentBuilder.makeComponent(panelListAddedTags, gridbag, c, getContentPane());

    c.weighty = 0.0;
    ComponentBuilder.makeComponent(new JSeparator(), gridbag, c, getContentPane());

    c.weighty = 1.0;
    ComponentBuilder.makeComponent(panelButton, gridbag, c, getContentPane());
}

From source file:org.multibit.viewsystem.swing.view.panels.ShowPreferencesPanel.java

private void initUI() {
    setMinimumSize(new Dimension(550, 160));
    setLayout(new BorderLayout());
    setOpaque(true);//from   ww  w  .  j  a v  a 2  s. co  m
    setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR);

    JPanel mainPanel = new JPanel();
    mainPanel.setOpaque(false);

    String[] keys = new String[] { "fontChooser.fontName", "fontChooser.fontStyle", "fontChooser.fontSize",
            "showPreferencesPanel.ticker.exchange", "showPreferencesPanel.ticker.currency",
            "showPreferencesPanel.lookAndFeel", "showPreferencesPanel.oerLabel.text" };
    int stentWidth = MultiBitTitledPanel.calculateStentWidthForKeys(controller.getLocaliser(), keys, this)
            + STENT_DELTA;

    GridBagConstraints constraints = new GridBagConstraints();
    mainPanel.setLayout(new GridBagLayout());

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    // Disable language selection, uncomment to enable
    //        mainPanel.add(createLanguagePanel(stentWidth), constraints);

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 2;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(createAppearancePanel(stentWidth), constraints);

    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 3;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(createMessagingServerPanel(stentWidth), constraints);

    /*
         constraints.fill = GridBagConstraints.HORIZONTAL;
         constraints.gridx = 0;
         constraints.gridy = 3;
         constraints.gridwidth = 2;
         constraints.weightx = 1;
         constraints.weighty = 1.6;
         constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
         mainPanel.add(createTickerPanel(stentWidth), constraints);
    */
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 4;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 1.6;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(createBrowserIntegrationPanel(stentWidth), constraints);

    JLabel filler1 = new JLabel();
    filler1.setOpaque(false);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.gridx = 0;
    constraints.gridy = 5;
    constraints.gridwidth = 2;
    constraints.weightx = 1;
    constraints.weighty = 100;
    constraints.anchor = GridBagConstraints.ABOVE_BASELINE_LEADING;
    mainPanel.add(filler1, constraints);

    JScrollPane mainScrollPane = new JScrollPane(mainPanel, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
            JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    mainScrollPane.setBorder(BorderFactory.createEmptyBorder());
    mainScrollPane.getViewport().setBackground(ColorAndFontConstants.VERY_LIGHT_BACKGROUND_COLOR);
    mainScrollPane.getViewport().setOpaque(true);
    mainScrollPane.getHorizontalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT);
    mainScrollPane.getVerticalScrollBar().setUnitIncrement(CoreModel.SCROLL_INCREMENT);

    add(mainScrollPane, BorderLayout.CENTER);

    JPanel buttonPanel = createButtonPanel();
    buttonPanel.setMinimumSize(new Dimension(60, 60));
    add(buttonPanel, BorderLayout.SOUTH);
}