Example usage for java.awt GridBagConstraints NONE

List of usage examples for java.awt GridBagConstraints NONE

Introduction

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

Prototype

int NONE

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

Click Source Link

Document

Do not resize the component.

Usage

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

private void setLabelConstraints(GridBagConstraints gbc, int gridy) {
    gbc.gridx = 0;/*  w w  w .java2s  .c om*/
    gbc.gridy = gridy;
    //      gbc.gridwidth = 0;
    gbc.weightx = 0;
    gbc.insets = LABEL_INSETS;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
}

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

/**
 * Initialises the application's GUI elements.
 *///from  w ww  .j av a  2 s  . c o m
private void initGui() {
    initMenus();

    JPanel appContent = new JPanel(new GridBagLayout());
    this.getContentPane().add(appContent);

    // Buckets panel.
    JPanel bucketsPanel = new JPanel(new GridBagLayout());

    JButton bucketActionButton = new JButton();
    bucketActionButton.setToolTipText("Bucket actions menu");
    guiUtils.applyIcon(bucketActionButton, "/images/nuvola/16x16/actions/misc.png");
    bucketActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            bucketActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    bucketsPanel.add(new JHtmlLabel("<html><b>Buckets</b></html>", this), new GridBagConstraints(0, 0, 1, 1, 1,
            0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    bucketsPanel.add(bucketActionButton, new GridBagConstraints(1, 0, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    bucketTableModel = new BucketTableModel(false);
    bucketTableModelSorter = new TableSorter(bucketTableModel);
    bucketsTable = new JTable(bucketTableModelSorter);
    bucketTableModelSorter.setTableHeader(bucketsTable.getTableHeader());
    bucketsTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
    bucketsTable.getSelectionModel().addListSelectionListener(this);
    bucketsTable.setShowHorizontalLines(true);
    bucketsTable.setShowVerticalLines(false);
    bucketsTable.addMouseListener(new ContextMenuListener());
    bucketsPanel.add(new JScrollPane(bucketsTable), new GridBagConstraints(0, 1, 2, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0));
    bucketsPanel.add(new JLabel(" "), new GridBagConstraints(0, 2, 2, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Filter panel.
    filterObjectsPanel = new JPanel(new GridBagLayout());
    filterObjectsPrefix = new JTextField();
    filterObjectsPrefix.setToolTipText("Only show objects with this prefix");
    filterObjectsPrefix.addActionListener(this);
    filterObjectsPrefix.setActionCommand("RefreshObjects");
    filterObjectsDelimiter = new JComboBox(new String[] { "", "/", "?", "\\" });
    filterObjectsDelimiter.setEditable(true);
    filterObjectsDelimiter.setToolTipText("Object name delimiter");
    filterObjectsDelimiter.addActionListener(this);
    filterObjectsDelimiter.setActionCommand("RefreshObjects");
    filterObjectsPanel.add(new JHtmlLabel("Prefix:", this), new GridBagConstraints(0, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    filterObjectsPanel.add(new JHtmlLabel("Delimiter:", this), new GridBagConstraints(2, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0));
    filterObjectsPanel.add(filterObjectsDelimiter, new GridBagConstraints(3, 0, 1, 1, 0, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.setVisible(false);

    // Objects panel.
    JPanel objectsPanel = new JPanel(new GridBagLayout());
    int row = 0;
    filterObjectsCheckBox = new JCheckBox("Filter objects");
    filterObjectsCheckBox.addActionListener(this);
    filterObjectsCheckBox.setToolTipText("Check this option to filter the objects listed");
    objectsPanel.add(new JHtmlLabel("<html><b>Objects</b></html>", this), new GridBagConstraints(0, row, 1, 1,
            1, 0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    JButton objectActionButton = new JButton();
    objectActionButton.setToolTipText("Object actions menu");
    guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png");
    objectActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            objectActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsTable = new JTable();
    objectTableModel = new ObjectTableModel();
    objectTableModelSorter = new TableSorter(objectTableModel);
    objectTableModelSorter.setTableHeader(objectsTable.getTableHeader());
    objectsTable.setModel(objectTableModelSorter);
    objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 301092191828910402L;

        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue());
            return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column);
        }
    });
    objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 7285511556343895652L;

        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Date date = (Date) value;
            return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus,
                    row, column);
        }
    });
    objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    objectsTable.getSelectionModel().addListSelectionListener(this);
    objectsTable.setShowHorizontalLines(true);
    objectsTable.setShowVerticalLines(true);
    objectsTable.addMouseListener(new ContextMenuListener());
    objectsTableSP = new JScrollPane(objectsTable);
    objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));
    objectsSummaryLabel = new JHtmlLabel("Please select a bucket", this);
    objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER);
    objectsSummaryLabel.setFocusable(false);
    objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Combine sections.
    JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, bucketsPanel, objectsPanel);
    splitPane.setOneTouchExpandable(true);
    splitPane.setContinuousLayout(true);

    appContent.add(splitPane, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // Set preferred sizes
    int preferredWidth = 800;
    int preferredHeight = 600;
    this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight)));

    splitPane.setResizeWeight(0.30);

    // Initialize drop target.
    initDropTarget(new JComponent[] { objectsTableSP, objectsTable });
    objectsTable.getDropTarget().setActive(false);
    objectsTableSP.getDropTarget().setActive(false);
}

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

