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:org.openmicroscopy.shoola.agents.metadata.rnd.GraphicsPane.java

/** 
 * Builds hosting the various sliders// www  . j  a  v  a2  s. c  o m
 * 
 * @return See above.
 */
private JPanel buildGeneralPane() {
    JPanel content = new JPanel();
    content.setBackground(UIUtilities.BACKGROUND_COLOR);
    content.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    content.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.anchor = GridBagConstraints.WEST;
    c.insets = new Insets(0, 2, 2, 0);
    c.gridy = 0;
    c.gridx = 0;
    if (model.isGeneralIndex()) {
        content.add(previewToolBar, c);
        c.gridy++;
        c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
        c.fill = GridBagConstraints.HORIZONTAL;
        content.add(new JSeparator(), c);
        c.gridy++;
    }
    content.add(controlsBar, c);
    c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last
    c.fill = GridBagConstraints.NONE;//reset to default
    c.weightx = 0.0;

    Iterator<ChannelSlider> i = sliders.iterator();
    while (i.hasNext()) {
        c.gridy++;
        content.add(i.next(), c);
    }
    c.gridy++;
    c.gridwidth = GridBagConstraints.REMAINDER; //end row
    c.fill = GridBagConstraints.BOTH;
    c.weightx = 1.0;
    c.weighty = 1.0;
    content.add(viewedBy, c);
    JPanel p = UIUtilities.buildComponentPanel(content);
    p.setBackground(content.getBackground());
    return p;
}

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

