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:gdt.jgui.entity.webset.JWeblinkEditor.java

/**
 * The default constructor./*from  w  w w.  j ava 2s  .co m*/
 */
public JWeblinkEditor() {
    GridBagLayout gridBagLayout = new GridBagLayout();
    gridBagLayout.rowHeights = new int[] { 0, 0, 0, 0, 0 };
    gridBagLayout.columnWeights = new double[] { 0.0, 1.0 };
    gridBagLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0 };
    setLayout(gridBagLayout);

    String icon$ = Support.readHandlerIcon(null, JEntitiesPanel.class, "globe.png");
    byte[] ba = Base64.decodeBase64(icon$);
    ImageIcon icon = new ImageIcon(ba);
    Image image = icon.getImage().getScaledInstance(24, 24, 0);
    icon.setImage(image);
    JLabel iconLabel = new JLabel("Icon");
    c = new GridBagConstraints();
    c.insets = new Insets(5, 5, 5, 5);
    c.anchor = GridBagConstraints.FIRST_LINE_START;
    c.weighty = 0;
    c.gridx = 0;
    c.gridy = 0;
    add(iconLabel, c);
    iconLabel.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            showIconMenu(e);
        }
    });
    iconIcon = new JLabel();
    iconIcon.setIcon(icon);
    c_0 = new GridBagConstraints();
    c_0.anchor = GridBagConstraints.WEST;
    c_0.insets = new Insets(0, 5, 5, 0);
    c.anchor = GridBagConstraints.WEST;
    c_0.gridx = 1;
    c_0.gridy = 0;
    add(iconIcon, c_0);
    iconIcon.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            showIconMenu(e);
        }
    });
    JLabel lblName = new JLabel("Name");
    c_1 = new GridBagConstraints();
    c_1.insets = new Insets(5, 5, 5, 5);
    c_1.fill = GridBagConstraints.HORIZONTAL;
    c_1.gridx = 0;
    c_1.gridy = 1;
    add(lblName, c_1);

    nameField = new JTextField();
    c_2 = new GridBagConstraints();
    c_2.insets = new Insets(0, 5, 5, 0);
    c_2.fill = GridBagConstraints.HORIZONTAL;
    c_2.gridx = 1;
    c_2.gridy = 1;
    add(nameField, c_2);

    JLabel lblUrl = new JLabel("Address");
    c_3 = new GridBagConstraints();
    c_3.insets = new Insets(5, 5, 5, 5);
    c_3.fill = GridBagConstraints.HORIZONTAL;
    c_3.gridx = 0;
    c_3.gridy = 2;
    add(lblUrl, c_3);

    addressField = new JTextField();
    c_4 = new GridBagConstraints();
    c_4.insets = new Insets(0, 5, 5, 0);
    c_4.fill = GridBagConstraints.HORIZONTAL;
    c_4.gridx = 1;
    c_4.gridy = 2;
    add(addressField, c_4);

    JLabel lblLogin = new JLabel("Login");
    c_5 = new GridBagConstraints();
    c_5.insets = new Insets(5, 5, 5, 5);
    c_5.fill = GridBagConstraints.HORIZONTAL;
    c_5.gridx = 0;
    c_5.gridy = 3;
    add(lblLogin, c_5);
    lblLogin.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            showLoginMenu(e);
        }
    });
    loginField = new JTextField();
    c_6 = new GridBagConstraints();
    c_6.insets = new Insets(0, 5, 5, 0);
    c_6.fill = GridBagConstraints.HORIZONTAL;
    c_6.gridx = 1;
    c_6.gridy = 3;
    add(loginField, c_6);

    JLabel lblPassword = new JLabel("Password");
    c_7 = new GridBagConstraints();
    c_7.insets = new Insets(5, 5, 5, 5);
    c_7.fill = GridBagConstraints.HORIZONTAL;
    c_7.gridx = 0;
    c_7.gridy = 4;
    add(lblPassword, c_7);
    lblPassword.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseClicked(MouseEvent e) {
            showPasswordMenu(e);
        }
    });

    passwordField = new JTextField();
    c_8 = new GridBagConstraints();
    c_8.insets = new Insets(0, 5, 5, 0);
    c_8.fill = GridBagConstraints.HORIZONTAL;
    c_8.gridx = 1;
    c_8.gridy = 4;
    add(passwordField, c_8);

    JPanel bottom = new JPanel();
    c_9 = new GridBagConstraints();
    c_9.weighty = 1;
    c_9.fill = GridBagConstraints.VERTICAL;
    c_9.gridx = 0;
    c_9.gridy = 5;
    add(bottom, c_9);
}

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

