Example usage for java.awt GridBagConstraints EAST

List of usage examples for java.awt GridBagConstraints EAST

Introduction

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

Prototype

int EAST

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

Click Source Link

Document

Put the component on the right side of its display area, centered vertically.

Usage

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

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

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

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

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

public CloturePanel() {
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.WEST;
    c.gridx = 0;//  ww w .j  a va2 s  .  co  m
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.gridheight = 1;
    c.weightx = 0;
    c.weighty = 0;

    JLabel rappel = new JLabelBold("Oprations  effectuer avant de continuer: ");
    JLabel label = new JLabel("- report des charges et produits constats d'avance");
    JLabel label2 = new JLabel("- report des charges  payer et produits  recevoir");
    JLabel label3 = new JLabel("- impression du bilan, compte de rsultat, grand livre, journaux et balance");
    JLabel label5 = new JLabel("- gnration les critures comptables des payes");
    JLabel label4 = new JLabel("Il est prfrable de raliser une sauvegarde avant de continuer.");

    JLabel op = new JLabelBold("Oprations qui vont etre effectues: ");
    JLabel labelValid = new JLabel(
            "- validation de toutes les critures concernant la priode de l'exercice.");
    JLabel labelSoldeGestion = new JLabel("- soldes de tous les comptes de gestions 6* et 7*");
    JLabel labelSoldeBilan = new JLabel("- soldes de tous les comptes de bilan");
    JLabel labelAN = new JLabel("- report des  nouveaux");

    c.gridy = GridBagConstraints.RELATIVE;
    c.gridx = 0;

    // Date de l'ancien exercice
    Calendar dDebut = this.rowExercice.getDate("DATE_DEB");
    Calendar dFin = this.rowExercice.getDate("DATE_FIN");
    JLabel labelAncienExercice = new JLabel("Clture de l'exercice du " + dateFormat.format(dDebut.getTime())
            + " au " + dateFormat.format(dFin.getTime()));
    this.add(labelAncienExercice, c);
    c.insets = new Insets(10, 2, 1, 2);
    this.add(rappel, c);
    this.add(label, c);
    this.add(label2, c);
    this.add(label3, c);
    this.add(label5, c);
    this.add(label4, c);

    c.insets = new Insets(15, 2, 1, 2);
    this.add(op, c);

    c.insets = new Insets(10, 2, 1, 2);
    this.add(labelValid, c);
    this.add(labelSoldeGestion, c);
    this.add(labelSoldeBilan, c);
    this.add(labelAN, c);

    // Date du prochain exercice
    c.gridwidth = 1;
    c.gridy = GridBagConstraints.RELATIVE;
    c.gridx = 0;
    c.gridx = GridBagConstraints.RELATIVE;
    c.fill = GridBagConstraints.NONE;

    this.add(new JLabel("Date du nouvel exercice du "), c);

    dDebut.set(Calendar.YEAR, dDebut.get(Calendar.YEAR) + 1);
    this.dateOuv.setValue(dDebut.getTime());
    this.add(this.dateOuv, c);
    this.add(new JLabel("au"), c);
    dFin.set(Calendar.YEAR, dFin.get(Calendar.YEAR) + 1);
    this.dateFerm.setValue(dFin.getTime());
    this.add(this.dateFerm, c);

    c.gridx = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridwidth = 2;
    c.weightx = 1;
    this.add(this.opEnCours, c);

    c.gridwidth = 4;
    c.gridx = 0;
    c.weightx = 1;
    this.add(this.bar, c);

    //
    this.add(this.boxValid, c);

    // Button
    final JPanel buttonBar = new JPanel();
    buttonBar.add(this.valider);
    buttonBar.add(this.annul);

    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.EAST;
    c.gridx = 0;
    this.add(buttonBar, c);

    final PropertyChangeListener listener = new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            CloturePanel.this.valider.setEnabled(isDateValid());
        }
    };
    this.dateFerm.addValueListener(listener);
    this.dateOuv.addValueListener(listener);

    // TODO afficher le deroulement de etapes apres validation

    this.valider.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            try {
                clotureExercice();
                // show OK works fine
                Component comp = SwingUtilities.getRoot(CloturePanel.this);
                JOptionPane.showMessageDialog(CloturePanel.this, "Exercice cltur", "Fin de la clture",
                        JOptionPane.INFORMATION_MESSAGE);
                ((JFrame) comp).dispose();
            } catch (Exception ex) {
                ExceptionHandler.handle("Erreur lors de la clture", ex);
            }
        }
    });

    this.valider.setEnabled(isDateValid());

    this.boxValid.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            CloturePanel.this.valider.setEnabled(isDateValid());
        }
    });

    this.annul.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {

            ((JFrame) SwingUtilities.getRoot(CloturePanel.this)).dispose();
        }
    });
}