private void init() {

    // ---------------------------------
    // create the basic props panel

    // initialise the fields
    nameField = createTextField();//from  w  w w .  j  a v  a  2 s.  c  om
    passwordField = createPasswordField();
    hostField = createTextField();
    portField = createNumberTextField();
    sourceField = createMatchedWidthTextField();
    userField = createTextField();
    urlField = createMatchedWidthTextField();

    nameField.addFocusListener(new ConnectionNameFieldListener(this));

    savePwdCheck = ActionUtilities.createCheckBox("Store Password", "setStorePassword");
    encryptPwdCheck = ActionUtilities.createCheckBox("Encrypt Password", "setEncryptPassword");

    savePwdCheck.addActionListener(this);
    encryptPwdCheck.addActionListener(this);

    // retrieve the drivers
    buildDriversList();

    // ---------------------------------
    // add the basic connection fields

    TextFieldPanel mainPanel = new TextFieldPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(10, 10, 10, 10);
    gbc.gridy = 0;
    gbc.gridx = 0;

    statusLabel = new DefaultFieldLabel();
    addLabelFieldPair(mainPanel, "Status:", statusLabel, "Current connection status", gbc);

    gbc.insets.bottom = 5;
    addLabelFieldPair(mainPanel, "Connection Name:", nameField, "A friendly name for this connection", gbc);

    addLabelFieldPair(mainPanel, "User Name:", userField, "Login user name", gbc);

    addLabelFieldPair(mainPanel, "Password:", passwordField, "Login password", gbc);

    JButton showPassword = new LinkButton("Show Password");
    showPassword.setActionCommand("showPassword");
    showPassword.addActionListener(this);

    JPanel passwordOptionsPanel = new JPanel(new GridBagLayout());
    addComponents(passwordOptionsPanel,
            new ComponentToolTipPair[] {
                    new ComponentToolTipPair(savePwdCheck,
                            "Store the password with the connection information"),
                    new ComponentToolTipPair(encryptPwdCheck, "Encrypt the password when saving"),
                    new ComponentToolTipPair(showPassword, "Show the password in plain text") });

    gbc.gridy++;
    gbc.gridx = 1;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    mainPanel.add(passwordOptionsPanel, gbc);

    addLabelFieldPair(mainPanel, "Host Name:", hostField, "Server host name or IP address", gbc);

    addLabelFieldPair(mainPanel, "Port:", portField, "Database port number", gbc);

    addLabelFieldPair(mainPanel, "Data Source:", sourceField, "Data source name", gbc);

    addLabelFieldPair(mainPanel, "JDBC URL:", urlField, "The full JDBC URL for this connection (optional)",
            gbc);

    addDriverFields(mainPanel, gbc);

    connectButton = createButton("Connect", CONNECT_ACTION_COMMAND, 'T');
    disconnectButton = createButton("Disconnect", "disconnect", 'D');

    JPanel buttons = new JPanel(new GridBagLayout());
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.insets.top = 5;
    gbc.insets.left = 0;
    gbc.insets.right = 10;
    gbc.gridwidth = 1;
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.anchor = GridBagConstraints.NORTHEAST;
    gbc.fill = GridBagConstraints.NONE;
    buttons.add(connectButton, gbc);
    gbc.gridx++;
    gbc.weightx = 0;
    buttons.add(disconnectButton, gbc);

    gbc.insets.right = 0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    mainPanel.add(buttons, gbc);

    // ---------------------------------
    // create the advanced panel

    model = new JdbcPropertiesTableModel();
    JTable table = new DefaultTable(model);
    table.getTableHeader().setReorderingAllowed(false);

    TableColumnModel tcm = table.getColumnModel();

    TableColumn column = tcm.getColumn(2);
    column.setCellRenderer(new DeleteButtonRenderer());
    column.setCellEditor(new DeleteButtonEditor(table, new JCheckBox()));
    column.setMaxWidth(24);
    column.setMinWidth(24);

    JScrollPane scroller = new JScrollPane(table);

    // advanced jdbc properties
    JPanel advPropsPanel = new JPanel(new GridBagLayout());
    advPropsPanel.setBorder(BorderFactory.createTitledBorder("JDBC Properties"));
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 0;
    gbc.insets.left = 10;
    gbc.insets.right = 10;
    gbc.weighty = 0;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    advPropsPanel.add(new DefaultFieldLabel("Enter any key/value pair properties for this connection"), gbc);
    gbc.gridy++;
    advPropsPanel.add(
            new DefaultFieldLabel("Refer to the relevant JDBC driver documentation for possible entries"), gbc);
    gbc.gridy++;
    gbc.insets.bottom = 10;
    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    advPropsPanel.add(scroller, gbc);

    // transaction isolation
    txApplyButton = WidgetFactory.createInlineFieldButton("Apply", "transactionLevelChanged");
    txApplyButton.setToolTipText("Apply this level to all open connections of this type");
    txApplyButton.setEnabled(false);
    txApplyButton.addActionListener(this);

    // add a dummy select value to the tx levels
    String[] txLevels = new String[Constants.TRANSACTION_LEVELS.length + 1];
    txLevels[0] = "Database Default";
    for (int i = 1; i < txLevels.length; i++) {
        txLevels[i] = Constants.TRANSACTION_LEVELS[i - 1];
    }
    txCombo = WidgetFactory.createComboBox(txLevels);

    JPanel advTxPanel = new JPanel(new GridBagLayout());
    advTxPanel.setBorder(BorderFactory.createTitledBorder("Transaction Isolation"));
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.insets.top = 0;
    gbc.insets.left = 10;
    gbc.insets.right = 10;
    gbc.insets.bottom = 5;
    gbc.weighty = 0;
    gbc.weightx = 1.0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    advTxPanel.add(new DefaultFieldLabel("Default transaction isolation level for this connection"), gbc);
    gbc.gridy++;
    gbc.insets.bottom = 10;
    advTxPanel.add(
            new DefaultFieldLabel(
                    "Note: the selected isolation level " + "will apply to ALL open connections of this type."),
            gbc);
    gbc.gridy++;
    gbc.gridx = 0;
    gbc.gridwidth = 1;
    gbc.insets.top = 0;
    gbc.insets.left = 10;
    gbc.weightx = 0;
    advTxPanel.add(new DefaultFieldLabel("Isolation Level:"), gbc);
    gbc.gridx = 1;
    gbc.insets.left = 5;
    gbc.weightx = 1.0;
    gbc.insets.right = 5;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    advTxPanel.add(txCombo, gbc);
    gbc.gridx = 2;
    gbc.weightx = 0;
    gbc.insets.left = 0;
    gbc.insets.right = 10;
    advTxPanel.add(txApplyButton, gbc);

    JPanel advancedPanel = new JPanel(new BorderLayout());
    advancedPanel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    advancedPanel.add(advPropsPanel, BorderLayout.CENTER);
    advancedPanel.add(advTxPanel, BorderLayout.SOUTH);

    JScrollPane scrollPane = new JScrollPane(mainPanel);
    scrollPane.setBorder(null);

    sshTunnelConnectionPanel = new SSHTunnelConnectionPanel();

    tabPane = new JTabbedPane(JTabbedPane.BOTTOM);
    tabPane.addTab("Basic", scrollPane);
    tabPane.addTab("Advanced", advancedPanel);
    tabPane.addTab("SSH Tunnel", sshTunnelConnectionPanel);

    tabPane.addChangeListener(this);

    add(tabPane, BorderLayout.CENTER);

    EventMediator.registerListener(this);
}

From source file:org.languagetool.gui.ConfigurationDialog.java

