Example usage for java.awt GridBagConstraints HORIZONTAL

List of usage examples for java.awt GridBagConstraints HORIZONTAL

Introduction

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

Prototype

int HORIZONTAL

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

Click Source Link

Document

Resize the component horizontally but not vertically.

Usage

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

/**
 * Cre le panel d'un onglet associ  une classe
 * //  w  w w  . ja  v  a 2  s . c om
 * @param cc ClasseCompte la classe des comptes
 * @return JPanel le JPanel associ
 */
private JPanel initClassePanel(ClasseCompte cc) {

    final JPanel panelTmp = new JPanel();
    long totalDebitClasse = 0;
    long totalCreditClasse = 0;

    panelTmp.setLayout(new GridBagLayout());
    panelTmp.setOpaque(false);
    final GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(2, 2, 1, 2);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 1;
    c.weighty = 0;

    // Rcupration des comptes de la classe avec le total
    SQLBase base = ((ComptaPropsConfiguration) Configuration.getInstance()).getSQLBaseSociete();
    SQLTable compteTable = base.getTable("COMPTE_PCE");
    SQLTable ecritureTable = base.getTable("ECRITURE");

    SQLSelect sel = new SQLSelect(base);
    sel.addSelect(compteTable.getKey());
    sel.addSelect(compteTable.getField("NUMERO"));
    sel.addSelect(compteTable.getField("NOM"));
    sel.addSelect(ecritureTable.getField("DEBIT"), "SUM");
    sel.addSelect(ecritureTable.getField("CREDIT"), "SUM");

    String function = "REGEXP";
    String match = cc.getTypeNumeroCompte();
    if (Configuration.getInstance().getBase().getServer().getSQLSystem() == SQLSystem.POSTGRESQL) {
        // function = "SIMILAR TO";
        function = "~";
        // match = cc.getTypeNumeroCompte().replace(".*", "%");
    }

    Where w = new Where(compteTable.getField("NUMERO"), function, match);
    Where w2 = new Where(ecritureTable.getField("ID_COMPTE_PCE"), "=", compteTable.getKey());

    if (!UserManager.getInstance().getCurrentUser().getRights()
            .haveRight(ComptaUserRight.ACCES_NOT_RESCTRICTED_TO_411)) {
        // TODO Show Restricted acces in UI
        w = w.and(new Where(ecritureTable.getField("COMPTE_NUMERO"), "LIKE", "411%"));
    }

    sel.setWhere(w.and(w2));

    String req = sel.asString()
            + " GROUP BY \"COMPTE_PCE\".\"ID\",\"COMPTE_PCE\".\"NUMERO\",\"COMPTE_PCE\".\"NOM\" ORDER BY \"COMPTE_PCE\".\"NUMERO\"";
    System.out.println(req);

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

    List myList = (List) ob;

    JLabel labelTotalClasse = new JLabel();
    labelTotalClasse.setOpaque(false);
    if (myList.size() != 0) {

        /***************************************************************************************
         * Cration des Panels de chaque compte
         **************************************************************************************/
        // c.weighty = 1;
        for (int i = 0; i < myList.size(); i++) {

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

            final Compte compteTmp = new Compte(((Number) objTmp[0]).intValue(), objTmp[1].toString(),
                    objTmp[2].toString(), "", ((Number) objTmp[3]).longValue(),
                    ((Number) objTmp[4]).longValue());

            c.fill = GridBagConstraints.HORIZONTAL;
            c.weightx = 1;
            c.weighty = 0;
            c.gridx = 0;
            c.gridy++;
            panelTmp.add(creerComptePanel(compteTmp), c);

            // calcul du total de la classe
            totalDebitClasse += compteTmp.getTotalDebit();
            totalCreditClasse += compteTmp.getTotalCredit();
        }

        // Total de la classe
        labelTotalClasse.setText(
                "Total Classe " + cc.getNom() + " Dbit : " + GestionDevise.currencyToString(totalDebitClasse)
                        + " Crdit : " + GestionDevise.currencyToString(totalCreditClasse));

    } else {
        labelTotalClasse.setHorizontalAlignment(SwingConstants.CENTER);
        labelTotalClasse.setText("Aucune criture pour la classe " + cc.getNom());
    }
    c.gridy++;
    c.weighty = 1;
    panelTmp.add(labelTotalClasse, c);

    return panelTmp;
}

From source file:net.sf.mzmine.modules.peaklistmethods.peakpicking.adap3decompositionV2.ADAP3DecompositionV2SetupDialog.java