/**
 * Initialises the application's GUI elements.
 */// w  w  w .  j a va 2s  . c o m
private void initGui() {
    // Initialise skins factory.
    skinsFactory = SkinsFactory.getInstance(cockpitLiteProperties.getProperties());

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

    // Primary panel that contains all other items.
    JPanel primaryPanel = skinsFactory.createSkinnedJPanel("PrimaryPanel");
    primaryPanel.setLayout(new GridBagLayout());
    this.getContentPane().add(primaryPanel);

    // Setup the stack panel, which contains all other panels as a stack.
    stackPanel = skinsFactory.createSkinnedJPanel("StackPanel");
    stackPanelCardLayout = new CardLayout();
    stackPanel.setLayout(stackPanelCardLayout);
    primaryPanel.add(stackPanel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));

    // Progress notification panel
    progressNotificationPanel = skinsFactory.createSkinnedJPanel("ProgressNotificationPanel");
    progressNotificationPanel.setLayout(new GridBagLayout());
    primaryPanel.add(progressNotificationPanel, new GridBagConstraints(0, 1, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, new Insets(5, 0, 5, 0), 0, 0));

    int row = 0;

    // Login panel.
    row = 0;
    loginPanel = skinsFactory.createSkinnedJPanel("LoginPanel");
    loginPanel.setLayout(new GridBagLayout());

    userInputFields = new UserInputFields(insetsDefault, null, skinsFactory);
    userInputFields.buildFieldsPanel(loginPanel, cockpitLiteProperties);

    loginButton = skinsFactory.createSkinnedJButton("LoginButton");
    loginButton.setText("Log me in");
    loginButton.addActionListener(this);
    loginPanel.add(loginButton, new GridBagConstraints(0, loginPanel.getComponentCount(), 1, 1, 0, 0,
            GridBagConstraints.CENTER, GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Filter panel.
    filterObjectsPanel = skinsFactory.createSkinnedJPanel("FilterPanel");
    filterObjectsPanel.setLayout(new GridBagLayout());
    filterObjectsPrefix = skinsFactory.createSkinnedJTextField("FilterPrefix");
    filterObjectsPrefix.setToolTipText("Only show files starting with this string");
    filterObjectsPrefix.addActionListener(this);
    filterObjectsPrefix.setActionCommand("RefreshObjects");
    JLabel filterPrefixLabel = skinsFactory.createSkinnedJHtmlLabel("FilterPrefixLable", this);
    filterPrefixLabel.setText("File name starts with: ");
    filterObjectsPanel.add(filterPrefixLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsZero, 0, 0));
    filterObjectsPanel.add(filterObjectsPrefix, new GridBagConstraints(1, 0, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    filterObjectsPanel.setVisible(false);

    // Objects panel.
    row = 0;
    JPanel objectsPanel = skinsFactory.createSkinnedJPanel("ObjectsPanel");
    objectsPanel.setLayout(new GridBagLayout());
    filterObjectsCheckBox = skinsFactory.createSkinnedJCheckBox("FilterCheckbox");
    filterObjectsCheckBox.setText("Search files");
    filterObjectsCheckBox.setEnabled(true);
    filterObjectsCheckBox.addActionListener(this);
    filterObjectsCheckBox.setToolTipText("Check this option to search your files");
    objectsHeadingLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectsHeadingLabel", this);
    objectsHeadingLabel.setText("Not logged in");
    objectsPanel.add(objectsHeadingLabel, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    objectsPanel.add(filterObjectsCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    JButton objectActionButton = skinsFactory.createSkinnedJButton("ObjectMenuButton");
    objectActionButton.setToolTipText("File actions menu");
    guiUtils.applyIcon(objectActionButton, "/images/nuvola/16x16/actions/misc.png");
    objectActionButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            JButton sourceButton = (JButton) e.getSource();
            objectActionMenu.show(sourceButton, 0, sourceButton.getHeight());
        }
    });
    objectsPanel.add(objectActionButton, new GridBagConstraints(2, row, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsPanel.add(filterObjectsPanel, new GridBagConstraints(0, ++row, 3, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));

    objectsTable = skinsFactory.createSkinnedJTable("ObjectsTable");
    objectTableModel = new CLObjectTableModel();
    objectTableModelSorter = new TableSorter(objectTableModel);
    objectTableModelSorter.setTableHeader(objectsTable.getTableHeader());
    objectsTable.setModel(objectTableModelSorter);
    objectsTable.setDefaultRenderer(Long.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = 7229656175879985698L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            String formattedSize = byteFormatter.formatByteSize(((Long) value).longValue());
            return super.getTableCellRendererComponent(table, formattedSize, isSelected, hasFocus, row, column);
        }
    });
    objectsTable.setDefaultRenderer(Date.class, new DefaultTableCellRenderer() {
        private static final long serialVersionUID = -4983176028291916397L;

        @Override
        public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected,
                boolean hasFocus, int row, int column) {
            Date date = (Date) value;
            return super.getTableCellRendererComponent(table, yearAndTimeSDF.format(date), isSelected, hasFocus,
                    row, column);
        }
    });
    objectsTable.setSelectionMode(ListSelectionModel.MULTIPLE_INTERVAL_SELECTION);
    objectsTable.getSelectionModel().addListSelectionListener(this);
    objectsTable.setShowHorizontalLines(true);
    objectsTable.setShowVerticalLines(true);
    objectsTable.addMouseListener(new ContextMenuListener());
    objectsTableSP = skinsFactory.createSkinnedJScrollPane("ObjectsTableSP", objectsTable);
    objectsPanel.add(objectsTableSP, new GridBagConstraints(0, ++row, 3, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsZero, 0, 0));
    objectsSummaryLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectsSummary", this);
    objectsSummaryLabel.setHorizontalAlignment(JLabel.CENTER);
    objectsSummaryLabel.setFocusable(false);
    objectsPanel.add(objectsSummaryLabel, new GridBagConstraints(0, ++row, 3, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Object action menu.
    objectActionMenu = skinsFactory.createSkinnedJPopupMenu("ObjectPopupMenu");

    refreshObjectMenuItem = skinsFactory.createSkinnedJMenuItem("RefreshMenuItem");
    refreshObjectMenuItem.setText("Refresh file listing");
    refreshObjectMenuItem.setActionCommand("RefreshObjects");
    refreshObjectMenuItem.addActionListener(this);
    guiUtils.applyIcon(refreshObjectMenuItem, "/images/nuvola/16x16/actions/reload.png");
    objectActionMenu.add(refreshObjectMenuItem);

    viewObjectPropertiesMenuItem = skinsFactory.createSkinnedJMenuItem("PropertiesMenuItem");
    viewObjectPropertiesMenuItem.setText("View file properties...");
    viewObjectPropertiesMenuItem.setActionCommand("ViewObjectProperties");
    viewObjectPropertiesMenuItem.addActionListener(this);
    guiUtils.applyIcon(viewObjectPropertiesMenuItem, "/images/nuvola/16x16/actions/viewmag.png");
    objectActionMenu.add(viewObjectPropertiesMenuItem);

    downloadObjectMenuItem = skinsFactory.createSkinnedJMenuItem("DownloadMenuItem");
    downloadObjectMenuItem.setText("Download file(s)...");
    downloadObjectMenuItem.setActionCommand("DownloadObjects");
    downloadObjectMenuItem.addActionListener(this);
    guiUtils.applyIcon(downloadObjectMenuItem, "/images/nuvola/16x16/actions/1downarrow.png");
    objectActionMenu.add(downloadObjectMenuItem);

    uploadFilesMenuItem = skinsFactory.createSkinnedJMenuItem("UploadMenuItem");
    uploadFilesMenuItem.setText("Upload file(s)...");
    uploadFilesMenuItem.setActionCommand("UploadFiles");
    uploadFilesMenuItem.addActionListener(this);
    guiUtils.applyIcon(uploadFilesMenuItem, "/images/nuvola/16x16/actions/1uparrow.png");
    objectActionMenu.add(uploadFilesMenuItem);

    objectActionMenu.add(new JSeparator());

    togglePublicMenuItem = skinsFactory.createSkinnedJMenuItem("AclToggleMenuItem");
    togglePublicMenuItem.setText("Change privacy setting...");
    togglePublicMenuItem.setActionCommand("TogglePublicPrivate");
    togglePublicMenuItem.addActionListener(this);
    guiUtils.applyIcon(togglePublicMenuItem, "/images/nuvola/16x16/actions/encrypted.png");
    objectActionMenu.add(togglePublicMenuItem);

    generatePublicGetUrl = skinsFactory.createSkinnedJMenuItem("PublicUrlMenuItem");
    generatePublicGetUrl.setText("Public web link...");
    generatePublicGetUrl.setActionCommand("GeneratePublicGetURL");
    generatePublicGetUrl.addActionListener(this);
    guiUtils.applyIcon(generatePublicGetUrl, "/images/nuvola/16x16/actions/wizard.png");
    objectActionMenu.add(generatePublicGetUrl);

    objectActionMenu.add(new JSeparator());

    deleteObjectMenuItem = skinsFactory.createSkinnedJMenuItem("DeleteMenuItem");
    deleteObjectMenuItem.setText("Delete file(s)...");
    deleteObjectMenuItem.setActionCommand("DeleteObjects");
    deleteObjectMenuItem.addActionListener(this);
    guiUtils.applyIcon(deleteObjectMenuItem, "/images/nuvola/16x16/actions/cancel.png");
    objectActionMenu.add(deleteObjectMenuItem);

    viewObjectPropertiesMenuItem.setEnabled(false);
    refreshObjectMenuItem.setEnabled(false);
    togglePublicMenuItem.setEnabled(false);
    downloadObjectMenuItem.setEnabled(false);
    generatePublicGetUrl.setEnabled(false);
    deleteObjectMenuItem.setEnabled(false);

    // Card layout in stack panel
    stackPanel.add(loginPanel, "LoginPanel");
    stackPanel.add(objectsPanel, "ObjectsPanel");

    // Set preferred sizes
    int preferredWidth = 800;
    int preferredHeight = 600;
    this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight)));

    // Initialize drop target.
    initDropTarget(new JComponent[] { objectsPanel });
    objectsPanel.getDropTarget().setActive(true);
}