public boolean show(List<Rule> rules) {
    configChanged = false;/*w ww. j  ava2 s. c o m*/
    if (original != null) {
        config.restoreState(original);
    }
    dialog = new JDialog(owner, true);
    dialog.setTitle(messages.getString("guiConfigWindowTitle"));
    // close dialog when user presses Escape key:
    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    ActionListener actionListener = new ActionListener() {
        @Override
        public void actionPerformed(@SuppressWarnings("unused") ActionEvent actionEvent) {
            dialog.setVisible(false);
        }
    };
    JRootPane rootPane = dialog.getRootPane();
    rootPane.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);

    configurableRules.clear();

    Language lang = config.getLanguage();
    if (lang == null) {
        lang = Languages.getLanguageForLocale(Locale.getDefault());
    }

    String specialTabNames[] = config.getSpecialTabNames();
    int numConfigTrees = 2 + specialTabNames.length;
    configTree = new JTree[numConfigTrees];
    JPanel checkBoxPanel[] = new JPanel[numConfigTrees];
    DefaultMutableTreeNode rootNode;
    GridBagConstraints cons;

    for (int i = 0; i < numConfigTrees; i++) {
        checkBoxPanel[i] = new JPanel();
        cons = new GridBagConstraints();
        checkBoxPanel[i].setLayout(new GridBagLayout());
        cons.anchor = GridBagConstraints.NORTHWEST;
        cons.gridx = 0;
        cons.weightx = 1.0;
        cons.weighty = 1.0;
        cons.fill = GridBagConstraints.HORIZONTAL;
        Collections.sort(rules, new CategoryComparator());
        if (i == 0) {
            rootNode = createTree(rules, false, null); //  grammar options
        } else if (i == 1) {
            rootNode = createTree(rules, true, null); //  Style options
        } else {
            rootNode = createTree(rules, true, specialTabNames[i - 2]); //  Special tab options
        }
        configTree[i] = new JTree(getTreeModel(rootNode));

        configTree[i].applyComponentOrientation(ComponentOrientation.getOrientation(lang.getLocale()));

        configTree[i].setRootVisible(false);
        configTree[i].setEditable(false);
        configTree[i].setCellRenderer(new CheckBoxTreeCellRenderer());
        TreeListener.install(configTree[i]);
        checkBoxPanel[i].add(configTree[i], cons);
        configTree[i].addMouseListener(getMouseAdapter());
    }

    JPanel portPanel = new JPanel();
    portPanel.setLayout(new GridBagLayout());
    cons = new GridBagConstraints();
    cons.insets = new Insets(0, 4, 0, 0);
    cons.gridx = 0;
    cons.gridy = 0;
    cons.anchor = GridBagConstraints.WEST;
    cons.fill = GridBagConstraints.NONE;
    cons.weightx = 0.0f;
    if (!insideOffice) {
        createNonOfficeElements(cons, portPanel);
    } else {
        createOfficeElements(cons, portPanel);
    }

    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridBagLayout());
    JButton okButton = new JButton(Tools.getLabel(messages.getString("guiOKButton")));
    okButton.setMnemonic(Tools.getMnemonic(messages.getString("guiOKButton")));
    okButton.setActionCommand(ACTION_COMMAND_OK);
    okButton.addActionListener(this);
    JButton cancelButton = new JButton(Tools.getLabel(messages.getString("guiCancelButton")));
    cancelButton.setMnemonic(Tools.getMnemonic(messages.getString("guiCancelButton")));
    cancelButton.setActionCommand(ACTION_COMMAND_CANCEL);
    cancelButton.addActionListener(this);
    cons = new GridBagConstraints();
    cons.insets = new Insets(0, 4, 0, 0);
    buttonPanel.add(okButton, cons);
    buttonPanel.add(cancelButton, cons);

    JTabbedPane tabpane = new JTabbedPane();

    JPanel jPane = new JPanel();
    jPane.setLayout(new GridBagLayout());
    cons = new GridBagConstraints();
    cons.insets = new Insets(4, 4, 4, 4);

    cons.gridx = 0;
    cons.gridy = 0;
    cons.weightx = 10.0f;
    cons.weighty = 0.0f;
    cons.fill = GridBagConstraints.NONE;
    cons.anchor = GridBagConstraints.NORTHWEST;
    cons.gridy++;
    cons.anchor = GridBagConstraints.WEST;
    jPane.add(getMotherTonguePanel(cons), cons);

    if (insideOffice) {
        cons.gridy += 3;
    } else {
        cons.gridy++;
    }
    cons.anchor = GridBagConstraints.WEST;
    jPane.add(getNgramPanel(cons), cons);

    cons.gridy++;
    cons.anchor = GridBagConstraints.WEST;
    jPane.add(getWord2VecPanel(cons), cons);

    cons.gridy++;
    cons.anchor = GridBagConstraints.WEST;
    jPane.add(portPanel, cons);
    cons.fill = GridBagConstraints.HORIZONTAL;
    cons.anchor = GridBagConstraints.WEST;
    for (JPanel extra : extraPanels) {
        //in case it wasn't in a containment hierarchy when user changed L&F
        SwingUtilities.updateComponentTreeUI(extra);
        cons.gridy++;
        jPane.add(extra, cons);
    }

    cons.gridy++;
    cons.fill = GridBagConstraints.BOTH;
    cons.weighty = 1.0f;
    jPane.add(new JPanel(), cons);

    tabpane.addTab(messages.getString("guiGeneral"), jPane);

    jPane = new JPanel();
    jPane.setLayout(new GridBagLayout());
    cons = new GridBagConstraints();
    cons.insets = new Insets(4, 4, 4, 4);
    cons.gridx = 0;
    cons.gridy = 0;
    cons.weightx = 10.0f;
    cons.weighty = 10.0f;
    cons.fill = GridBagConstraints.BOTH;
    jPane.add(new JScrollPane(checkBoxPanel[0]), cons);
    cons.weightx = 0.0f;
    cons.weighty = 0.0f;

    cons.gridx = 0;
    cons.gridy++;
    cons.fill = GridBagConstraints.NONE;
    cons.anchor = GridBagConstraints.LINE_END;
    jPane.add(getTreeButtonPanel(0), cons);

    tabpane.addTab(messages.getString("guiGrammarRules"), jPane);

    jPane = new JPanel();
    jPane.setLayout(new GridBagLayout());
    cons = new GridBagConstraints();
    cons.insets = new Insets(4, 4, 4, 4);
    cons.gridx = 0;
    cons.gridy = 0;
    cons.weightx = 10.0f;
    cons.weighty = 10.0f;
    cons.fill = GridBagConstraints.BOTH;
    jPane.add(new JScrollPane(checkBoxPanel[1]), cons);
    cons.weightx = 0.0f;
    cons.weighty = 0.0f;

    cons.gridx = 0;
    cons.gridy++;
    cons.fill = GridBagConstraints.NONE;
    cons.anchor = GridBagConstraints.LINE_END;
    jPane.add(getTreeButtonPanel(1), cons);

    cons.gridx = 0;
    cons.gridy++;
    cons.weightx = 5.0f;
    cons.weighty = 5.0f;
    cons.fill = GridBagConstraints.BOTH;
    cons.anchor = GridBagConstraints.WEST;
    jPane.add(new JScrollPane(getSpecialRuleValuePanel()), cons);

    tabpane.addTab(messages.getString("guiStyleRules"), jPane);

    for (int i = 0; i < specialTabNames.length; i++) {
        jPane = new JPanel();
        jPane.setLayout(new GridBagLayout());
        cons = new GridBagConstraints();
        cons.insets = new Insets(4, 4, 4, 4);
        cons.gridx = 0;
        cons.gridy = 0;
        cons.weightx = 10.0f;
        cons.weighty = 10.0f;
        cons.fill = GridBagConstraints.BOTH;
        jPane.add(new JScrollPane(checkBoxPanel[i + 2]), cons);
        cons.weightx = 0.0f;
        cons.weighty = 0.0f;

        cons.gridx = 0;
        cons.gridy++;
        cons.fill = GridBagConstraints.NONE;
        cons.anchor = GridBagConstraints.LINE_END;
        jPane.add(getTreeButtonPanel(i + 2), cons);

        tabpane.addTab(specialTabNames[i], jPane);
    }

    jPane = new JPanel();
    jPane.setLayout(new GridBagLayout());
    cons = new GridBagConstraints();
    cons.insets = new Insets(4, 4, 4, 4);
    cons.gridx = 0;
    cons.gridy = 0;
    if (insideOffice) {
        JLabel versionText = new JLabel(messages.getString("guiUColorHint"));
        versionText.setForeground(Color.blue);
        jPane.add(versionText, cons);
        cons.gridy++;
    }

    cons.weightx = 2.0f;
    cons.weighty = 2.0f;
    cons.fill = GridBagConstraints.BOTH;

    jPane.add(new JScrollPane(getUnderlineColorPanel(rules)), cons);

    Container contentPane = dialog.getContentPane();
    contentPane.setLayout(new GridBagLayout());
    cons = new GridBagConstraints();
    cons.insets = new Insets(4, 4, 4, 4);
    cons.gridx = 0;
    cons.gridy = 0;
    cons.weightx = 10.0f;
    cons.weighty = 10.0f;
    cons.fill = GridBagConstraints.BOTH;
    cons.anchor = GridBagConstraints.NORTHWEST;
    contentPane.add(tabpane, cons);
    cons.weightx = 0.0f;
    cons.weighty = 0.0f;
    cons.gridy++;
    cons.fill = GridBagConstraints.NONE;
    cons.anchor = GridBagConstraints.EAST;
    contentPane.add(buttonPanel, cons);

    dialog.pack();
    // center on screen:
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    Dimension frameSize = dialog.getSize();
    dialog.setLocation(screenSize.width / 2 - frameSize.width / 2,
            screenSize.height / 2 - frameSize.height / 2);
    dialog.setLocationByPlatform(true);
    //  add Color tab after dimension was set
    tabpane.addTab(messages.getString("guiUnderlineColor"), jPane);

    for (JPanel extra : this.extraPanels) {
        if (extra instanceof SavablePanel) {
            ((SavablePanel) extra).componentShowing();
        }
    }
    dialog.setVisible(true);
    return configChanged;
}