From source file:com.marginallyclever.makelangelo.MainGUI.java

public void chooseLanguage() {
    final JDialog driver = new JDialog(mainframe, "Language", true);
    driver.setLayout(new GridBagLayout());

    final String[] choices = translator.getLanguageList();
    final JComboBox<String> language_options = new JComboBox<String>(choices);
    final JButton save = new JButton(">>>");

    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.WEST;
    c.gridwidth = 2;//from  www .ja  v  a 2 s.  c  o  m
    c.gridx = 0;
    c.gridy = 0;
    driver.add(language_options, c);
    c.anchor = GridBagConstraints.EAST;
    c.gridwidth = 1;
    c.gridx = 2;
    c.gridy = 0;
    driver.add(save, c);

    ActionListener driveButtons = new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            Object subject = e.getSource();
            // TODO prevent "close" icon.  Must press save to continue!
            if (subject == save) {
                translator.currentLanguage = choices[language_options.getSelectedIndex()];
                translator.saveConfig();
                driver.dispose();
            }
        }
    };

    save.addActionListener(driveButtons);

    driver.pack();
    driver.setVisible(true);
}

From source file:gov.nij.er.ui.EntityResolutionDemo.java

private void layoutUI() {

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

    JScrollPane rawDataTreeScrollPane = new JScrollPane(rawDataTree);
    JScrollPane parametersTableScrollPane = new JScrollPane(parametersTable);
    JScrollPane resolvedDataTreeScrollPane = new JScrollPane(resolvedDataTree);

    Insets insets = new Insets(5, 5, 5, 5);
    panel.add(new JLabel("Raw Data:"), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, insets, 0, 0));
    panel.add(new JLabel("Resolved Data:"), new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, insets, 0, 0));
    panel.add(rawDataTreeScrollPane, new GridBagConstraints(0, 1, 1, 1, 0.5, 0.5, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, insets, 0, 0));
    panel.add(resolvedDataTreeScrollPane, new GridBagConstraints(1, 1, 1, 1, 0.5, 0.5,
            GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, insets, 0, 0));
    panel.add(rawRecordCountLabel, new GridBagConstraints(0, 2, 1, 1, 0.5, 0.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, insets, 0, 0));
    JPanel resolvedLabelPanel = new JPanel();
    resolvedLabelPanel.setLayout(new GridBagLayout());
    resolvedLabelPanel.add(resolvedRecordCountLabel, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0,
            GridBagConstraints.EAST, GridBagConstraints.BOTH, insets, 0, 0));
    resolvedLabelPanel.add(filterForSelectedCheckBox, new GridBagConstraints(1, 0, 1, 1, 0.0, 1.0,
            GridBagConstraints.WEST, GridBagConstraints.NONE, insets, 0, 0));
    panel.add(resolvedLabelPanel, new GridBagConstraints(1, 2, 1, 1, 0.5, 0.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, insets, 0, 0));
    JPanel bottomPanel = new JPanel();
    bottomPanel.setLayout(new GridBagLayout());
    bottomPanel.add(new JLabel("Parameters:"), new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, insets, 0, 0));
    bottomPanel.add(parametersTableScrollPane, new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
            GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH, insets, 0, 0));
    bottomPanel.add(resolveButton, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE, insets, 0, 0));
    panel.add(bottomPanel, new GridBagConstraints(0, 3, 2, 1, 1.0, 0.5, GridBagConstraints.NORTHWEST,
            GridBagConstraints.BOTH, insets, 0, 0));
    this.setContentPane(panel);

}

From source file:org.executequery.gui.browser.TableDataTab.java