From source file:org.openconcerto.erp.core.sales.credit.component.AvoirClientSQLComponent.java

private JPanel getBottomPanel() {

    // UI//from   w w  w.j av a 2 s  .  c om

    final JPanel panel = new JPanel(new GridBagLayout());
    panel.setOpaque(false);
    final GridBagConstraints c = new DefaultGridBagConstraints();
    c.anchor = GridBagConstraints.NORTHWEST;
    c.weightx = 1;
    // Colonne 1
    this.boxAdeduire.setOpaque(false);
    this.boxAdeduire.setMinimumSize(new Dimension(430, this.boxAdeduire.getPreferredSize().height));
    this.boxAdeduire.setPreferredSize(new Dimension(430, this.boxAdeduire.getPreferredSize().height));
    panel.add(this.boxAdeduire, c);
    this.addView("ID_MODE_REGLEMENT", DEC + ";" + SEP);
    this.eltModeRegl = (ElementSQLObject) this.getView("ID_MODE_REGLEMENT");

    c.gridy++;
    c.fill = GridBagConstraints.NONE;
    c.weighty = 1;
    this.eltModeRegl.setOpaque(false);
    panel.add(this.eltModeRegl, c);

    // Colonne 2 : port et remise

    final JPanel panelPortEtRemise = new JPanel();
    panelPortEtRemise.setOpaque(false);
    panelPortEtRemise.setLayout(new GridBagLayout());

    final GridBagConstraints cFrais = new DefaultGridBagConstraints();

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

    // Frais de port
    cFrais.gridheight = 1;
    cFrais.fill = GridBagConstraints.VERTICAL;
    cFrais.weighty = 1;
    cFrais.gridx = 1;

    // FIXME implmenter la remise et les port pour les avoirs
    JLabel labelPortHT = new JLabel(getLabelFor("PORT_HT"));
    labelPortHT.setHorizontalAlignment(SwingConstants.RIGHT);
    cFrais.gridy++;
    // panelPortEtRemise.add(labelPortHT, cFrais);
    cFrais.gridx++;
    DefaultGridBagConstraints.lockMinimumSize(textPortHT);
    // panelPortEtRemise.add(textPortHT, cFrais);

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

    c.gridx++;
    c.gridy = 0;
    c.gridheight = 2;
    c.weightx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    panel.add(panelPortEtRemise, c);

    // Colonne 3 : totaux
    final DeviseField fieldHT = new DeviseField();
    final DeviseField fieldTVA = new DeviseField();
    final DeviseField fieldService = new DeviseField();
    final DeviseField fieldTTC = new DeviseField();
    // SQL
    addSQLObject(textPortHT, "PORT_HT");
    final DeviseField fieldDevise = new DeviseField();
    if (getTable().getFieldsName().contains("T_DEVISE"))
        addSQLObject(fieldDevise, "T_DEVISE");
    addSQLObject(textRemiseHT, "REMISE_HT");
    addRequiredSQLObject(fieldHT, "MONTANT_HT");
    addRequiredSQLObject(fieldTVA, "MONTANT_TVA");
    addRequiredSQLObject(fieldTTC, "MONTANT_TTC");
    addRequiredSQLObject(fieldService, "MONTANT_SERVICE");
    //
    JTextField poids = new JTextField();
    if (getTable().getFieldsName().contains("T_POIDS"))
        addSQLObject(poids, "T_POIDS");
    final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT,
            textRemiseHT, fieldService, null, fieldDevise, poids, null);
    totalTTC.setOpaque(false);
    c.gridx++;
    c.gridy = 0;
    c.gridheight = 2;
    c.fill = GridBagConstraints.BOTH;
    panel.add(totalTTC, c);

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

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

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

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

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

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