From source file:de.codesourcery.jasm16.ide.ui.views.EmulationOptionsView.java

private JPanel createPanel() {

    final JPanel result = new JPanel();

    result.setLayout(new GridBagLayout());

    // 'Memory protection' checkbox
    int y = 0;/*w  w  w . ja va 2  s  .c  o  m*/
    GridBagConstraints cnstrs = constraints(0, y++, true, false, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = 2;
    result.add(box1, cnstrs);

    cnstrs = constraints(0, y++, true, false, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = 2;
    result.add(box2, cnstrs);

    cnstrs = constraints(0, y++, true, false, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = 2;
    result.add(box3, cnstrs);

    cnstrs = constraints(0, y++, true, false, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = 2;
    result.add(box8, cnstrs);

    cnstrs = constraints(0, y++, true, false, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = 2;
    result.add(box4, cnstrs);

    cnstrs = constraints(0, y++, true, false, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = 2;
    result.add(box5, cnstrs);

    cnstrs = constraints(0, y++, true, false, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = 2;
    result.add(box6, cnstrs);

    cnstrs = constraints(0, y++, true, false, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = 2;
    result.add(box7, cnstrs);

    cnstrs = constraints(0, y++, true, false, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = 2;
    result.add(diskDrivePanel, cnstrs);

    cnstrs = constraints(0, y++, true, false, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = 2;
    result.add(emulatorPanel, cnstrs);

    // cancel button
    cnstrs = constraints(0, y, false, false, GridBagConstraints.NONE);
    cnstrs.weightx = 0.33;
    cnstrs.anchor = GridBagConstraints.CENTER;

    final JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            onCancel();
        }
    });
    result.add(cancelButton, cnstrs);

    // save button
    cnstrs = constraints(1, y, true, false, GridBagConstraints.NONE);
    cnstrs.weightx = 0.33;
    cnstrs.anchor = GridBagConstraints.CENTER;

    final JButton saveButton = new JButton("Save");
    saveButton.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final EmulationOptions options = new EmulationOptions();
            saveChangesTo(options);
            onSave(options);
        }

    });
    result.add(saveButton, cnstrs);

    return result;
}

From source file:org.pentaho.reporting.designer.extensions.pentaho.repository.dialogs.RepositoryPublishDialog.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 ava 2 s .  c  o m*/
    c.gridy = 0;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1.0;
    c.anchor = GridBagConstraints.WEST;
    locationFieldPanel.add(getLocationCombo(), 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);

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

From source file:com.sec.ose.osi.ui.frm.main.identification.patternmatch.JPanPatternMatchMain.java

/**
 * This method initializes jPanel   //from   w  ww .ja  v a  2  s .  c om
 *    
 * @return javax.swing.JPanel   
 */
public JPanel getJPanelBottom() {
    if (jPanelBottom == null) {
        GridBagConstraints gridBagConstraints8 = new GridBagConstraints();
        gridBagConstraints8.anchor = GridBagConstraints.NORTHWEST;
        gridBagConstraints8.insets = new Insets(10, 0, 0, 0);
        gridBagConstraints8.gridx = 1;
        gridBagConstraints8.gridy = 2;
        gridBagConstraints8.weightx = 1.0;
        gridBagConstraints8.weighty = 1.0;
        gridBagConstraints8.fill = GridBagConstraints.NONE;
        GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
        gridBagConstraints7.anchor = GridBagConstraints.WEST;
        gridBagConstraints7.insets = new Insets(10, 0, 0, 0);
        gridBagConstraints7.gridx = 1;
        gridBagConstraints7.gridy = 1;
        gridBagConstraints7.weightx = 0.0;
        gridBagConstraints7.fill = GridBagConstraints.VERTICAL;
        GridBagConstraints gridBagConstraints6 = new GridBagConstraints();
        gridBagConstraints6.anchor = GridBagConstraints.WEST;
        gridBagConstraints6.insets = new Insets(10, 0, 0, 15);
        gridBagConstraints6.gridx = 1;
        gridBagConstraints6.gridy = 0;
        gridBagConstraints6.fill = GridBagConstraints.NONE;
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.anchor = GridBagConstraints.NORTHEAST;
        gridBagConstraints5.gridx = 0;
        gridBagConstraints5.gridy = 2;
        gridBagConstraints5.weightx = 0.0;
        gridBagConstraints5.weighty = 0.0;
        gridBagConstraints5.insets = new Insets(13, 0, 0, 5);
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        gridBagConstraints4.anchor = GridBagConstraints.EAST;
        gridBagConstraints4.gridx = 0;
        gridBagConstraints4.gridy = 1;
        gridBagConstraints4.insets = new Insets(10, 0, 0, 5);
        GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
        gridBagConstraints1.anchor = GridBagConstraints.EAST;
        gridBagConstraints1.gridx = -1;
        gridBagConstraints1.gridy = -1;
        gridBagConstraints1.insets = new Insets(10, 15, 0, 5);
        jPanelBottom = new JPanel();
        jPanelBottom.setLayout(new GridBagLayout());
        jPanelBottom.add(jLabelBinding, gridBagConstraints1);
        jPanelBottom.add(jLabelComponent, gridBagConstraints4);
        jPanelBottom.add(jLabelLicense, gridBagConstraints5);
        jPanelBottom.add(getJComboBoxBinding(), gridBagConstraints6);
        jPanelBottom.add(getJComboBoxComponentForOpt3(), gridBagConstraints7);
        jPanelBottom.add(getJComboBoxLicenseForOpt3(), gridBagConstraints8);
    }
    return jPanelBottom;
}

From source file:cool.pandora.modeller.ui.jpanel.base.NewBagInPlaceFrame.java

/**
 * layoutAddKeepFilesToEmptyCheckBox.//from   w  w  w  . j  a  va2 s  . co m
 *
 * <p>Setting and displaying the ".keep Files in Empty Folder(s):" Check Box
 * on the Create Bag In Place Pane
 */
private void layoutAddKeepFilesToEmptyCheckBox(final JPanel contentPane, final int row) {
    // Delete Empty Folder(s)
    final JLabel addKeepFilesToEmptyFoldersCheckBoxLabel = new JLabel(
            bagView.getPropertyMessage("bag.label" + ".addkeepfilestoemptyfolders"));
    addKeepFilesToEmptyFoldersCheckBoxLabel
            .setToolTipText(bagView.getPropertyMessage("bag" + ".addkeepfilestoemptyfolders" + ".help"));
    final JCheckBox addKeepFilesToEmptyFoldersCheckBox = new JCheckBox(bagView.getPropertyMessage(""));
    addKeepFilesToEmptyFoldersCheckBox.setSelected(bag.isAddKeepFilesToEmptyFolders());
    addKeepFilesToEmptyFoldersCheckBox.addActionListener(new AddKeepFilesToEmptyFoldersHandler());

    GridBagConstraints glbc = new GridBagConstraints();

    final JLabel spacerLabel = new JLabel();
    glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.WEST);
    contentPane.add(addKeepFilesToEmptyFoldersCheckBoxLabel, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.CENTER);
    contentPane.add(addKeepFilesToEmptyFoldersCheckBox, glbc);
    glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE,
            GridBagConstraints.EAST);
    contentPane.add(spacerLabel, glbc);
}

From source file:us.paulevans.basicxslt.TransformParametersFrame.java

/**
 * Rebuilds the parameters panel/* w ww  .ja  v a2  s.  c  om*/
 *
 */
private void rebuildParametersPanel() {

    int loop, row, size;
    JTextField paramNameTf, paramValueTf, paramNamespaceURITf;
    JCheckBox removeCb;
    String paramNames[];
    ParameterTextFieldGroup paramTfGroup;

    row = 0;
    parametersPanel.removeAll();
    GUIUtils.add(parametersPanel, new JLabel(stringFactory.getString(LabelStringFactory.PARAMS_FRAME_NAME_LBL)),
            parametersPanelLayout, parametersPanelConstraints, row, 0, 1, 1, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(parametersPanel,
            new JLabel(stringFactory.getString(LabelStringFactory.PARAMS_FRAME_VALUE_LBL)),
            parametersPanelLayout, parametersPanelConstraints, row, 1, 1, 1, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(parametersPanel,
            new JLabel(stringFactory.getString(LabelStringFactory.PARAMS_FRAME_NAMESPACE_URI_LBL)),
            parametersPanelLayout, parametersPanelConstraints, row, 2, 1, 1, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    GUIUtils.add(parametersPanel,
            new JLabel(stringFactory.getString(LabelStringFactory.PARAMS_FRAME_REMOVE_LBL)),
            parametersPanelLayout, parametersPanelConstraints, row++, 3, 1, 1, GridBagConstraints.WEST,
            GridBagConstraints.BOTH, GUIUtils.SMALL_INSETS);
    paramNames = parameters.getParameterNames();
    size = parameterTextFieldGroups.size();
    for (loop = 0; loop < size; loop++) {
        paramTfGroup = (ParameterTextFieldGroup) parameterTextFieldGroups.get(loop);
        GUIUtils.add(parametersPanel, paramNameTf = paramTfGroup.getParamNameTf(), parametersPanelLayout,
                parametersPanelConstraints, row, 0, 1, 1, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, GUIUtils.SMALL_INSETS);
        GUIUtils.add(parametersPanel, paramValueTf = paramTfGroup.getParamValueTf(), parametersPanelLayout,
                parametersPanelConstraints, row, 1, 1, 1, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, GUIUtils.SMALL_INSETS);
        GUIUtils.add(parametersPanel, paramNamespaceURITf = paramTfGroup.getParamNamespaceURITf(),
                parametersPanelLayout, parametersPanelConstraints, row, 2, 1, 1, GridBagConstraints.WEST,
                GridBagConstraints.HORIZONTAL, GUIUtils.SMALL_INSETS);
        GUIUtils.add(parametersPanel, removeCb = paramTfGroup.getRemoveCb(), parametersPanelLayout,
                parametersPanelConstraints, row++, 3, 1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE,
                GUIUtils.SMALL_INSETS);
        removeCb.addActionListener(this);
        if (loop < paramNames.length) {
            paramNameTf.setText(TransformParameters.getParameterName(paramNames[loop]));
            paramValueTf.setText(parameters.getParameter(paramNames[loop]).toString());
            paramNamespaceURITf.setText(TransformParameters.getNamespaceURI(paramNames[loop]));
        }
    }
}

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

private JPanel creerComptePanel(final Compte compte) {

    final GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(2, 2, 1, 2);
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.gridx = GridBagConstraints.RELATIVE;
    c.gridy = 0;/*from  w  ww .  ja v  a 2s  . c om*/
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 1;
    c.weighty = 0;

    // Intitul du compte
    final JPanel panelCompte = new JPanel();
    panelCompte.setOpaque(false);
    panelCompte.setLayout(new GridBagLayout());
    panelCompte.setBorder(BorderFactory.createTitledBorder(compte.getNumero() + " " + compte.getNom()));

    // Bouton Dtails +/- du compte
    JButton boutonShow = new JButton("+/-");
    boutonShow.setOpaque(false);
    boutonShow.setHorizontalAlignment(SwingConstants.RIGHT);

    // Total du Compte
    JLabel labelCompteDebit = new JLabel(
            "Total Debit : " + GestionDevise.currencyToString(compte.getTotalDebit()));
    JLabel labelCompteCredit = new JLabel(
            " Credit : " + GestionDevise.currencyToString(compte.getTotalCredit()));
    // labelCompte.setFont(new Font(labelCompte.getFont().getFontName(), Font.BOLD, 12));
    labelCompteDebit.setHorizontalAlignment(SwingUtilities.LEFT);
    labelCompteCredit.setHorizontalAlignment(SwingUtilities.LEFT);

    JLabel labelTmp = new JLabel(compte.getNumero() + " " + compte.getNom());
    labelTmp.setHorizontalAlignment(SwingUtilities.LEFT);

    panelCompte.add(labelTmp, c);
    panelCompte.add(labelCompteDebit, c);
    panelCompte.add(labelCompteCredit, c);
    c.weightx = 1;
    c.anchor = GridBagConstraints.NORTHEAST;
    panelCompte.add(boutonShow, c);

    boutonShow.addActionListener(new ActionListener() {
        private boolean isShow = false;
        private JScrollPane scroll = null;

        public void actionPerformed(ActionEvent e) {

            System.err.println(this.isShow);
            // Afficher la JTable du compte
            if (!this.isShow) {
                // if (this.scroll == null) {
                System.err.println(compte);
                JTable tableCpt = createJTableCompte(compte);

                this.scroll = new JScrollPane(tableCpt);

                // calcul de la taille du JScrollPane
                Dimension d;
                System.err.println(tableCpt);
                if (tableCpt.getPreferredSize().height > 200) {
                    d = new Dimension(this.scroll.getPreferredSize().width, 200);
                } else {
                    d = new Dimension(this.scroll.getPreferredSize().width,
                            tableCpt.getPreferredSize().height + 30);
                }
                this.scroll.setPreferredSize(d);

                c.gridy++;
                c.gridwidth = 4;
                c.weightx = 1;
                c.fill = GridBagConstraints.HORIZONTAL;
                c.anchor = GridBagConstraints.NORTHWEST;
                panelCompte.add(this.scroll, c);
                /*
                 * } else { this.scroll.setVisible(true); }
                 */

            } else {
                // if (this.scroll != null) {
                panelCompte.remove(this.scroll);
                System.out.println("Hide scrollPane");
                // this.scroll.setVisible(false);

                // this.scroll.repaint();
                panelCompte.repaint();
                panelCompte.revalidate();
                // }
            }

            this.isShow = !this.isShow;
            SwingUtilities.getRoot(panelCompte).repaint();
        }
    });

    return panelCompte;
}

From source file:savant.ucscexplorer.UCSCExplorerPlugin.java

private void buildUI() {
    topLevelPanel.removeAll();/*from  ww w. j a v a2  s. c  om*/
    topLevelPanel.setLayout(new GridBagLayout());

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.insets = new Insets(5, 5, 5, 5);

    try {
        UCSCDataSourcePlugin ucsc = getUCSCPlugin();
        ucsc.getConnection();
        JLabel cladeLabel = new JLabel("Clade:");
        gbc.anchor = GridBagConstraints.EAST;
        topLevelPanel.add(cladeLabel, gbc);

        cladeCombo = new JComboBox();
        cladeCombo.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                UCSCDataSourcePlugin ucsc = getUCSCPlugin();
                String clade = (String) cladeCombo.getSelectedItem();
                genomeCombo.setModel(new DefaultComboBoxModel(ucsc.getCladeGenomes(clade)));
                genomeCombo.setSelectedItem(ucsc.getCurrentGenome(clade));
            }
        });

        gbc.anchor = GridBagConstraints.WEST;
        topLevelPanel.add(cladeCombo, gbc);

        JLabel genomeLabel = new JLabel("Genome:");
        gbc.anchor = GridBagConstraints.EAST;
        topLevelPanel.add(genomeLabel, gbc);

        genomeCombo = new JComboBox();
        genomeCombo.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                buildProgressUI();
                new GroupsFetcher(getUCSCPlugin(), (GenomeDef) genomeCombo.getSelectedItem()) {
                    @Override
                    public void done(List<GroupDef> groups) {
                        if (groups != null) {
                            GridBagConstraints gbc = new GridBagConstraints();
                            gbc.gridwidth = GridBagConstraints.REMAINDER;
                            gbc.fill = GridBagConstraints.BOTH;
                            gbc.weightx = 1.0;
                            for (GroupDef g : groups) {
                                groupsPanel.add(new GroupPanel(g), gbc);
                            }

                            // Add a filler panel to force everything to the top.
                            gbc.weighty = 1.0;
                            groupsPanel.add(new JPanel(), gbc);
                            loadButton.setEnabled(true);
                            topLevelPanel.validate();
                        }
                    }

                    @Override
                    public void showProgress(double value) {
                        updateProgress(progressMessage, value);
                    }
                }.execute();
            }
        });
        gbc.anchor = GridBagConstraints.WEST;
        topLevelPanel.add(genomeCombo, gbc);

        loadButton = new JButton("Load Selected Tracks");
        loadButton.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent ae) {
                try {
                    loadSelectedTracks();
                } catch (Throwable x) {
                    DialogUtils.displayException(getTitle(), "Unable to load selected tracks.", x);
                }
            }
        });
        gbc.anchor = GridBagConstraints.EAST;
        gbc.gridwidth = GridBagConstraints.REMAINDER;
        topLevelPanel.add(loadButton, gbc);

        groupsPanel = new GroupsPanel();
        groupsPanel.setLayout(new GridBagLayout());

        JScrollPane groupsScroller = new JScrollPane(groupsPanel,
                ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED,
                ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
        gbc.weightx = 1.0;
        gbc.weighty = 1.0;
        gbc.fill = GridBagConstraints.BOTH;
        topLevelPanel.add(groupsScroller, gbc);

        buildProgressUI();

        GenomeUtils.addGenomeChangedListener(new Listener<GenomeChangedEvent>() {
            @Override
            public void handleEvent(GenomeChangedEvent event) {
                UCSCDataSourcePlugin ucsc = getUCSCPlugin();
                ucsc.selectGenomeDB(null);
                GenomeAdapter newGenome = event.getNewGenome();
                GenomeDef g = new GenomeDef(newGenome.getName(), null);
                String newClade = ucsc.findCladeForGenome(g);

                // newClade could be null if the user has opened a genome which has no UCSC equivalent.
                if (newClade != null) {
                    cladeCombo.setSelectedItem(newClade);
                }
            }
        });

        ucsc.selectGenomeDB(null);
        new CladesFetcher(getUCSCPlugin()) {
            @Override
            public void done(String selectedClade) {
                cladeCombo.setModel(new DefaultComboBoxModel(UCSCDataSourcePlugin.STANDARD_CLADES));
                if (selectedClade != null) {
                    cladeCombo.setSelectedItem(selectedClade);
                } else {
                    cladeCombo.setSelectedIndex(0);
                }
            }

            @Override
            public void showProgress(double value) {
                updateProgress(progressMessage, value);
            }
        }.execute();
    } catch (Exception x) {
        LOG.error("Unable to connect to UCSC database.", x);
        topLevelPanel.removeAll();
        gbc.anchor = GridBagConstraints.CENTER;
        gbc.gridwidth = GridBagConstraints.REMAINDER;
        gbc.fill = GridBagConstraints.NONE;
        gbc.weightx = 0.0;
        gbc.weighty = 0.0;
        topLevelPanel.add(new JLabel("Unable to connect to UCSC database."), gbc);
        JLabel error = new JLabel(MiscUtils.getMessage(x));
        Font f = topLevelPanel.getFont();
        f = f.deriveFont(Font.ITALIC, f.getSize() - 2.0f);
        error.setFont(f);
        topLevelPanel.add(error, gbc);
    }
}