/**
 * This method initializes this//from w  ww  .jav a2s .  c o  m
 * 
 * @return void
 */
private void initialize() {
    GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
    gridBagConstraints12.gridx = 0;
    gridBagConstraints12.anchor = GridBagConstraints.WEST;
    gridBagConstraints12.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints12.gridwidth = 2;
    gridBagConstraints12.weightx = 0.0;
    gridBagConstraints12.gridy = 1;
    GridBagConstraints gridBagConstraints23 = new GridBagConstraints();
    gridBagConstraints23.fill = GridBagConstraints.BOTH;
    gridBagConstraints23.weighty = 1.0;
    gridBagConstraints23.gridwidth = 1;
    gridBagConstraints23.weightx = 1.0;
    jLabelComponentForOpt1 = new JLabel();
    jLabelComponentForOpt1.setText("(Option) Component :");
    jLabelComponentForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12));
    jLabelLicenseForOpt1 = new JLabel();
    jLabelLicenseForOpt1.setText("License :");
    jLabelLicenseForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12));
    jLabelRepresentativeLicenseForOpt2 = new JLabel();
    jLabelRepresentativeLicenseForOpt2.setText("Representative License :");
    jLabelRepresentativeLicenseForOpt2.setFont(new Font("Dialog", Font.PLAIN, 12));
    jLabelNoticeForOpt1 = new JLabel();
    jLabelNoticeForOpt1.setText(
            "Note) If you don't choose a component, it will be identified by \"DECLARED_STRING_MATCH_LICENSE_\" + \"License Name\".");
    jLabelNoticeForOpt1.setFont(new Font("Dialog", Font.PLAIN, 12));
    this.setSize(570, 480);
    this.setLayout(new GridBagLayout());
    this.setBorder(BorderFactory.createTitledBorder(null, "Identification Information",
            TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
            new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));

    // matched code view & license match info table
    this.add(getJSplitPaneCodeAndTable(), gridBagConstraints23);

    // option
    this.add(getJScrollPanelOptions(), gridBagConstraints12);
}

From source file:com.googlecode.vfsjfilechooser2.accessories.connection.ConnectionDialog.java

private void makeGridPanel(Component[] components) {
    final Insets insets = new Insets(5, 5, 5, 5);
    final GridBagConstraints gbc = new GridBagConstraints();

    gbc.weightx = 1.0;/*from  w  ww .ja v a  2s. co m*/
    gbc.weighty = 1.0;
    gbc.insets = insets;
    gbc.ipadx = 0;
    gbc.ipady = 0;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.fill = GridBagConstraints.HORIZONTAL;

    int i = 0;
    int j = 0;

    for (Component component : components) {
        gbc.gridx = i;
        gbc.gridy = j;
        gbc.gridwidth = 1;
        gbc.gridheight = 1;

        centerPanel.add(component, gbc);

        i++;

        // 2 components per row
        if ((i % 2) == 0) {
            j++;
            i = 0;
        }
    }
}

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