From source file:com.rapidminer.gui.new_plotter.gui.ColorSchemeDialog.java

/**
 * @return/*from   w  w  w  .  j  a v  a 2 s.  c o m*/
 */
private JPanel createGradientConfigurationPanel() {

    // create gradient config panel
    JPanel gradientConfigPanel = new JPanel(new GridBagLayout());
    gradientConfigPanel.setPreferredSize(new Dimension(100, 50));

    GridBagConstraints itemConstraint;

    // add gradient label
    {
        JLabel gradientLabel = new ResourceLabel(
                "plotter.configuration_dialog.color_scheme_dialog.gradient_preview");

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1;
        itemConstraint.weighty = 1;
        itemConstraint.fill = GridBagConstraints.BOTH;
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(gradientLabel, itemConstraint);
    }

    // add combobox panel
    {
        JPanel comboBoxPanel = new JPanel(new GridBagLayout());

        // gradient start panel
        {

            JPanel startGradientPanel = createStartGradientPanel();

            itemConstraint = new GridBagConstraints();
            itemConstraint.weightx = 1.0;
            itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
            itemConstraint.anchor = GridBagConstraints.WEST;
            itemConstraint.fill = GridBagConstraints.HORIZONTAL;

            comboBoxPanel.add(startGradientPanel, itemConstraint);

        }

        // gradient end panel
        {

            JPanel endGradientPanel = createEndGradientPanel();

            itemConstraint = new GridBagConstraints();
            itemConstraint.weightx = 1.0;
            itemConstraint.gridwidth = GridBagConstraints.RELATIVE;
            itemConstraint.anchor = GridBagConstraints.EAST;
            itemConstraint.fill = GridBagConstraints.HORIZONTAL;

            comboBoxPanel.add(endGradientPanel, itemConstraint);

        }

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1;
        itemConstraint.weighty = 0.0;
        itemConstraint.fill = GridBagConstraints.HORIZONTAL;
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(comboBoxPanel, itemConstraint);
    }

    // add 0.0 label
    {
        JLabel zeroLabel = new JLabel("0");

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 0;
        itemConstraint.weighty = 0;
        itemConstraint.fill = GridBagConstraints.NONE;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(zeroLabel, itemConstraint);
    }

    // add gradient preview
    {
        preview = new GradientPreview(null);

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 1;
        itemConstraint.weighty = 1;
        itemConstraint.fill = GridBagConstraints.BOTH;
        itemConstraint.insets = new Insets(2, 2, 2, 2);

        gradientConfigPanel.add(preview, itemConstraint);

    }

    // add 1.0 label
    {
        JLabel zeroLabel = new JLabel("1");

        itemConstraint = new GridBagConstraints();
        itemConstraint.weightx = 0;
        itemConstraint.weighty = 0;
        itemConstraint.fill = GridBagConstraints.NONE;
        itemConstraint.insets = new Insets(2, 2, 2, 2);
        itemConstraint.gridwidth = GridBagConstraints.REMAINDER;

        gradientConfigPanel.add(zeroLabel, itemConstraint);
    }

    return gradientConfigPanel;
}