private JPanel createCanEditTableNotePanel() {

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

    canEditTableLabel = new UpdatableLabel();
    JButton hideButton = new LinkButton(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {

            panel.setVisible(false);//w  w  w. j  ava 2  s  .com
        }
    });
    hideButton.setText("Hide");

    JButton alwaysHideButton = new LinkButton(new AbstractAction() {
        public void actionPerformed(ActionEvent e) {

            panel.setVisible(false);
            alwaysShowCanEditNotePanel = false;

            SystemProperties.setBooleanProperty(Constants.USER_PROPERTIES_KEY,
                    "browser.always.show.table.editable.label", false);

            EventMediator.fireEvent(
                    new DefaultUserPreferenceEvent(TableDataTab.this, null, UserPreferenceEvent.ALL));

        }
    });
    alwaysHideButton.setText("Always Hide");

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx++;
    gbc.weightx = 1.0;
    gbc.insets = new Insets(5, 5, 5, 5);
    gbc.anchor = GridBagConstraints.WEST;
    panel.add(canEditTableLabel, gbc);
    gbc.gridx++;
    gbc.weightx = 0;
    gbc.anchor = GridBagConstraints.EAST;
    panel.add(hideButton, gbc);
    gbc.gridx++;
    gbc.insets.left = 15;
    gbc.insets.right = 10;
    panel.add(alwaysHideButton, gbc);

    panel.setBorder(UIUtils.getDefaultLineBorder());

    return panel;
}

From source file:org.ut.biolab.medsavant.client.view.list.MasterView.java

public MasterView(String page, DetailedListModel model, DetailedView view, DetailedListEditor editor) {
    pageName = page;/*ww w . j  a va2 s. com*/
    detailedModel = model;
    detailedView = view;
    detailedEditor = editor;

    setLayout(new CardLayout());

    WaitPanel wp = new WaitPanel("Getting list");
    wp.setBackground(ViewUtil.getTertiaryMenuColor());
    add(wp, CARD_WAIT);

    showCard = new JPanel();
    add(showCard, CARD_SHOW);

    JPanel errorPanel = new JPanel();
    errorPanel.setLayout(new BorderLayout());
    errorMessage = new JLabel("An error occurred:");
    errorPanel.add(errorMessage, BorderLayout.NORTH);

    add(errorPanel, CARD_ERROR);

    buttonPanel = ViewUtil.getClearPanel();
    buttonPanel.setLayout(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridx = GridBagConstraints.RELATIVE;
    gbc.gridy = 0;
    gbc.insets = new Insets(3, 3, 3, 3);

    if (detailedEditor.doesImplementAdding()) {

        JLabel butt = ViewUtil
                .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.ADD_ON_TOOLBAR));
        butt.setToolTipText("Add");
        butt.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                detailedEditor.addItems();
                // In some cases, such as uploading/publishing variants, the addItems() method may have logged us out.
                if (LoginController.getInstance().isLoggedIn()) {
                    refreshList();
                }
            }
        });
        buttonPanel.add(butt, gbc);
    }

    if (detailedEditor.doesImplementImporting()) {

        JLabel butt = ViewUtil
                .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.IMPORT));
        butt.setToolTipText("Import");
        butt.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                detailedEditor.importItems();
                refreshList();
            }
        });
        buttonPanel.add(butt, gbc);
    }

    if (detailedEditor.doesImplementExporting()) {

        JLabel butt = ViewUtil
                .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.EXPORT));
        butt.setToolTipText("Export");
        butt.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                detailedEditor.exportItems();
                refreshList();
            }
        });
        buttonPanel.add(butt, gbc);
    }

    if (detailedEditor.doesImplementDeleting()) {
        JLabel butt = ViewUtil.createIconButton(
                IconFactory.getInstance().getIcon(IconFactory.StandardIcon.REMOVE_ON_TOOLBAR));
        butt.setToolTipText("Remove selected");
        butt.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                detailedEditor.deleteItems(selectionGrabber.getSelectedItems());
                // In some cases, such as removing/publishing variants, the deleteItems() method may have logged us out.
                if (LoginController.getInstance().isLoggedIn()) {
                    refreshList();
                }
            }
        });
        buttonPanel.add(butt, gbc);
    }

    if (detailedEditor.doesImplementEditing()) {
        JLabel butt = ViewUtil
                .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.EDIT));
        butt.setToolTipText("Edit selected");
        butt.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                if (selectionGrabber.getSelectedItems().size() > 0) {
                    detailedEditor.editItem(selectionGrabber.getSelectedItems().get(0));
                    refreshList();
                } else {
                    DialogUtils.displayMessage("Please choose one item to edit.");
                }
            }
        });
        buttonPanel.add(butt, gbc);
    }

    // Only for SavedFiltersPanel
    if (detailedEditor.doesImplementLoading()) {
        JLabel butt = ViewUtil
                .createIconButton(IconFactory.getInstance().getIcon(IconFactory.StandardIcon.LOAD_ON_TOOLBAR));
        butt.setToolTipText("Load selected");
        butt.addMouseListener(new MouseAdapter() {
            @Override
            public void mousePressed(MouseEvent e) {
                detailedEditor.loadItems(selectionGrabber.getSelectedItems());
            }
        });

        gbc.gridwidth = GridBagConstraints.REMAINDER;
        gbc.anchor = GridBagConstraints.EAST;
        buttonPanel.add(butt, gbc);
    }

    showWaitCard();
    fetchList();
}

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