public SignedGetUrlDialog(Frame ownerFrame, HyperlinkActivatedListener hyperlinkListener, S3Service s3Service,
        S3Object[] objects) {/* w  w  w.j  a v  a  2  s.c o  m*/
    super(ownerFrame, "Generate Signed GET URLs", true);
    this.ownerFrame = ownerFrame;
    this.hyperlinkListener = hyperlinkListener;
    this.s3Service = s3Service;
    this.objects = objects;

    String introductionText = "<html><center>Generate signed GET URLs that you can provide to anyone<br>"
            + "who needs to access objects in your bucket for a limited time.</center></html>";
    JHtmlLabel introductionLabel = new JHtmlLabel(introductionText, hyperlinkListener);
    introductionLabel.setHorizontalAlignment(JLabel.CENTER);
    JHtmlLabel expiryTimeLabel = new JHtmlLabel("<html><b>Expiry Time</b> (Hours)</html>", hyperlinkListener);
    expiryTimeLabel.setHorizontalAlignment(JLabel.RIGHT);
    JHtmlLabel httpsUrlsLabel = new JHtmlLabel("<html><b>Secure HTTPS URLs?</b></html>", hyperlinkListener);
    httpsUrlsLabel.setHorizontalAlignment(JLabel.RIGHT);
    JHtmlLabel virtualHostLabel = new JHtmlLabel("<html><b>Bucket is a Virtual Host?</b></html>",
            hyperlinkListener);
    virtualHostLabel.setHorizontalAlignment(JLabel.RIGHT);
    JHtmlLabel requesterPaysLabel = new JHtmlLabel("<html><b>Bucket is Requester Pays?</b></html>",
            hyperlinkListener);
    requesterPaysLabel.setHorizontalAlignment(JLabel.RIGHT);

    expiryTimeTextField = new JTextField("1.0");
    expiryTimeTextField.setToolTipText("How long in hours until the URL will expire");
    expiryTimeTextField.getDocument().addDocumentListener(this);

    httpsUrlsCheckBox = new JCheckBox();
    httpsUrlsCheckBox.setSelected(false);
    httpsUrlsCheckBox.setToolTipText("Check this box to generate secure HTTPS URLs.");
    httpsUrlsCheckBox.addActionListener(this);

    virtualHostCheckBox = new JCheckBox();
    virtualHostCheckBox.setSelected(false);
    virtualHostCheckBox.setToolTipText("Check this box if your bucket is configured as a virtual host.");
    virtualHostCheckBox.addActionListener(this);

    requesterPaysCheckBox = new JCheckBox();
    requesterPaysCheckBox.setSelected(false);
    requesterPaysCheckBox.setToolTipText("Check this box if the bucket has Requester Pays enabled.");
    requesterPaysCheckBox.addActionListener(this);

    finishedButton = new JButton("Finished");
    finishedButton.setActionCommand("Finished");
    finishedButton.addActionListener(this);

    signedUrlsTextArea = new JTextArea();
    signedUrlsTextArea.setEditable(false);

    // Set default ENTER and ESCAPE buttons.
    this.getRootPane().setDefaultButton(finishedButton);
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),
            "ESCAPE");
    this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() {
        private static final long serialVersionUID = -6225706489569112809L;

        public void actionPerformed(ActionEvent actionEvent) {
            setVisible(false);
        }
    });

    JPanel panel = new JPanel(new GridBagLayout());
    int row = 0;
    panel.add(introductionLabel, new GridBagConstraints(0, row, 6, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(expiryTimeLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(expiryTimeTextField, new GridBagConstraints(1, row, 5, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(httpsUrlsLabel, new GridBagConstraints(0, ++row, 1, 1, 0.3, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(httpsUrlsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    panel.add(virtualHostLabel, new GridBagConstraints(2, row, 1, 1, 0.3, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(virtualHostCheckBox, new GridBagConstraints(3, row, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    panel.add(requesterPaysLabel, new GridBagConstraints(4, row, 1, 1, 0.3, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    panel.add(requesterPaysCheckBox, new GridBagConstraints(5, row, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    panel.add(new JScrollPane(signedUrlsTextArea), new GridBagConstraints(0, ++row, 6, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0));
    panel.add(finishedButton, new GridBagConstraints(0, ++row, 6, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    this.getContentPane().setLayout(new GridBagLayout());
    this.getContentPane().add(panel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    this.setSize(700, 450);
    this.setResizable(true);
    this.setLocationRelativeTo(ownerFrame);

    generateSignedUrls();
}

From source file:org.openmicroscopy.shoola.agents.metadata.editor.TextualAnnotationsUI.java

/** Builds and lays out the UI. */
private void buildGUI() {
    removeAll();//from  www  .  ja v  a  2 s.co  m

    if (!model.isAnnotationLoaded())
        return;

    pane = new JScrollPane(commentArea);
    pane.setBorder(null);

    setLayout(new GridBagLayout());

    constraints = new GridBagConstraints();
    constraints.insets = new Insets(2, 0, 2, 0);
    constraints.fill = GridBagConstraints.BOTH;
    constraints.anchor = GridBagConstraints.NORTHWEST;
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.weightx = 1;
    constraints.weighty = 1;
    add(pane, constraints);
    constraints.gridy++;

    constraints.weightx = 0;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.NONE;
    constraints.anchor = GridBagConstraints.WEST;
    add(addButton, constraints);
    constraints.gridy++;

    constraints.weightx = 1;
    constraints.weighty = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.anchor = GridBagConstraints.NORTHWEST;
}

From source file:org.openconcerto.erp.core.sales.shipment.component.BonDeLivraisonSQLComponent.java

public void addViews() {
    this.textTotalHT.setOpaque(false);
    this.textTotalTVA.setOpaque(false);
    this.textTotalTTC.setOpaque(false);

    this.selectCommande = new ElementComboBox();

    this.setLayout(new GridBagLayout());

    final GridBagConstraints c = new DefaultGridBagConstraints();

    // Champ Module
    c.gridx = 0;//from  www .  j  a va2  s. c om
    c.gridy++;
    c.gridwidth = GridBagConstraints.REMAINDER;
    final JPanel addP = ComptaSQLConfElement.createAdditionalPanel();
    this.setAdditionalFieldsPanel(new FormLayouter(addP, 2));
    this.add(addP, c);

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

    // Numero
    JLabel labelNum = new JLabel(getLabelFor("NUMERO"));
    labelNum.setHorizontalAlignment(SwingConstants.RIGHT);
    this.add(labelNum, c);

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

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

    JDate date = new JDate(true);
    c.gridx++;
    c.weightx = 0;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;
    this.add(date, c);

    // Reference
    c.gridy++;
    c.gridx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(new JLabel(getLabelFor("NOM"), SwingConstants.RIGHT), c);
    c.gridx++;
    c.weightx = 1;
    this.add(this.textNom, c);
    if (getTable().contains("DATE_LIVRAISON")) {
        // Date livraison
        c.gridx++;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 0;
        this.add(new JLabel(getLabelFor("DATE_LIVRAISON"), SwingConstants.RIGHT), c);

        JDate dateLivraison = new JDate(true);
        c.gridx++;
        c.weightx = 0;
        c.weighty = 0;
        c.fill = GridBagConstraints.NONE;
        this.add(dateLivraison, c);
        this.addView(dateLivraison, "DATE_LIVRAISON");
    }
    // Client
    JLabel labelClient = new JLabel(getLabelFor("ID_CLIENT"), SwingConstants.RIGHT);
    c.gridx = 0;
    c.gridy++;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weighty = 0;
    this.add(labelClient, c);

    c.gridx++;
    c.weightx = 0;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;
    this.comboClient = new ElementComboBox();
    this.add(this.comboClient, c);
    if (getTable().contains("SPEC_LIVRAISON")) {
        // Date livraison
        c.gridx++;
        c.fill = GridBagConstraints.HORIZONTAL;
        c.weightx = 0;
        this.add(new JLabel(getLabelFor("SPEC_LIVRAISON"), SwingConstants.RIGHT), c);

        JTextField specLivraison = new JTextField();
        c.gridx++;
        c.weightx = 0;
        c.weighty = 0;
        this.add(specLivraison, c);
        this.addView(specLivraison, "SPEC_LIVRAISON");
    }

    final ElementComboBox boxTarif = new ElementComboBox();
    this.comboClient.addValueListener(new PropertyChangeListener() {
        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            if (comboClient.getElement().getTable().contains("ID_TARIF")) {
                if (BonDeLivraisonSQLComponent.this.isFilling())
                    return;
                final SQLRow row = ((SQLRequestComboBox) evt.getSource()).getSelectedRow();
                if (row != null) {
                    // 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;
                    //
                    // }
                    // tableBonItem.setTarif(foreignRow, true);
                    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());
                    }
                }
            }
        }
    });

    // Bouton tout livrer
    JButton boutonAll = new JButton("Tout livrer");

    boutonAll.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            RowValuesTableModel m = BonDeLivraisonSQLComponent.this.tableBonItem.getModel();

            // on livre tout les lments
            for (int i = 0; i < m.getRowCount(); i++) {
                SQLRowValues rowVals = m.getRowValuesAt(i);
                Object o = rowVals.getObject("QTE");
                int qte = o == null ? 0 : ((Number) o).intValue();
                m.putValue(qte, i, "QTE_LIVREE");
            }
        }
    });

    // 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 = 1;

        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());
                tableBonItem.setTarif(selectedRow, !isFilling());
            }
        });
    }

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

        JTextField specLivraison = new JTextField();
        c.gridx++;
        c.weightx = 0;
        c.weighty = 0;
        this.add(specLivraison, c);
        this.addView(specLivraison, "A_ATTENTION");
    }

    // Element du bon
    List<JButton> l = new ArrayList<JButton>();
    l.add(boutonAll);
    this.tableBonItem = new BonDeLivraisonItemTable(l);

    c.gridx = 0;
    c.gridy++;
    c.weightx = 1;
    c.weighty = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.BOTH;
    this.add(this.tableBonItem, c);
    c.anchor = GridBagConstraints.EAST;
    // Totaux
    reconfigure(this.textTotalHT);
    reconfigure(this.textTotalTVA);
    reconfigure(this.textTotalTTC);

    // Poids Total
    c.gridy++;
    c.gridx = 1;
    c.weightx = 0;
    c.weighty = 0;
    c.anchor = GridBagConstraints.EAST;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    this.addSQLObject(this.textPoidsTotal, "TOTAL_POIDS");
    this.addRequiredSQLObject(this.textTotalHT, "TOTAL_HT");
    this.addRequiredSQLObject(this.textTotalTVA, "TOTAL_TVA");
    this.addRequiredSQLObject(this.textTotalTTC, "TOTAL_TTC");
    TotalPanel panelTotal = new TotalPanel(tableBonItem, textTotalHT, textTotalTVA, textTotalTTC,
            new DeviseField(), new DeviseField(), new DeviseField(), new DeviseField(), new DeviseField(),
            textPoidsTotal, null);
    c.gridx = 2;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 0;
    c.weighty = 0;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.HORIZONTAL;
    this.add(panelTotal, c);

    c.anchor = GridBagConstraints.WEST;

    /*******************************************************************************************
     * * INFORMATIONS COMPLEMENTAIRES
     ******************************************************************************************/
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;
    c.gridy++;
    TitledSeparator sep = new TitledSeparator("Informations complmentaires");
    c.insets = new Insets(10, 2, 1, 2);
    this.add(sep, c);
    c.insets = new Insets(2, 2, 1, 2);

    ITextArea textInfos = new ITextArea(4, 4);

    c.gridx = 0;
    c.gridy++;
    c.gridheight = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1;
    c.weighty = 0;
    c.fill = GridBagConstraints.BOTH;

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

    c.gridx = 0;
    c.gridy++;
    c.gridheight = 1;
    c.gridwidth = 4;
    c.weightx = 0;
    c.weighty = 0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.EAST;

    this.panelOO = new PanelOOSQLComponent(this);
    this.add(this.panelOO, c);

    this.addRequiredSQLObject(date, "DATE");
    this.addSQLObject(textInfos, "INFOS");
    this.addSQLObject(this.textNom, "NOM");
    this.addSQLObject(this.selectCommande, "ID_COMMANDE_CLIENT");
    this.addRequiredSQLObject(this.textNumeroUnique, "NUMERO");

    this.addRequiredSQLObject(this.comboClient, "ID_CLIENT");

    // Doit etre lock a la fin
    DefaultGridBagConstraints.lockMinimumSize(comboClient);

}

From source file:net.sf.profiler4j.console.ClassListPanel.java

/**
 * This method initializes bottomPanel//from w  w  w .  j  av a2  s .  c om
 * 
 * @return javax.swing.JPanel
 */
private JPanel getBottomPanel() {
    if (bottomPanel == null) {
        GridBagConstraints gridBagConstraints12 = new GridBagConstraints();
        gridBagConstraints12.gridx = 2;
        gridBagConstraints12.insets = new java.awt.Insets(4, 4, 4, 4);
        gridBagConstraints12.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints12.gridy = 0;
        GridBagConstraints gridBagConstraints11 = new GridBagConstraints();
        gridBagConstraints11.gridx = 5;
        gridBagConstraints11.insets = new java.awt.Insets(8, 4, 8, 8);
        gridBagConstraints11.gridy = 0;
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.insets = new java.awt.Insets(8, 4, 8, 4);
        gridBagConstraints3.gridy = 0;
        gridBagConstraints3.gridx = 4;
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.insets = new java.awt.Insets(8, 4, 8, 4);
        gridBagConstraints2.gridy = 0;
        gridBagConstraints2.gridx = 3;
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.fill = java.awt.GridBagConstraints.HORIZONTAL;
        gridBagConstraints1.gridx = 1;
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.weightx = 1.0;
        gridBagConstraints1.insets = new java.awt.Insets(4, 4, 4, 4);
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.insets = new java.awt.Insets(4, 8, 4, 4);
        gridBagConstraints.gridy = 0;
        gridBagConstraints.anchor = java.awt.GridBagConstraints.EAST;
        gridBagConstraints.gridx = 0;
        jLabel = new JLabel();
        jLabel.setText("Filter: ");
        bottomPanel = new JPanel();
        bottomPanel.setLayout(new GridBagLayout());
        bottomPanel.add(jLabel, gridBagConstraints);
        bottomPanel.add(getFilterTextField(), gridBagConstraints1);
        bottomPanel.add(getClearButton(), gridBagConstraints2);
        bottomPanel.add(getRefreshButton(), gridBagConstraints3);
        bottomPanel.add(getAddAsRuleButton(), gridBagConstraints11);
        bottomPanel.add(getOnlyInstrumentedCheckBox(), gridBagConstraints12);
    }
    return bottomPanel;
}

From source file:au.org.ala.delta.intkey.ui.FindInCharactersDialog.java

public FindInCharactersDialog(Intkey intkeyApp, IntkeyContext context) {
    super(intkeyApp.getMainFrame(), false);
    setResizable(false);//from  ww w  .j a  va2s. c o  m

    ResourceMap resourceMap = Application.getInstance().getContext()
            .getResourceMap(FindInCharactersDialog.class);
    resourceMap.injectFields(this);
    ActionMap actionMap = Application.getInstance().getContext().getActionMap(this);

    _intkeyApp = intkeyApp;

    _numMatchedCharacters = 0;
    _currentMatchedCharacter = -1;

    _findAction = actionMap.get("findCharacters");
    _nextAction = actionMap.get("nextCharacter");

    this.setTitle(windowTitle);

    _pnlMain = new JPanel();
    _pnlMain.setBorder(new EmptyBorder(20, 20, 20, 20));
    getContentPane().add(_pnlMain, BorderLayout.CENTER);
    _pnlMain.setLayout(new BorderLayout(0, 0));

    _pnlMainTop = new JPanel();
    _pnlMain.add(_pnlMainTop, BorderLayout.NORTH);
    _pnlMainTop.setLayout(new BoxLayout(_pnlMainTop, BoxLayout.Y_AXIS));

    _lblEnterSearchString = new JLabel(enterSearchStringCaption);
    _lblEnterSearchString.setBorder(new EmptyBorder(0, 0, 5, 0));
    _pnlMainTop.add(_lblEnterSearchString);

    _textField = new JTextField();
    _pnlMainTop.add(_textField);
    _textField.setColumns(10);
    _textField.getDocument().addDocumentListener(new DocumentListener() {

        @Override
        public void removeUpdate(DocumentEvent e) {
            reset();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            reset();
        }

        @Override
        public void changedUpdate(DocumentEvent e) {
            reset();
        }
    });

    _pnlMainBottom = new JPanel();
    _pnlMainBottom.setBorder(new EmptyBorder(20, 0, 0, 0));
    _pnlMain.add(_pnlMainBottom, BorderLayout.CENTER);
    _pnlMainBottom.setLayout(new BoxLayout(_pnlMainBottom, BoxLayout.Y_AXIS));

    _chckbxSearchStates = new JCheckBox(searchStatesCaption);
    _chckbxSearchStates.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            reset();
        }
    });

    _pnlMainBottom.add(_chckbxSearchStates);

    _chckbxSearchUsedCharacters = new JCheckBox(searchUsedCharactersCaption);
    _chckbxSearchUsedCharacters.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            reset();
        }
    });
    _pnlMainBottom.add(_chckbxSearchUsedCharacters);

    _pnlButtons = new JPanel();
    _pnlButtons.setBorder(new EmptyBorder(20, 0, 0, 10));
    getContentPane().add(_pnlButtons, BorderLayout.EAST);
    _pnlButtons.setLayout(new BorderLayout(0, 0));

    _pnlInnerButtons = new JPanel();
    _pnlButtons.add(_pnlInnerButtons, BorderLayout.NORTH);
    GridBagLayout gbl__pnlInnerButtons = new GridBagLayout();
    gbl__pnlInnerButtons.columnWidths = new int[] { 0, 0 };
    gbl__pnlInnerButtons.rowHeights = new int[] { 0, 0, 0, 0 };
    gbl__pnlInnerButtons.columnWeights = new double[] { 0.0, Double.MIN_VALUE };
    gbl__pnlInnerButtons.rowWeights = new double[] { 0.0, 0.0, 0.0, Double.MIN_VALUE };
    _pnlInnerButtons.setLayout(gbl__pnlInnerButtons);

    _btnFindNext = new JButton();
    _btnFindNext.setAction(_findAction);

    GridBagConstraints gbc__btnFindNext = new GridBagConstraints();
    gbc__btnFindNext.fill = GridBagConstraints.HORIZONTAL;
    gbc__btnFindNext.insets = new Insets(0, 0, 5, 0);
    gbc__btnFindNext.gridx = 0;
    gbc__btnFindNext.gridy = 0;
    _pnlInnerButtons.add(_btnFindNext, gbc__btnFindNext);

    _btnPrevious = new JButton();
    _btnPrevious.setAction(actionMap.get("previousCharacter"));
    _btnPrevious.setEnabled(false);

    GridBagConstraints gbc__btnPrevious = new GridBagConstraints();
    gbc__btnPrevious.insets = new Insets(0, 0, 5, 0);
    gbc__btnPrevious.gridx = 0;
    gbc__btnPrevious.gridy = 1;
    _pnlInnerButtons.add(_btnPrevious, gbc__btnPrevious);

    _btnDone = new JButton();
    _btnDone.setAction(actionMap.get("findCharactersDone"));

    GridBagConstraints gbc__btnDone = new GridBagConstraints();
    gbc__btnDone.fill = GridBagConstraints.HORIZONTAL;
    gbc__btnDone.gridx = 0;
    gbc__btnDone.gridy = 2;
    _pnlInnerButtons.add(_btnDone, gbc__btnDone);

    this.pack();
    this.setLocationRelativeTo(_intkeyApp.getMainFrame());
}