/** Creates the interface elements */
@Override//from  w w  w .j  a v a 2  s .co m
protected void addDialogComponents() {
    super.addDialogComponents();

    comboClustersModel = new DefaultComboBoxModel<>();

    PeakList[] peakLists = MZmineCore.getDesktop().getSelectedPeakLists();

    // -----------------------------
    // Panel with preview UI elements
    // -----------------------------

    // Preview CheckBox
    chkPreview = new JCheckBox("Show preview");
    chkPreview.addActionListener(this);
    chkPreview.setHorizontalAlignment(SwingConstants.CENTER);
    chkPreview.setEnabled(peakLists != null && peakLists.length > 0);

    // Preview panel that will contain ComboBoxes
    final JPanel panel = new JPanel(new BorderLayout());
    panel.add(new JSeparator(), BorderLayout.NORTH);
    panel.add(chkPreview, BorderLayout.CENTER);
    panel.add(Box.createVerticalStrut(10), BorderLayout.SOUTH);
    pnlUIElements = new JPanel(new BorderLayout());
    pnlUIElements.add(panel, BorderLayout.NORTH);

    // ComboBox with Clusters
    cboClusters = new JComboBox<>(comboClustersModel);
    cboClusters.setFont(COMBO_FONT);
    cboClusters.addActionListener(this);

    pnlComboBoxes = GUIUtils.makeTablePanel(1, 2, new JComponent[] { new JLabel("Clusters"), cboClusters });

    // --------------------------------------------------------------------
    // ----- Panel with plots --------------------------------------
    // --------------------------------------------------------------------

    pnlPlots = new JPanel();
    pnlPlots.setLayout(new BoxLayout(pnlPlots, BoxLayout.Y_AXIS));

    // Plot with retention-time clusters
    retTimeMZPlot = new SimpleScatterPlot("Retention time", "m/z");
    retTimeMZPlot.setMinimumSize(MIN_DIMENSIONS);

    final JPanel pnlPlotRetTimeClusters = new JPanel(new BorderLayout());
    pnlPlotRetTimeClusters.setBackground(Color.white);
    pnlPlotRetTimeClusters.add(retTimeMZPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotRetTimeClusters, 10);

    // Plot with chromatograms
    retTimeIntensityPlot = new EICPlot();
    retTimeIntensityPlot.setMinimumSize(MIN_DIMENSIONS);

    JPanel pnlPlotShapeClusters = new JPanel(new BorderLayout());
    pnlPlotShapeClusters.setBackground(Color.white);
    pnlPlotShapeClusters.add(retTimeIntensityPlot, BorderLayout.CENTER);
    GUIUtils.addMarginAndBorder(pnlPlotShapeClusters, 10);

    pnlPlots.add(pnlPlotRetTimeClusters);
    pnlPlots.add(pnlPlotShapeClusters);

    super.mainPanel.add(pnlUIElements, 0, super.getNumberOfParameters() + 3, 2, 1, 0, 0,
            GridBagConstraints.HORIZONTAL);
}

From source file:com.sec.ose.osi.ui.frm.main.report.JPanBillOfMaterials.java

private JPanel getJPanelOptions() {
    if (jPanelOptions == null) {
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridx = 1;//from  www.j  av  a 2  s  .c  om
        gridBagConstraints3.fill = GridBagConstraints.BOTH;
        gridBagConstraints3.insets = new Insets(0, 0, 10, 0);
        gridBagConstraints3.gridy = 1;
        jLabelSelectedComponent = new JLabel();
        jLabelSelectedComponent.setText("Display files for the selected components");
        jLabelSelectedComponent.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                eventHandler.handleEvent(EventHandler.RADIO_SELECTED_COMPONENT);

            }
        });
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 0;
        gridBagConstraints2.insets = new Insets(0, 10, 10, 0);
        gridBagConstraints2.gridy = 1;
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.gridx = 1;
        gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints1.insets = new Insets(10, 0, 10, 0);
        gridBagConstraints1.gridwidth = 1;
        gridBagConstraints1.gridy = 0;
        jLabelAllFiles = new JLabel();
        jLabelAllFiles.addMouseListener(new MouseAdapter() {
            public void mouseClicked(MouseEvent e) {
                eventHandler.handleEvent(EventHandler.RADIO_ALL_FILES);

            }
        });

        jLabelAllFiles.setText("Display all files for all components");
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.insets = new Insets(0, 10, 0, 0);
        gridBagConstraints.gridy = 0;
        jPanelOptions = new JPanel();
        jPanelOptions.setLayout(new GridBagLayout());
        jPanelOptions.add(getJRadioAllFilesForAll(), gridBagConstraints);
        jPanelOptions.add(jLabelAllFiles, gridBagConstraints1);
        jPanelOptions.add(getJRadioAllFilesForSelectedComponent(), gridBagConstraints2);
        jPanelOptions.add(jLabelSelectedComponent, gridBagConstraints3);
    }
    return jPanelOptions;
}

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