From source file:org.jets3t.apps.uploader.Uploader.java

/**
 * Initialises the application's GUI elements.
 *///  w  w  w  .j  a  v a  2s.  c o  m
private void initGui() {
    // Initialise skins factory.
    skinsFactory = SkinsFactory.getInstance(uploaderProperties.getProperties());

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

    // Apply branding
    String applicationTitle = replaceMessageVariables(
            uploaderProperties.getStringProperty("gui.applicationTitle", null));
    if (applicationTitle != null) {
        ownerFrame.setTitle(applicationTitle);
    }
    String applicationIconPath = uploaderProperties.getStringProperty("gui.applicationIcon", null);
    if (!isRunningAsApplet && applicationIconPath != null) {
        guiUtils.applyIcon(ownerFrame, applicationIconPath);
    }
    String footerHtml = uploaderProperties.getStringProperty("gui.footerHtml", null);
    String footerIconPath = uploaderProperties.getStringProperty("gui.footerIcon", null);

    // Footer for branding
    boolean includeFooter = false;
    JHtmlLabel footerLabel = skinsFactory.createSkinnedJHtmlLabel("FooterLabel");
    footerLabel.setHyperlinkeActivatedListener(this);
    footerLabel.setHorizontalAlignment(JLabel.CENTER);
    if (footerHtml != null) {
        footerLabel.setText(replaceMessageVariables(footerHtml));
        includeFooter = true;
    }
    if (footerIconPath != null) {
        guiUtils.applyIcon(footerLabel, footerIconPath);
    }

    userInputFields = new UserInputFields(insetsDefault, this, skinsFactory);

    // Screeen 1 : User input fields.
    JPanel screen1Panel = skinsFactory.createSkinnedJPanel("Screen1Panel");
    screen1Panel.setLayout(GRID_BAG_LAYOUT);
    userInputFields.buildFieldsPanel(screen1Panel, uploaderProperties);

    // Screen 2 : Drag/drop panel.
    JPanel screen2Panel = skinsFactory.createSkinnedJPanel("Screen2Panel");
    screen2Panel.setLayout(GRID_BAG_LAYOUT);
    dragDropTargetLabel = skinsFactory.createSkinnedJHtmlLabel("DragDropTargetLabel");
    dragDropTargetLabel.setHyperlinkeActivatedListener(this);
    dragDropTargetLabel.setHorizontalAlignment(JLabel.CENTER);
    dragDropTargetLabel.setVerticalAlignment(JLabel.CENTER);

    JButton chooseFileButton = skinsFactory.createSkinnedJButton("ChooseFileButton");
    chooseFileButton.setActionCommand("ChooseFile");
    chooseFileButton.addActionListener(this);
    configureButton(chooseFileButton, "screen.2.browseButton");

    screen2Panel.add(dragDropTargetLabel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    screen2Panel.add(chooseFileButton, new GridBagConstraints(0, 1, 1, 1, 1, 1, GridBagConstraints.NORTH,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Screen 3 : Information about the file to be uploaded.
    JPanel screen3Panel = skinsFactory.createSkinnedJPanel("Screen3Panel");
    screen3Panel.setLayout(GRID_BAG_LAYOUT);
    fileToUploadLabel = skinsFactory.createSkinnedJHtmlLabel("FileToUploadLabel");
    fileToUploadLabel.setHyperlinkeActivatedListener(this);
    fileToUploadLabel.setHorizontalAlignment(JLabel.CENTER);
    fileToUploadLabel.setVerticalAlignment(JLabel.CENTER);
    screen3Panel.add(fileToUploadLabel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // Screen 4 : Upload progress.
    JPanel screen4Panel = skinsFactory.createSkinnedJPanel("Screen4Panel");
    screen4Panel.setLayout(GRID_BAG_LAYOUT);
    fileInformationLabel = skinsFactory.createSkinnedJHtmlLabel("FileInformationLabel");
    fileInformationLabel.setHyperlinkeActivatedListener(this);
    fileInformationLabel.setHorizontalAlignment(JLabel.CENTER);
    progressBar = skinsFactory.createSkinnedJProgressBar("ProgressBar", 0, 100);
    progressBar.setStringPainted(true);
    progressStatusTextLabel = skinsFactory.createSkinnedJHtmlLabel("ProgressStatusTextLabel");
    progressStatusTextLabel.setHyperlinkeActivatedListener(this);
    progressStatusTextLabel.setText(" ");
    progressStatusTextLabel.setHorizontalAlignment(JLabel.CENTER);
    progressTransferDetailsLabel = skinsFactory.createSkinnedJHtmlLabel("ProgressTransferDetailsLabel");
    progressTransferDetailsLabel.setHyperlinkeActivatedListener(this);
    progressTransferDetailsLabel.setText(" ");
    progressTransferDetailsLabel.setHorizontalAlignment(JLabel.CENTER);
    cancelUploadButton = skinsFactory.createSkinnedJButton("CancelUploadButton");
    cancelUploadButton.setActionCommand("CancelUpload");
    cancelUploadButton.addActionListener(this);
    configureButton(cancelUploadButton, "screen.4.cancelButton");

    screen4Panel.add(fileInformationLabel, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    screen4Panel.add(progressBar, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    screen4Panel.add(progressStatusTextLabel, new GridBagConstraints(0, 2, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    screen4Panel.add(progressTransferDetailsLabel, new GridBagConstraints(0, 3, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    screen4Panel.add(cancelUploadButton, new GridBagConstraints(0, 4, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Screen 5 : Thankyou message.
    JPanel screen5Panel = skinsFactory.createSkinnedJPanel("Screen5Panel");
    screen5Panel.setLayout(GRID_BAG_LAYOUT);
    finalMessageLabel = skinsFactory.createSkinnedJHtmlLabel("FinalMessageLabel");
    finalMessageLabel.setHyperlinkeActivatedListener(this);
    finalMessageLabel.setHorizontalAlignment(JLabel.CENTER);
    screen5Panel.add(finalMessageLabel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // Wizard Button panel.
    backButton = skinsFactory.createSkinnedJButton("backButton");
    backButton.setActionCommand("Back");
    backButton.addActionListener(this);
    nextButton = skinsFactory.createSkinnedJButton("nextButton");
    nextButton.setActionCommand("Next");
    nextButton.addActionListener(this);

    buttonsPanel = skinsFactory.createSkinnedJPanel("ButtonsPanel");
    buttonsPanelCardLayout = new CardLayout();
    buttonsPanel.setLayout(buttonsPanelCardLayout);
    JPanel buttonsInvisiblePanel = skinsFactory.createSkinnedJPanel("ButtonsInvisiblePanel");
    JPanel buttonsVisiblePanel = skinsFactory.createSkinnedJPanel("ButtonsVisiblePanel");
    buttonsVisiblePanel.setLayout(GRID_BAG_LAYOUT);
    buttonsVisiblePanel.add(backButton, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    buttonsVisiblePanel.add(nextButton, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.EAST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
    buttonsPanel.add(buttonsInvisiblePanel, "invisible");
    buttonsPanel.add(buttonsVisiblePanel, "visible");

    // Overall content panel.
    appContentPanel = skinsFactory.createSkinnedJPanel("ApplicationContentPanel");
    appContentPanel.setLayout(GRID_BAG_LAYOUT);
    JPanel userGuidancePanel = skinsFactory.createSkinnedJPanel("UserGuidancePanel");
    userGuidancePanel.setLayout(GRID_BAG_LAYOUT);
    primaryPanel = skinsFactory.createSkinnedJPanel("PrimaryPanel");
    primaryPanelCardLayout = new CardLayout();
    primaryPanel.setLayout(primaryPanelCardLayout);
    JPanel navigationPanel = skinsFactory.createSkinnedJPanel("NavigationPanel");
    navigationPanel.setLayout(GRID_BAG_LAYOUT);

    appContentPanel.add(userGuidancePanel, new GridBagConstraints(0, 0, 1, 1, 1, 0.2, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    appContentPanel.add(primaryPanel, new GridBagConstraints(0, 1, 1, 1, 1, 0.6, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    appContentPanel.add(navigationPanel, new GridBagConstraints(0, 2, 1, 1, 1, 0.2, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    if (includeFooter) {
        log.debug("Adding footer for branding");
        appContentPanel.add(footerLabel, new GridBagConstraints(0, 3, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));
    }
    this.getContentPane().add(appContentPanel);

    userGuidanceLabel = skinsFactory.createSkinnedJHtmlLabel("UserGuidanceLabel");
    userGuidanceLabel.setHyperlinkeActivatedListener(this);
    userGuidanceLabel.setHorizontalAlignment(JLabel.CENTER);

    userGuidancePanel.add(userGuidanceLabel, new GridBagConstraints(0, 0, 1, 1, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsNone, 0, 0));
    navigationPanel.add(buttonsPanel, new GridBagConstraints(0, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsNone, 0, 0));

    primaryPanel.add(screen1Panel, "screen1");
    primaryPanel.add(screen2Panel, "screen2");
    primaryPanel.add(screen3Panel, "screen3");
    primaryPanel.add(screen4Panel, "screen4");
    primaryPanel.add(screen5Panel, "screen5");

    // Set preferred sizes
    int preferredWidth = uploaderProperties.getIntProperty("gui.minSizeWidth", 400);
    int preferredHeight = uploaderProperties.getIntProperty("gui.minSizeHeight", 500);
    this.setBounds(new Rectangle(new Dimension(preferredWidth, preferredHeight)));

    // Initialize drop target.
    initDropTarget(new Component[] { this });

    // Revert to default Look and Feel for all future GUI elements (eg Dialog boxes).
    try {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    } catch (Exception e) {
        log.error("Unable to set default system LookAndFeel", e);
    }

    wizardStepForward();
}

From source file:org.pentaho.reporting.designer.extensions.pentaho.repository.dialogs.RepositoryOpenDialog.java

protected JPanel createLocationFieldPanel() {
    final GridBagConstraints c = new GridBagConstraints();
    final JPanel locationFieldPanel = new JPanel();
    locationFieldPanel.setLayout(new GridBagLayout());
    c.insets = new Insets(0, 5, 5, 0);
    c.gridx = 0;//from ww w  .j av a2  s.  com
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.anchor = GridBagConstraints.WEST;
    locationFieldPanel.add(locationCombo, c);

    c.insets = new Insets(5, 8, 5, 0);
    c.gridx = 1;
    c.gridy = 0;
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0;
    c.anchor = GridBagConstraints.WEST;
    locationFieldPanel.add(new BorderlessButton(new LevelUpAction()), c);

    c.gridx = 2;
    c.gridy = 0;
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0;
    c.anchor = GridBagConstraints.EAST;
    locationFieldPanel.add(new BorderlessButton(new BrowseRepositoryAction()), c);
    return locationFieldPanel;
}

From source file:com.microsoft.azure.hdinsight.spark.ui.SparkSubmissionContentPanel.java

private void addMainClassNameLineItem() {
    JLabel sparkMainClassLabel = new JLabel("Main class name");
    sparkMainClassLabel.setToolTipText("Application's java/spark main class");
    GridBagConstraints c31 = new GridBagConstraints();
    c31.gridx = 0;/*from   w w  w .  j ava  2s . com*/
    c31.gridy = 2;
    c31.insets = new Insets(margin, margin, margin, margin);
    add(sparkMainClassLabel, new GridBagConstraints(0, ++displayLayoutCurrentRow, 1, 1, 1, 0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(margin, margin, 0, 0), 0, 0));

    mainClassTextField = new TextFieldWithBrowseButton();
    mainClassTextField.setToolTipText("Application's java/spark main class");
    ManifestFileUtil.setupMainClassField(submitModel.getProject(), mainClassTextField);

    add(mainClassTextField,
            new GridBagConstraints(1, displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(margin, margin, 0, margin), 0, 0));

    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()] = new JLabel(
            "Main Class Name should not be null");
    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()]
            .setForeground(DarkThemeManager.getInstance().getErrorMessageColor());
    errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()].setVisible(true);

    mainClassTextField.getTextField().getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(3, e.getDocument().getLength() == 0);
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            setVisibleForFixedErrorMessageLabel(3, e.getDocument().getLength() == 0);
        }

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

    add(errorMessageLabels[ErrorMessageLabelTag.MainClass.ordinal()],
            new GridBagConstraints(1, ++displayLayoutCurrentRow, 0, 1, 1, 0, GridBagConstraints.WEST,
                    GridBagConstraints.HORIZONTAL, new Insets(0, margin, 0, margin), 0, 0));
}

From source file:org.openconcerto.erp.core.supplychain.order.component.CommandeSQLComponent.java

private JPanel getBottomPanel() {
    final JPanel panel = new JPanel(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();

    // Colonne 1 : Infos
    c.gridx = 0;/*from   w ww .j  ava2  s  . c  om*/
    c.weightx = 1;
    c.anchor = GridBagConstraints.WEST;
    c.fill = GridBagConstraints.HORIZONTAL;

    panel.add(new TitledSeparator(getLabelFor("INFOS")), c);

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

    // Colonne 2 : Poids & autres
    DefaultProps props = DefaultNXProps.getInstance();
    Boolean b = props.getBooleanValue("ArticleShowPoids");
    final JTextField textPoidsTotal = new JTextField(8);
    JTextField poids = new JTextField();
    if (b) {
        final JPanel panelPoids = new JPanel();

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

        textPoidsTotal.setEnabled(false);
        textPoidsTotal.setHorizontalAlignment(JTextField.RIGHT);
        textPoidsTotal.setDisabledTextColor(Color.BLACK);

        panelPoids.add(textPoidsTotal, c);

        c.gridx++;
        c.gridy = 0;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        c.gridheight = 2;
        c.fill = GridBagConstraints.NONE;
        c.anchor = GridBagConstraints.NORTHEAST;
        panel.add(panelPoids, c);
        DefaultGridBagConstraints.lockMinimumSize(panelPoids);
        addSQLObject(textPoidsTotal, "T_POIDS");
    } else {
        addSQLObject(poids, "T_POIDS");
    }

    DeviseField textPortHT = new DeviseField();
    ElementComboBox comboTaxePort = new ElementComboBox();

    if (getTable().contains("PORT_HT")) {
        addRequiredSQLObject(textPortHT, "PORT_HT");
        final JPanel panelPoids = new JPanel(new GridBagLayout());
        GridBagConstraints cPort = new DefaultGridBagConstraints();
        cPort.gridx = 0;
        cPort.weightx = 0;
        panelPoids.add(new JLabel(getLabelFor("PORT_HT")), cPort);
        textPortHT.setHorizontalAlignment(JTextField.RIGHT);
        cPort.gridx++;
        cPort.weightx = 1;
        panelPoids.add(textPortHT, cPort);

        cPort.gridy++;
        cPort.gridx = 0;
        cPort.weightx = 0;
        addRequiredSQLObject(comboTaxePort, "ID_TAXE_PORT");
        panelPoids.add(new JLabel(getLabelFor("ID_TAXE_PORT")), cPort);
        cPort.gridx++;
        cPort.weightx = 0;
        panelPoids.add(comboTaxePort, cPort);

        c.gridx++;
        c.gridy = 0;
        c.weightx = 0;
        c.weighty = 0;
        c.gridwidth = 1;
        c.gridheight = 2;
        c.fill = GridBagConstraints.NONE;
        c.anchor = GridBagConstraints.NORTHEAST;
        panel.add(panelPoids, c);
        DefaultGridBagConstraints.lockMinimumSize(panelPoids);
    }
    // Total

    DeviseField textRemiseHT = new DeviseField();
    DeviseField fieldHT = new DeviseField();
    DeviseField fieldTVA = new DeviseField();
    DeviseField fieldTTC = new DeviseField();
    DeviseField fieldDevise = new DeviseField();
    DeviseField fieldService = new DeviseField();
    fieldHT.setOpaque(false);
    fieldTVA.setOpaque(false);
    fieldTTC.setOpaque(false);
    fieldService.setOpaque(false);
    addRequiredSQLObject(fieldDevise, "T_DEVISE");
    addRequiredSQLObject(fieldHT, "T_HT");
    addRequiredSQLObject(fieldTVA, "T_TVA");

    addRequiredSQLObject(fieldTTC, "T_TTC");
    addRequiredSQLObject(fieldService, "T_SERVICE");
    final TotalPanel totalTTC = new TotalPanel(this.table, fieldHT, fieldTVA, fieldTTC, textPortHT,
            textRemiseHT, fieldService, null, fieldDevise, null, null,
            (getTable().contains("ID_TAXE_PORT") ? comboTaxePort : null));

    c.gridx++;
    c.gridy--;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 2;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.fill = GridBagConstraints.BOTH;
    c.weighty = 0;
    DefaultGridBagConstraints.lockMinimumSize(totalTTC);

    panel.add(totalTTC, c);

    c.gridy += 3;
    c.gridheight = 2;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.EAST;
    panel.add(getModuleTotalPanel(), c);

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

        public void tableChanged(TableModelEvent e) {
            textPoidsTotal.setText(String.valueOf(table.getPoidsTotal()));
        }
    });

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

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

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

    comboTaxePort.addValueListener(new PropertyChangeListener() {

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

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

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

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

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

private JPanel createAutoUpdatePanel() {
    JPanel pnl = new JPanel(new GridBagLayout());
    pnl.setBorder(BorderFactory.createTitledBorder(i18n.AUTO_BORDER_LABEL));

    final GridBagConstraints gbc = new GridBagConstraints();
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(4, 4, 4, 4);
    gbc.gridx = 0;//www.  j a  v  a 2 s  . co  m
    gbc.gridy = 0;
    gbc.gridwidth = 2;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    pnl.add(_enableAutoUpdateChk, gbc);

    gbc.gridwidth = 1;

    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.weightx = 0;
    gbc.insets = new Insets(4, 20, 4, 10);
    pnl.add(new JLabel(i18n.AUTO_CHECK_FREQUENCY, JLabel.LEFT), gbc);

    gbc.gridx = 1;
    gbc.gridy = 1;
    gbc.weightx = 1;
    gbc.insets = new Insets(4, 0, 4, 0);
    gbc.fill = GridBagConstraints.NONE;
    pnl.add(this._updateCheckFrequency, gbc);

    return pnl;
}