From source file:IconDemoApplet.java

public void init() {
    //Parse the applet parameters
    pictures = parseParameters();/*  w  w w .jav  a2 s.c o m*/

    //If the applet tag doesn't provide an "IMAGE0" parameter,
    //display an error message.
    if (pictures.size() == 0) {
        captionLabel = new JLabel("No images listed in applet tag.");
        captionLabel.setHorizontalAlignment(JLabel.CENTER);
        getContentPane().add(captionLabel);
        return;
    }

    //NOW CREATE THE GUI COMPONENTS

    //A label to identify XX of XX.
    numberLabel = new JLabel("Picture " + (current + 1) + " of " + pictures.size());
    numberLabel.setHorizontalAlignment(JLabel.LEFT);
    numberLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 5));

    //A label for the caption.
    final Photo first = (Photo) pictures.firstElement();
    captionLabel = new JLabel(first.caption);
    captionLabel.setHorizontalAlignment(JLabel.CENTER);
    captionLabel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));

    //A label for displaying the photographs.
    photographLabel = new JLabel("Loading first image...");
    photographLabel.setHorizontalAlignment(JLabel.CENTER);
    photographLabel.setVerticalAlignment(JLabel.CENTER);
    photographLabel.setVerticalTextPosition(JLabel.CENTER);
    photographLabel.setHorizontalTextPosition(JLabel.CENTER);
    photographLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(),
            BorderFactory.createEmptyBorder(5, 5, 5, 5)));
    photographLabel.setBorder(BorderFactory.createCompoundBorder(BorderFactory.createEmptyBorder(0, 0, 10, 0),
            photographLabel.getBorder()));

    //Set the preferred size for the picture,
    //with room for the borders.
    Insets i = photographLabel.getInsets();
    photographLabel.setPreferredSize(
            new Dimension(widthOfWidest + i.left + i.right, heightOfTallest + i.bottom + i.top));

    //Create the next and previous buttons.
    ImageIcon nextIcon = new ImageIcon(getURL(imagedir + "right.gif"));
    ImageIcon dimmedNextIcon = new ImageIcon(getURL(imagedir + "dimmedRight.gif"));
    ImageIcon previousIcon = new ImageIcon(getURL(imagedir + "left.gif"));
    ImageIcon dimmedPreviousIcon = new ImageIcon(getURL(imagedir + "dimmedLeft.gif"));

    previousButton = new JButton("Previous Picture", previousIcon);
    previousButton.setDisabledIcon(dimmedPreviousIcon);
    previousButton.setVerticalTextPosition(AbstractButton.CENTER);
    previousButton.setHorizontalTextPosition(AbstractButton.RIGHT);
    previousButton.setMnemonic(KeyEvent.VK_P);
    previousButton.setActionCommand("previous");
    previousButton.addActionListener(this);
    previousButton.setEnabled(false);

    nextButton = new JButton("Next Picture", nextIcon);
    nextButton.setDisabledIcon(dimmedNextIcon);
    nextButton.setVerticalTextPosition(AbstractButton.CENTER);
    nextButton.setHorizontalTextPosition(AbstractButton.LEFT);
    nextButton.setMnemonic(KeyEvent.VK_N);
    nextButton.setActionCommand("next");
    nextButton.addActionListener(this);

    //Lay out the GUI.
    GridBagLayout layout = new GridBagLayout();
    GridBagConstraints c = new GridBagConstraints();

    Container contentPane = getContentPane();
    contentPane.setLayout(layout);

    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.HORIZONTAL;
    layout.setConstraints(numberLabel, c);
    contentPane.add(numberLabel);

    layout.setConstraints(captionLabel, c);
    contentPane.add(captionLabel);

    c.gridwidth = GridBagConstraints.REMAINDER;
    c.fill = GridBagConstraints.BOTH;
    layout.setConstraints(photographLabel, c);
    contentPane.add(photographLabel);

    c.gridwidth = GridBagConstraints.RELATIVE;
    c.fill = GridBagConstraints.HORIZONTAL;
    layout.setConstraints(previousButton, c);
    contentPane.add(previousButton);

    c.gridwidth = GridBagConstraints.REMAINDER;
    layout.setConstraints(nextButton, c);
    contentPane.add(nextButton);

    //Start loading the image for the first photograph now.
    //The loadImage method uses a SwingWorker
    //to load the image in a separate thread.
    loadImage(imagedir + first.filename, current);
}