/**
 * This method initializes jPanelPjtList   
 *    /*from w w w.j  a v  a  2 s .co  m*/
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelPjtList() {
    if (jPanelPjtList == null) {
        GridBagConstraints gridBagConstraints3 = new GridBagConstraints();
        gridBagConstraints3.gridy = 1;
        gridBagConstraints3.fill = GridBagConstraints.BOTH;
        gridBagConstraints3.gridwidth = 2;
        gridBagConstraints3.weighty = 0.1;
        gridBagConstraints3.insets = new Insets(0, 10, 10, 10);
        gridBagConstraints3.ipadx = 0;
        gridBagConstraints3.weightx = 0.1;
        gridBagConstraints3.gridx = 0;
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.insets = new Insets(10, 10, 10, 0);
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.weightx = 0.1;
        gridBagConstraints1.insets = new Insets(10, 10, 10, 10);
        gridBagConstraints1.ipadx = 0;
        gridBagConstraints1.ipady = 0;
        gridBagConstraints1.gridx = 1;
        jLabelFilter = new JLabel();
        jLabelFilter.setText("Filter :");
        jPanelPjtList = new JPanel();
        jPanelPjtList.setLayout(new GridBagLayout());
        jPanelPjtList.setBorder(BorderFactory.createTitledBorder(null, "Project List",
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelPjtList.add(jLabelFilter, gridBagConstraints2);
        jPanelPjtList.add(getJTextFieldFilter(), gridBagConstraints1);
        jPanelPjtList.add(getJScrollPanePjtList(), gridBagConstraints3);
    }
    return jPanelPjtList;
}

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

/**
 * This method initializes jPanelPjtName   
 *    /*from   w ww  .  ja va2  s .c  o  m*/
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelPjtName() {
    if (jPanelPjtName == null) {
        GridBagConstraints gridBagConstraints = new GridBagConstraints();
        gridBagConstraints.gridx = 0;
        gridBagConstraints.insets = new Insets(10, 10, 0, 0);
        gridBagConstraints.ipadx = 4;
        gridBagConstraints.gridy = 0;
        jLabelNewProjectName = new JLabel();
        jLabelNewProjectName.setText("New Project Name :");
        GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
        gridBagConstraints7.anchor = GridBagConstraints.CENTER;
        gridBagConstraints7.insets = new Insets(10, 10, 10, 0);
        gridBagConstraints7.gridwidth = 1;
        gridBagConstraints7.gridx = 1;
        gridBagConstraints7.gridy = 1;
        gridBagConstraints7.weightx = 0.1;
        gridBagConstraints7.fill = GridBagConstraints.HORIZONTAL;
        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        gridBagConstraints6.anchor = GridBagConstraints.EAST;
        gridBagConstraints6.gridx = 0;
        gridBagConstraints6.gridy = 1;
        gridBagConstraints6.ipadx = 0;
        gridBagConstraints6.insets = new Insets(10, 10, 10, 0);
        GridBagConstraints gridBagConstraints2 = new GridBagConstraints();
        gridBagConstraints2.gridx = 2;
        gridBagConstraints2.insets = new Insets(10, 10, 0, 10);
        gridBagConstraints2.fill = GridBagConstraints.NONE;
        gridBagConstraints2.gridy = 0;
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.fill = GridBagConstraints.BOTH;
        gridBagConstraints1.gridy = 0;
        gridBagConstraints1.weightx = 0.1;
        gridBagConstraints1.gridwidth = 1;
        gridBagConstraints1.insets = new Insets(10, 10, 0, 0);
        gridBagConstraints1.gridx = 1;
        jPanelPjtName = new JPanel();
        jPanelPjtName.setLayout(new GridBagLayout());
        jPanelPjtName.setPreferredSize(new Dimension(500, 200));
        jPanelPjtName.setBorder(BorderFactory.createTitledBorder(null, "Project Name",
                TitledBorder.DEFAULT_JUSTIFICATION, TitledBorder.DEFAULT_POSITION,
                new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
        jPanelPjtName.add(getJTextFieldNewProjectName(), gridBagConstraints1);
        jPanelPjtName.add(getJButtonCheck(), gridBagConstraints2);
        jPanelPjtName.add(getJCheckBoxClonedFrom(), gridBagConstraints6);
        jPanelPjtName.add(getJComboBoxClonedFrom(), gridBagConstraints7);
        jPanelPjtName.add(jLabelNewProjectName, gridBagConstraints);
    }
    return jPanelPjtName;
}

From source file:org.executequery.gui.ExportResultSetPanel.java

private void init() throws Exception {

    fileNameField = WidgetFactory.createTextField();
    connectionsCombo = WidgetFactory.createComboBox();

    String[] delims = { "|", ",", ";", "#" };
    delimiterCombo = WidgetFactory.createComboBox(delims);
    delimiterCombo.setEditable(true);/*from   w w  w .ja v  a2  s.co m*/

    combosGroup = new TableSelectionCombosGroup(connectionsCombo);

    includeColumNamesCheck = new JCheckBox("Include column names as first row");

    sqlText = new SimpleSqlTextPanel();
    //        sqlText.getTextPane().setBackground(Color.WHITE);
    sqlText.setBorder(null);
    sqlText.setScrollPaneBorder(BorderFactory.createMatteBorder(1, 1, 0, 1, UIUtils.getDefaultBorderColour()));

    statusBar = new SqlTextPaneStatusBar();
    JPanel sqlPanel = new JPanel(new BorderLayout());
    sqlPanel.add(sqlText, BorderLayout.CENTER);
    sqlPanel.add(statusBar, BorderLayout.SOUTH);
    statusBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 1));

    outputPanel = new LoggingOutputPanel();
    FlatSplitPane splitPane = new FlatSplitPane(JSplitPane.VERTICAL_SPLIT, sqlPanel, outputPanel);
    splitPane.setResizeWeight(0.5);
    splitPane.setDividerLocation(0.8);
    splitPane.setDividerSize(5);

    JButton button = WidgetFactory.createInlineFieldButton("Browse");
    button.setActionCommand("browse");
    button.addActionListener(this);
    button.setMnemonic('r');

    JPanel mainPanel = new JPanel(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridy = 0;
    gbc.gridx = 0;
    gbc.gridheight = 1;
    gbc.insets.top = 5;
    gbc.insets.bottom = 5;
    gbc.insets.right = 5;
    gbc.insets.left = 5;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    mainPanel.add(new JLabel("Connection:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(connectionsCombo, gbc);
    gbc.insets.left = 5;
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 0;
    mainPanel.add(new JLabel("Data Delimiter:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(delimiterCombo, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 2;
    mainPanel.add(new JLabel("Output File:"), gbc);
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(fileNameField, gbc);
    gbc.gridx = 2;
    gbc.weightx = 0;
    gbc.insets.left = 0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(button, gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weightx = 0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets.top = 2;
    gbc.insets.left = 5;
    mainPanel.add(includeColumNamesCheck, gbc);
    gbc.gridy++;
    gbc.insets.bottom = 10;
    mainPanel.add(new JLabel(instructionNote()), gbc);

    gbc.gridy++;
    gbc.gridx = 0;
    gbc.weighty = 1.0;
    gbc.weightx = 1.0;
    gbc.insets.top = 0;
    gbc.insets.left = 5;
    gbc.insets.bottom = 5;
    gbc.fill = GridBagConstraints.BOTH;
    mainPanel.add(splitPane, gbc);

    mainPanel.setBorder(BorderFactory.createEtchedBorder());

    int minimumButtonWidth = 85;
    executeButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Execute", "executeAndExport");
    stopButton = new MinimumWidthActionButton(minimumButtonWidth, this, "Stop", "stop");
    JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT, 2, 5));
    buttonPanel.add(executeButton);
    buttonPanel.add(stopButton);

    stopButton.setEnabled(false);

    add(mainPanel, BorderLayout.CENTER);
    add(buttonPanel, BorderLayout.SOUTH);
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));

    // register as a keyword and connection listener
    EventMediator.registerListener(this);

    JTextPane textPane = sqlText.getTextPane();
    ActionMap actionMap = textPane.getActionMap();

    String actionKey = "executeQueryAction";
    actionMap.put(actionKey, executeQueryAction);

    InputMap inputMap = textPane.getInputMap();
    inputMap.put(EXECUTE_KEYSTROKE, actionKey);

    JPopupMenu popupMenu = sqlText.getPopup();
    popupMenu.addSeparator();
    popupMenu.add(executeQueryAction);
}

From source file:org.executequery.gui.drivers.AbstractDriverPanel.java

private void init() {

    ReflectiveAction action = new ReflectiveAction(this);

    JButton browseButton = new DefaultButton(action, getString("AbstractDriverPanel.addLibraryButton"),
            "browseDrivers");
    JButton removeButton = new DefaultButton(action, getString("AbstractDriverPanel.addRemoveButton"),
            "removeDrivers");

    JButton findButton = new DefaultInlineFieldButton(action);
    findButton.setText(getString("AbstractDriverPanel.addFindButton"));
    findButton.setActionCommand("findDriverClass");

    jarPathListModel = new DefaultListModel();

    nameField = textFieldWithKey("AbstractDriverPanel.driverNameToolTip");
    descField = textFieldWithKey("AbstractDriverPanel.descriptionToolTip");
    //        classField = textFieldWithKey("AbstractDriverPanel.classNameToolTip");

    classComboModel = new DynamicComboBoxModel();
    classField = WidgetFactory.createComboBox(classComboModel);
    classField.setToolTipText(getString("AbstractDriverPanel.classNameToolTip"));
    classField.setEditable(true);//from   w  ww. j av a 2 s. c o  m

    jarPathList = new JList(jarPathListModel);
    jarPathList.setToolTipText(getString("AbstractDriverPanel.pathToolTip"));
    JScrollPane jarPathListScrollPane = new JScrollPane(jarPathList) {
        private int height = 120;

        @Override
        public Dimension getPreferredSize() {

            Dimension size = super.getPreferredSize();
            size.height = height;
            return size;
        }

        @Override
        public Dimension getMinimumSize() {

            Dimension size = super.getMinimumSize();
            size.height = height;
            return size;
        }
    };

    nameField.addFocusListener(new DriverNameFieldListener(this));

    databaseNameCombo = WidgetFactory.createComboBox(createDatabaseComboValues());
    databaseNameCombo.setToolTipText(getString("AbstractDriverPanel.databaseToolTip"));
    databaseNameCombo.addItemListener(this);

    urlComboModel = new DynamicComboBoxModel();
    driverUrlCombo = WidgetFactory.createComboBox(urlComboModel);
    driverUrlCombo.setToolTipText(getString("AbstractDriverPanel.jdbcUrlToolTip"));
    driverUrlCombo.setEditable(true);

    JPanel base = new TextFieldPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridy++;
    gbc.insets = new Insets(10, 10, 5, 0);
    gbc.anchor = GridBagConstraints.NORTHWEST;
    base.add(labelWithKey("AbstractDriverPanel.driverNameLabel"), gbc);
    gbc.gridy++;
    gbc.insets.top = 0;
    base.add(labelWithKey("AbstractDriverPanel.descriptionLabel"), gbc);
    gbc.gridy++;
    base.add(labelWithKey("AbstractDriverPanel.databaseLabel"), gbc);
    gbc.gridy++;
    base.add(labelWithKey("AbstractDriverPanel.jdbcUrlLabel"), gbc);
    gbc.gridy++;
    base.add(labelWithKey("AbstractDriverPanel.pathLabel"), gbc);
    gbc.gridy += 4;
    base.add(labelWithKey("AbstractDriverPanel.classNameLabel"), gbc);
    gbc.gridy = 0;
    gbc.gridx = 1;
    gbc.insets.right = 10;
    gbc.insets.top = 10;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    base.add(nameField, gbc);
    gbc.gridy++;
    gbc.insets.top = 0;
    base.add(descField, gbc);
    gbc.gridy++;
    base.add(databaseNameCombo, gbc);
    gbc.gridy++;
    base.add(driverUrlCombo, gbc);
    gbc.gridy++;
    gbc.gridwidth = 1;
    gbc.insets.right = 0;
    gbc.gridheight = 2;
    gbc.insets.top = 5;
    base.add(jarPathListScrollPane, gbc);
    gbc.gridx = 2;
    gbc.weightx = 0;
    gbc.insets.right = 10;
    gbc.gridheight = 1;
    gbc.insets.left = 5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    base.add(browseButton, gbc);
    gbc.gridy++;
    gbc.insets.top = 0;
    base.add(removeButton, gbc);

    gbc.gridy += 3;
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.insets.right = 0;
    gbc.insets.left = 10;
    gbc.insets.top = 0;
    base.add(classField, gbc);
    gbc.gridx = 2;
    gbc.weightx = 0;
    gbc.weighty = 1.0;
    gbc.insets.right = 10;
    gbc.insets.left = 5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    base.add(findButton, gbc);

    add(base, BorderLayout.CENTER);
}

From source file:com.db4o.sync4o.ui.Db4oSyncSourceConfigPanel.java

private void setupControls() {

    // Layout and setup UI components...

    setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
    add(_namePanel);//  w  w  w.jav a2 s.  c  o  m
    _namePanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(_fieldsPanel);
    _fieldsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
    add(_classConfigsTree);
    _classConfigsTree.setAlignmentX(Component.LEFT_ALIGNMENT);
    _classConfigsTree.setPreferredSize(new Dimension(300, 300));
    add(_buttonsPanel);
    _buttonsPanel.setAlignmentX(Component.LEFT_ALIGNMENT);

    JLabel l;

    // Admin UI Management Panels use a title
    // (in a particular "title font") to identify themselves
    l = new JLabel("Edit Db4oSyncSource Configuration", SwingConstants.CENTER);
    l.setBorder(new TitledBorder(""));
    l.setFont(titlePanelFont);
    _namePanel.add(l);

    GridBagConstraints labelConstraints = new GridBagConstraints();
    labelConstraints.gridwidth = 1;
    labelConstraints.fill = GridBagConstraints.NONE;
    labelConstraints.weightx = 0.0;
    labelConstraints.gridx = 0;
    labelConstraints.gridy = 0;
    labelConstraints.anchor = GridBagConstraints.EAST;

    GridBagConstraints fieldConstraints = new GridBagConstraints();
    fieldConstraints.gridwidth = 2;
    fieldConstraints.fill = GridBagConstraints.HORIZONTAL;
    fieldConstraints.weightx = 1.0;
    fieldConstraints.gridx = 1;
    fieldConstraints.gridy = 0;

    _fieldsPanel.add(new JLabel("Source URI: "), labelConstraints);
    _fieldsPanel.add(_sourceUriValue, fieldConstraints);

    labelConstraints.gridy = GridBagConstraints.RELATIVE;
    fieldConstraints.gridy = GridBagConstraints.RELATIVE;

    _fieldsPanel.add(new JLabel("Name: "), labelConstraints);
    _fieldsPanel.add(_nameValue, fieldConstraints);

    fieldConstraints.gridwidth = 1;

    _fieldsPanel.add(new JLabel("db4o File: "), labelConstraints);
    _fieldsPanel.add(_dbFileValue, fieldConstraints);

    _dbFileValue.setEditable(false);

    fieldConstraints.gridwidth = 2;

    GridBagConstraints buttonConstraints = new GridBagConstraints();
    buttonConstraints.gridwidth = 1;
    buttonConstraints.fill = GridBagConstraints.NONE;
    buttonConstraints.gridx = 2;
    buttonConstraints.gridy = 3;
    _dbFileLocateButton.setText("...");
    _fieldsPanel.add(_dbFileLocateButton, buttonConstraints);

    buttonConstraints.gridwidth = 3;
    buttonConstraints.fill = GridBagConstraints.NONE;
    buttonConstraints.gridx = 0;
    buttonConstraints.gridy = GridBagConstraints.RELATIVE;
    buttonConstraints.anchor = GridBagConstraints.CENTER;

    // Ensure all the controls use the Admin UI standard font
    Component[] components = _fieldsPanel.getComponents();
    for (int i = 0; i < components.length; i++) {

        Component c = components[i];
        c.setFont(defaultFont);

    }

    _confirmButton.setText("Add");
    _buttonsPanel.add(_confirmButton);

}

From source file:org.intermine.install.swing.NewDerivedTypeDialog.java

/**
 * Common initialisation: lays out the child components and wires up the necessary
 * event listeners. //from  w w  w  .ja  v a  2 s  .  co  m
 */
private void init() {
    setName("New Derived Type Dialog");
    setTitle(Messages.getMessage("source.derived.title"));
    progressDialog.setTitle(Messages.getMessage("makesource.title"));

    nameField.setEnabled(false);
    typeField.setEnabled(false);

    buttonPanel = new ButtonPanel(createAction, new CancelAction());

    progressDialog.setInformationLabel(Messages.getMessage("makesource.message"));
    progressDialog.pack();

    Container cp = getContentPane();
    GridBagConstraints cons = GridBagHelper.setup(cp);

    cp.add(new JLabel(Messages.getMessage("source.name")), cons);

    cons.gridy++;
    cp.add(new JLabel(Messages.getMessage("source.derived.parent")), cons);

    cons.gridy++;
    cp.add(new JLabel(Messages.getMessage("source.derived.type")), cons);

    cons.gridy = 0;
    cons.gridx++;
    cons.weightx = 1;
    cp.add(nameField, cons);

    cons.gridy++;
    cp.add(typeField, cons);

    cons.gridy++;
    cp.add(derivedTypeField, cons);

    cons.gridx = 0;
    cons.gridy++;
    cons.gridwidth = GridBagConstraints.REMAINDER;
    cons.weighty = 1;
    cons.fill = GridBagConstraints.BOTH;
    cp.add(spacerPanel, cons);

    cons.gridy++;
    cons.weighty = 0;
    cons.fill = GridBagConstraints.HORIZONTAL;
    cp.add(buttonPanel, cons);

    derivedTypeField.getDocument().addDocumentListener(new DerivedTypeDocumentListener());

    pack();
}

From source file:coolmap.canvas.datarenderer.renderer.impl.NumberToColor.java

public NumberToColor() {
    setName("Number to Color");
    setDescription("Use color to represent numeric values");

    //initialize UI
    configUI.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.gridx = 0;/*ww  w . j a v a  2s .c  o m*/
    c.gridy = 0;
    c.ipadx = 5;
    c.ipady = 5;
    c.insets = new Insets(5, 5, 5, 5);
    c.gridwidth = 2;
    //        c.weightx = 0.8;

    editor = new GradientEditorPanel();
    configUI.add(editor, c);

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    //        JButton button = new JButton("Apply");
    //        configUI.add(button, c);
    //        button.setToolTipText("Apply preset gradient");
    //
    //        button.addActionListener(new ActionListener() {
    //
    //            @Override
    //            public void actionPerformed(ActionEvent e) {
    //
    //                try {
    //                    GradientItem item = (GradientItem) presetColorComboBox.getSelectedItem();
    //
    //                    editor.clearColors();
    //
    //                    Color c[] = item.getColors();
    //                    float p[] = item.getPositions();
    //
    //                    editor.setStart(c[0]);
    //                    editor.setEnd(c[c.length - 1]);
    //
    //                    if (c.length > 2) {
    //                        for (int i = 1; i < c.length - 1; i++) {
    //                            editor.addColor(c[i], p[i]);
    //                        }
    //                    }
    //
    //                } catch (Exception ex) {
    //                    editor.clearColors();
    //                    editor.setStart(DEFAULT_MIN_COLOR);
    //                    editor.setEnd(DEFAULT_MAX_COLOR);
    //                }
    //
    //                updateRenderer();
    //            }
    //        });
    configUI.add(new JLabel("Preset palette:"), c);

    c.gridx = 1;
    c.gridwidth = 1;
    presetColorComboBox = new JComboBox();

    presetColorComboBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {

            try {
                GradientItem item = (GradientItem) presetColorComboBox.getSelectedItem();
                presetColorComboBox.setToolTipText(item.getToolTip());

                editor.clearColors();

                Color c[] = item.getColors();
                float p[] = item.getPositions();

                editor.setStart(c[0]);
                editor.setEnd(c[c.length - 1]);

                if (c.length > 2) {
                    for (int i = 1; i < c.length - 1; i++) {
                        editor.addColor(c[i], p[i]);
                    }
                }

                try {
                    Double[] ranges = item.getRanges();
                    if (ranges != null) {
                        minValueField.setText(ranges[0].toString());
                        maxValueField.setText(ranges[1].toString());
                        editor.setMinValue(ranges[0].floatValue());
                        editor.setMaxValue(ranges[1].floatValue());
                    }
                } catch (Exception ex) {
                    minValueField.setText("-1");
                    maxValueField.setText("1");
                    editor.setMinValue(-1);
                    editor.setMaxValue(1);
                }

            } catch (Exception ex) {
                editor.clearColors();
                editor.setStart(DEFAULT_MIN_COLOR);
                editor.setEnd(DEFAULT_MAX_COLOR);
            }
        }
    });

    //       
    configUI.add(presetColorComboBox, c);
    presetColorComboBox.setRenderer(new GradientComboItemRenderer());

    presetColorComboBox
            .addItem(new GradientItem(new Color[] { DEFAULT_MIN_COLOR, Color.BLACK, DEFAULT_MAX_COLOR },
                    new float[] { 0f, 0.5f, 1f }, "TBP", "Teal - Black - Pink"));

    presetColorComboBox.addItem(new GradientItem(new Color[] { Color.GREEN, Color.RED }, new float[] { 0f, 1f },
            "GR", "Green - Red"));

    presetColorComboBox.addItem(new GradientItem(new Color[] { Color.GREEN, Color.BLACK, Color.RED },
            new float[] { 0f, 0.5f, 1f }, "RBG", "Red - Black - Green"));

    presetColorComboBox.addItem(new GradientItem(new Color[] { Color.ORANGE, Color.BLUE },
            new float[] { 0f, 1f }, "OB", "Orange - Blue"));

    presetColorComboBox.addItem(new GradientItem(new Color[] { Color.ORANGE, Color.BLACK, Color.BLUE },
            new float[] { 0f, 0.5f, 1f }, "OBB", "Orange - Black - Blue"));

    presetColorComboBox.addItem(new GradientItem(new Color[] { Color.BLACK, Color.GREEN },
            new float[] { 0f, 1f }, "BG", "Black - Green"));

    presetColorComboBox
            .addItem(new GradientItem(new Color[] { Color.RED, UI.colorAKABENI, Color.BLACK, Color.BLACK },
                    new float[] { 0f, 0.05f, 0.051f, 1f }, "P.05", 0d, 1d, "P-value @ 0.05, Red to Black"));

    presetColorComboBox.setToolTipText(((GradientItem) presetColorComboBox.getSelectedItem()).getToolTip());

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    //        button = new JButton("Apply");
    //        
    //        button.setToolTipText("Apply preset data ranges");
    //        button.addActionListener(new ActionListener() {
    //
    //            @Override
    //            public void actionPerformed(ActionEvent e) {
    //                try {
    //                    MinMaxItem item = (MinMaxItem) (presetRangeComboBox.getSelectedItem());
    //                    minValueField.setText(item.getMinMax().lowerEndpoint().toString());
    //                    maxValueField.setText(item.getMinMax().upperEndpoint().toString());
    //                } catch (Exception ex) {
    //                    minValueField.setText("-1");
    //                    maxValueField.setText("1");
    //                }
    //
    //                updateRenderer();
    //            }
    //        });
    //        configUI.add(button, c);
    configUI.add(new JLabel("Preset range:"), c);

    c.gridx = 1;
    c.gridwidth = 1;
    presetRangeComboBox = new JComboBox();
    configUI.add(presetRangeComboBox, c);
    presetRangeComboBox.addItem(new DataMinMaxItem());
    presetRangeComboBox.addItem(new DefinedMinMaxItem(-1, 1));
    presetRangeComboBox.addItem(new DefinedMinMaxItem(0, 1));
    presetRangeComboBox.addItem(new DefinedMinMaxItem(-1, 0));
    presetRangeComboBox.addItem(new DefinedMinMaxItem(0, 100));

    presetRangeComboBox.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            try {
                MinMaxItem item = (MinMaxItem) (presetRangeComboBox.getSelectedItem());
                minValueField.setText(item.getMinMax().lowerEndpoint().toString());
                maxValueField.setText(item.getMinMax().upperEndpoint().toString());
            } catch (Exception ex) {
                minValueField.setText("-1");
                maxValueField.setText("1");
            }
        }
    });

    ////////////////////////////////////////////////////////////////////////////////
    //        c.weightx = 0.2;
    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    configUI.add(new JLabel("Min value: "), c);
    c.gridx = 1;
    //        c.weightx = 0.3;
    configUI.add(minValueField, c);

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    configUI.add(new JLabel("Max value: "), c);
    c.gridx = 1;
    configUI.add(maxValueField, c);

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 1;
    JLabel label = Tools.createJLabel("Draw Sub-heatmap:", null,
            "Draw sub-heatmaps for collapsed ontology nodes", null);
    configUI.add(label, c);

    c.gridx = 1;
    drawSubMap = new JCheckBox();
    configUI.add(drawSubMap, c);

    c.gridx = 0;
    c.gridy++;
    c.gridwidth = 3;

    JButton button = new JButton("Update", UI.getImageIcon("refresh"));
    configUI.add(button, c);
    button.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            //hit button, redraw!

            updateRenderer();
        }
    });

    //        editor.applyButton.addActionListener(new ActionListener() {
    //
    //            @Override
    //            public void actionPerformed(ActionEvent e) {
    //                updateRenderer();
    //            }
    //        });
    toolTipLabel = new JLabel();
    toolTipLabel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    toolTipLabel.setBackground(UI.colorGrey3);
    toolTipLabel.setOpaque(true);
    toolTipLabel.setForeground(UI.colorBlack2);
    toolTipLabel.setFont(UI.fontPlain.deriveFont(12f));
}