/**
 * This method initializes bottomPanel//from   w ww.ja  v  a  2  s.  c o  m
 * 
 * @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:org.executequery.gui.ExecuteProcedurePanel.java

private void init() throws Exception {

    tableModel = new ParameterTableModel();
    table = new DefaultTable(tableModel);
    table.getTableHeader().setReorderingAllowed(false);
    table.setCellSelectionEnabled(true);
    table.setColumnSelectionAllowed(false);
    table.setRowSelectionAllowed(false);

    connectionsCombo = WidgetFactory.createComboBox();
    schemaCombo = WidgetFactory.createComboBox();

    combosGroup = new TableSelectionCombosGroup(connectionsCombo, schemaCombo, null);
    combosGroup.addItemSelectionListener(this);

    objectTypeCombo = WidgetFactory.createComboBox(createAvailableObjectTypes());
    objectTypeCombo.setToolTipText("Select the database object type");
    objectTypeCombo.addItemListener(this);

    proceduresModel = new DynamicComboBoxModel();
    procedureCombo = WidgetFactory.createComboBox(proceduresModel);
    procedureCombo.setActionCommand("procedureSelectionChanged");
    procedureCombo.setToolTipText("Select the database object name");
    procedureCombo.addActionListener(this);

    JPanel base = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(5, 7, 5, 8);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.gridy++;/*from   ww w . j a v  a  2 s  .c  o  m*/
    base.add(new JLabel("Connection:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.left = 0;
    base.add(connectionsCombo, gbc);
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridy++;
    gbc.insets.left = 7;
    gbc.insets.top = 0;
    base.add(new JLabel("Schema:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.left = 0;
    base.add(schemaCombo, gbc);
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridy++;
    gbc.insets.left = 7;
    gbc.insets.top = 0;
    base.add(new JLabel("Object Type:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.left = 0;
    base.add(objectTypeCombo, gbc);
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridy++;
    gbc.insets.left = 7;
    base.add(new JLabel("Object Name:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.left = 0;
    base.add(procedureCombo, gbc);

    resultsPanel = new QueryEditorResultsPanel();
    JPanel resultsBase = new JPanel(new BorderLayout());
    resultsBase.add(resultsPanel, BorderLayout.CENTER);

    JSplitPane splitPane = new SplitPaneFactory().create(JSplitPane.VERTICAL_SPLIT, new JScrollPane(table),
            resultsBase);
    splitPane.setResizeWeight(0.5);
    splitPane.setDividerLocation(0.75);
    splitPane.setDividerSize(5);

    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weighty = 1.0;
    gbc.insets.left = 7;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    base.add(splitPane, gbc);

    JButton executeButton = ActionUtilities.createButton(this, "Execute", "execute");

    gbc.gridy++;
    gbc.weighty = 0;
    gbc.fill = GridBagConstraints.NONE;
    gbc.anchor = GridBagConstraints.EAST;
    gbc.insets.top = 0;
    gbc.insets.bottom = 20;
    base.add(executeButton, gbc);

    base.setBorder(BorderFactory.createEtchedBorder());
    setBorder(BorderFactory.createEmptyBorder(5, 5, 7, 5));

    add(base, BorderLayout.CENTER);

    EventMediator.registerListener(this);

    connectionSelectionMade();
}

From source file:de.tbuchloh.kiskis.gui.SecuredElementView.java

private Component createMainTab() {
    final JPanel textFields = new JPanel(new SpringLayout());
    textFields.setBorder(LnFHelper.createDefaultBorder());

    final JLabel nameLabel = LnFHelper.createLabel(M.getString("name_label")); //$NON-NLS-1$
    nameLabel.setVerticalAlignment(SwingConstants.TOP);
    nameLabel.setLabelFor(_name);/*  w ww . j a v  a2  s.co  m*/
    textFields.add(nameLabel);
    textFields.add(_name);

    final JLabel pwdLabel = LnFHelper.createLabel(M.getString("password_label")); //$NON-NLS-1$
    pwdLabel.setVerticalAlignment(SwingConstants.TOP);
    pwdLabel.setLabelFor(_pwdField);
    textFields.add(pwdLabel);
    textFields.add(_pwdField);

    final JPanel datePanel = new JPanel();
    final GridBagBuilder builder = new GridBagBuilder(datePanel);
    builder.setAlignment(GridBagConstraints.NORTHWEST);
    builder.add(_dateField);
    builder.add(_neverBox);

    builder.setFill(GridBagConstraints.NONE);
    builder.setAlignment(GridBagConstraints.EAST);
    builder.addLast(_historyLink);
    builder.setFill(GridBagConstraints.BOTH);
    builder.setAlignment(GridBagConstraints.NORTHWEST);

    final JLabel expiresLabel = LnFHelper.createLabel(M.getString("expires_label")); //$NON-NLS-1$
    expiresLabel.setVerticalAlignment(SwingConstants.TOP);
    expiresLabel.setLabelFor(datePanel);
    textFields.add(expiresLabel);
    textFields.add(datePanel);

    SpringUtilities.makeCompactGrid(textFields, 3, 2, 5, 5, 5, 5);

    return textFields;
}

From source file:org.jets3t.gui.ItemPropertiesDialog.java

/**
 * Initialise the GUI elements to display the given item.
 *
 * @param s3Item//from  www  .ja  v  a 2 s  . c  om
 * the S3Bucket or an S3Object whose details will be displayed
 */
private void initGui(boolean isObjectBased) {
    // Initialise skins factory.
    skinsFactory = SkinsFactory.getInstance(applicationProperties);

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

    this.setResizable(true);
    this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);

    JPanel commonPropertiesContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesCommonPanel");
    commonPropertiesContainer.setLayout(new GridBagLayout());
    JPanel metadataContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesMetadataPanel");
    metadataContainer.setLayout(new GridBagLayout());
    JPanel grantsContainer = skinsFactory.createSkinnedJPanel("ItemPropertiesGrantsPanel");
    grantsContainer.setLayout(new GridBagLayout());

    if (!isObjectBased) {
        // Display bucket details.
        JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel");
        bucketNameLabel.setText("Bucket name:");
        bucketNameTextField = skinsFactory.createSkinnedJTextField("BucketNameTextField");
        bucketNameTextField.setEditable(false);
        JLabel bucketLocationLabel = skinsFactory.createSkinnedJHtmlLabel("BucketLocationLabel");
        bucketLocationLabel.setText("Location:");
        bucketLocationTextField = skinsFactory.createSkinnedJTextField("BucketLocationTextField");
        bucketLocationTextField.setEditable(false);
        JLabel bucketCreationDateLabel = skinsFactory.createSkinnedJHtmlLabel("BucketCreationDateLabel");
        bucketCreationDateLabel.setText("Creation date:");
        bucketCreationDateTextField = skinsFactory.createSkinnedJTextField("BucketCreationDateTextField");
        bucketCreationDateTextField.setEditable(false);
        ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel");
        ownerNameLabel.setText("Owner name:");
        ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField");
        ownerNameTextField.setEditable(false);
        ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel");
        ownerIdLabel.setText("Owner ID:");
        ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField");
        ownerIdTextField.setEditable(false);

        bucketIsRequesterPaysLabel = skinsFactory.createSkinnedJHtmlLabel("BucketIsRequesterPaysLabel");
        bucketIsRequesterPaysLabel.setText("Requester Pays?");
        bucketIsRequesterPaysCheckBox = skinsFactory.createSkinnedJCheckBox("BucketIsRequesterPaysCheckBox");
        bucketIsRequesterPaysCheckBox.setEnabled(false);

        int row = 0;
        commonPropertiesContainer.add(bucketNameLabel, new GridBagConstraints(0, row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(bucketNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(bucketLocationLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(bucketLocationTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(bucketCreationDateLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(bucketCreationDateTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(bucketIsRequesterPaysLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(bucketIsRequesterPaysCheckBox, new GridBagConstraints(1, row, 1, 1, 0, 0,
                GridBagConstraints.WEST, GridBagConstraints.NONE, insetsDefault, 0, 0));

        commonPropertiesContainer.add(ownerNameLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(ownerNameTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(ownerIdLabel, new GridBagConstraints(0, ++row, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(ownerIdTextField, new GridBagConstraints(1, row, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    } else {
        // Display object details.
        JLabel objectKeyLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectKeyLabel");
        objectKeyLabel.setText("Object key:");
        objectKeyTextField = skinsFactory.createSkinnedJTextField("ObjectKeyTextField");
        objectKeyTextField.setEditable(false);
        JLabel objectContentTypeLabel = skinsFactory.createSkinnedJHtmlLabel("ContentTypeLabel");
        objectContentTypeLabel.setText("Content type:");
        objectContentTypeTextField = skinsFactory.createSkinnedJTextField("ContentTypeTextField");
        objectContentTypeTextField.setEditable(false);
        JLabel objectContentLengthLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectContentLengthLabel");
        objectContentLengthLabel.setText("Size:");
        objectContentLengthTextField = skinsFactory.createSkinnedJTextField("ObjectContentLengthTextField");
        objectContentLengthTextField.setEditable(false);
        JLabel objectLastModifiedLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectLastModifiedLabel");
        objectLastModifiedLabel.setText("Last modified:");
        objectLastModifiedTextField = skinsFactory.createSkinnedJTextField("ObjectLastModifiedTextField");
        objectLastModifiedTextField.setEditable(false);
        JLabel objectETagLabel = skinsFactory.createSkinnedJHtmlLabel("ObjectETagLabel");
        objectETagLabel.setText("ETag:");
        objectETagTextField = skinsFactory.createSkinnedJTextField("ObjectETagTextField");
        objectETagTextField.setEditable(false);
        JLabel bucketNameLabel = skinsFactory.createSkinnedJHtmlLabel("BucketNameLabel");
        bucketNameLabel.setText("Bucket name:");
        bucketNameTextField = skinsFactory.createSkinnedJTextField("BucketNameTextField");
        bucketNameTextField.setEditable(false);
        ownerNameLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerNameLabel");
        ownerNameLabel.setText("Owner name:");
        ownerNameTextField = skinsFactory.createSkinnedJTextField("OwnerNameTextField");
        ownerNameTextField.setEditable(false);
        ownerIdLabel = skinsFactory.createSkinnedJHtmlLabel("OwnerIdLabel");
        ownerIdLabel.setText("Owner ID:");
        ownerIdTextField = skinsFactory.createSkinnedJTextField("OwnerIdTextField");
        ownerIdTextField.setEditable(false);

        commonPropertiesContainer.add(objectKeyLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(objectKeyTextField, new GridBagConstraints(1, 0, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(objectContentTypeLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(objectContentTypeTextField, new GridBagConstraints(1, 1, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(objectContentLengthLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(objectContentLengthTextField, new GridBagConstraints(1, 2, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(objectLastModifiedLabel, new GridBagConstraints(0, 3, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(objectLastModifiedTextField, new GridBagConstraints(1, 3, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(objectETagLabel, new GridBagConstraints(0, 4, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(objectETagTextField, new GridBagConstraints(1, 4, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(bucketNameLabel, new GridBagConstraints(0, 5, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(bucketNameTextField, new GridBagConstraints(1, 5, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(ownerNameLabel, new GridBagConstraints(0, 7, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(ownerNameTextField, new GridBagConstraints(1, 7, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        commonPropertiesContainer.add(ownerIdLabel, new GridBagConstraints(0, 8, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsDefault, 0, 0));
        commonPropertiesContainer.add(ownerIdTextField, new GridBagConstraints(1, 8, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

        // Build metadata table.
        objectMetadataTableModel = new DefaultTableModel(new Object[] { "Name", "Value" }, 0) {
            private static final long serialVersionUID = -3762866886166776851L;

            @Override
            public boolean isCellEditable(int row, int column) {
                return false;
            }
        };
        TableSorter metadataTableSorter = new TableSorter(objectMetadataTableModel);
        JTable metadataTable = skinsFactory.createSkinnedJTable("MetadataTable");
        metadataTable.setModel(metadataTableSorter);
        metadataTableSorter.setTableHeader(metadataTable.getTableHeader());
        metadataContainer.add(new JScrollPane(metadataTable), new GridBagConstraints(0, 0, 1, 1, 1, 1,
                GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0));
    }

    // Build grants table.
    grantsTableModel = new DefaultTableModel(new Object[] { "Grantee", "Permission" }, 0) {
        private static final long serialVersionUID = -5882427163845726770L;

        @Override
        public boolean isCellEditable(int row, int column) {
            return false;
        }
    };
    TableSorter grantsTableSorter = new TableSorter(grantsTableModel);
    grantsTable = skinsFactory.createSkinnedJTable("GrantsTable");
    grantsTable.setModel(grantsTableSorter);
    grantsTableSorter.setTableHeader(grantsTable.getTableHeader());
    grantsContainer.add(new JScrollPane(grantsTable), new GridBagConstraints(0, 0, 1, 1, 1, 1,
            GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsDefault, 0, 0));

    // OK Button.
    JButton okButton = skinsFactory.createSkinnedJButton("ItemPropertiesOKButton");
    okButton.setText("Finished");
    okButton.setActionCommand("OK");
    okButton.addActionListener(this);

    // Set default ENTER button.
    this.getRootPane().setDefaultButton(okButton);

    // Put it all together.
    int row = 0;
    JPanel container = skinsFactory.createSkinnedJPanel("ItemPropertiesPanel");
    container.setLayout(new GridBagLayout());
    container.add(commonPropertiesContainer, new GridBagConstraints(0, row++, 1, 1, 1, 0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
    if (isObjectBased) {

        if (includeMetadata) {
            JHtmlLabel metadataLabel = skinsFactory.createSkinnedJHtmlLabel("MetadataLabel");
            metadataLabel.setText("<html><b>Metadata</b></html>");
            metadataLabel.setHorizontalAlignment(JLabel.CENTER);
            container.add(metadataLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                    GridBagConstraints.HORIZONTAL, insetsVerticalSpace, 0, 0));
            container.add(metadataContainer, new GridBagConstraints(0, row++, 1, 1, 1, 1,
                    GridBagConstraints.CENTER, GridBagConstraints.BOTH, insetsZero, 0, 0));
        }

        // Object previous and next buttons, if we have multiple objects.
        previousObjectButton = skinsFactory.createSkinnedJButton("ItemPropertiesPreviousButton");
        previousObjectButton.setText("Previous");
        previousObjectButton.addActionListener(this);
        previousObjectButton.setEnabled(false);
        nextObjectButton = skinsFactory.createSkinnedJButton("ItemPropertiesNextButton");
        nextObjectButton.setText("Next");
        nextObjectButton.addActionListener(this);
        nextObjectButton.setEnabled(false);
        currentObjectLabel = skinsFactory.createSkinnedJHtmlLabel("ItemPropertiesCurrentObjectLabel");
        currentObjectLabel.setHorizontalAlignment(JLabel.CENTER);

        nextPreviousPanel = skinsFactory.createSkinnedJPanel("ItemPropertiesNextPreviousPanel");
        nextPreviousPanel.setLayout(new GridBagLayout());
        nextPreviousPanel.add(previousObjectButton, new GridBagConstraints(0, 0, 1, 1, 0, 0,
                GridBagConstraints.WEST, GridBagConstraints.NONE, insetsZero, 0, 0));
        nextPreviousPanel.add(currentObjectLabel, new GridBagConstraints(1, 0, 1, 1, 1, 0,
                GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
        nextPreviousPanel.add(nextObjectButton, new GridBagConstraints(2, 0, 1, 1, 0, 0,
                GridBagConstraints.EAST, GridBagConstraints.NONE, insetsZero, 0, 0));

        container.add(nextPreviousPanel, new GridBagConstraints(0, row, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, insetsZero, 0, 0));
        row++;
    } else {
        JHtmlLabel grantsLabel = skinsFactory.createSkinnedJHtmlLabel("GrantsLabel");
        grantsLabel.setText("<html><b>Permissions</b></html>");
        grantsLabel.setHorizontalAlignment(JLabel.CENTER);
        container.add(grantsLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
                GridBagConstraints.HORIZONTAL, insetsVerticalSpace, 0, 0));
        container.add(grantsContainer, new GridBagConstraints(0, row++, 1, 1, 1, 1, GridBagConstraints.CENTER,
                GridBagConstraints.BOTH, insetsZero, 0, 0));
    }
    container.add(okButton, new GridBagConstraints(0, row++, 3, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsZero, 0, 0));
    this.getContentPane().add(container);

    this.pack();
    if (isObjectBased) {
        this.setSize(400, (includeMetadata ? 550 : 400));
    }
    this.setLocationRelativeTo(this.getOwner());
}