From source file:org.openconcerto.erp.core.finance.accounting.ui.EtatJournauxPanel.java

private JPanel initJournalPanel(final Journal jrnl) {

    final JPanel panelTmp = new JPanel();
    long totalDebitJournal = 0;
    long totalCreditJournal = 0;

    panelTmp.setLayout(new GridBagLayout());

    final GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(2, 2, 1, 2);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridx = 0;/*from ww w.j ava2s .  co  m*/
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 1;
    c.weighty = 0;

    String req = "SELECT DISTINCT EXTRACT(YEAR FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\"), "
            + "EXTRACT(MONTH FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\")," + " SUM(\"" + baseName
            + "\".\"ECRITURE\".\"DEBIT\"), " + "SUM(\"" + baseName + "\".\"ECRITURE\".\"CREDIT\")" + " FROM \""
            + baseName + "\".\"ECRITURE\" " + "WHERE (\"" + baseName + "\".\"ECRITURE\".\"ID\" != 1) "
            + "AND ((\"" + baseName + "\".\"ECRITURE\".\"ARCHIVE\" = 0) " + "AND (\"" + baseName
            + "\".\"ECRITURE\".\"ID_JOURNAL\" = " + jrnl.getId() + ")) " + "GROUP BY EXTRACT(YEAR FROM \""
            + baseName + "\".\"ECRITURE\".\"DATE\"), " + "EXTRACT(MONTH FROM \"" + baseName
            + "\".\"ECRITURE\".\"DATE\") " + "ORDER BY EXTRACT(YEAR FROM \"" + baseName
            + "\".\"ECRITURE\".\"DATE\"), " + "EXTRACT(MONTH FROM \"" + baseName + "\".\"ECRITURE\".\"DATE\")";
    System.out.println(req);

    Object ob = base.getDataSource().execute(req, new ArrayListHandler());

    List myList = (List) ob;

    // System.err.println("TEST DATE " + t);

    if (myList.size() != 0) {

        for (int i = 0; i < myList.size(); i++) {

            Object[] objTmp = (Object[]) myList.get(i);

            Calendar cal = Calendar.getInstance();
            cal.set(Calendar.DATE, 1);
            int month = (new Double(objTmp[1].toString()).intValue() - 1);
            System.err.println(jrnl.getNom() + " SET MONTH " + month);
            cal.set(Calendar.MONTH, month);
            System.err.println(month + " = " + cal.getTime());

            cal.set(Calendar.YEAR, new Double(objTmp[0].toString()).intValue());

            long debitMois = ((Number) objTmp[2]).longValue();
            long creditMois = ((Number) objTmp[3]).longValue();

            c.gridwidth = GridBagConstraints.REMAINDER;
            final JPanel creerJournalMoisPanel = creerJournalMoisPanel(cal.getTime(), debitMois, creditMois,
                    jrnl);
            creerJournalMoisPanel.setOpaque(false);
            panelTmp.add(creerJournalMoisPanel, c);

            c.gridy++;

            totalDebitJournal += debitMois;
            totalCreditJournal += creditMois;
        }
    }
    c.gridx = 0;
    c.weighty = 1;
    c.gridwidth = 1;
    final JLabel label = new JLabel("Journal " + jrnl.getNom());
    label.setOpaque(false);
    panelTmp.add(label, c);
    c.gridx = GridBagConstraints.RELATIVE;
    panelTmp.add(new JLabel(" Total dbit : " + GestionDevise.currencyToString(totalDebitJournal)), c);
    panelTmp.add(new JLabel(" Total crdit : " + GestionDevise.currencyToString(totalCreditJournal)), c);

    return panelTmp;
}