Search in sources :

Example 1 with Insets

use of java.awt.Insets in project buck by facebook.

the class BuckSettingsUI method init.

private void init() {
    setLayout(new BorderLayout());
    JPanel container = this;
    buckPathField = new TextFieldWithBrowseButton();
    FileChooserDescriptor buckFileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false);
    buckPathField.addBrowseFolderListener("", "Buck Executable Path", null, buckFileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
    adbPathField = new TextFieldWithBrowseButton();
    FileChooserDescriptor adbFileChooserDescriptor = new FileChooserDescriptor(true, false, false, false, false, false);
    adbPathField.addBrowseFolderListener("", "Adb Executable Path", null, adbFileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT, false);
    customizedInstallSettingField = new JBTextField();
    customizedInstallSettingField.getEmptyText().setText(CUSTOMIZED_INSTALL_FLAGS_HINT);
    customizedInstallSettingField.setEnabled(false);
    showDebug = new JCheckBox("Show debug in tool window");
    enableAutoDeps = new JCheckBox("Enable auto dependencies");
    runAfterInstall = new JCheckBox("Run after install (-r)");
    multiInstallMode = new JCheckBox("Multi-install mode (-x)");
    uninstallBeforeInstall = new JCheckBox("Uninstall before installing (-u)");
    customizedInstallSetting = new JCheckBox("Use customized install setting:  ");
    initCustomizedInstallCommandListener();
    JPanel buckSettings = new JPanel(new GridBagLayout());
    buckSettings.setBorder(IdeBorderFactory.createTitledBorder("Buck Settings", true));
    container.add(container = new JPanel(new BorderLayout()), BorderLayout.NORTH);
    container.add(buckSettings, BorderLayout.NORTH);
    final GridBagConstraints constraints = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
    buckSettings.add(new JLabel("Buck Executable Path:"), constraints);
    constraints.gridx = 1;
    constraints.weightx = 1;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    buckSettings.add(buckPathField, constraints);
    constraints.gridx = 0;
    constraints.gridy = 1;
    constraints.weightx = 1;
    buckSettings.add(new JLabel("Adb Executable Path:"), constraints);
    constraints.gridx = 1;
    constraints.gridy = 1;
    constraints.weightx = 1;
    constraints.fill = GridBagConstraints.HORIZONTAL;
    buckSettings.add(adbPathField, constraints);
    constraints.gridx = 0;
    constraints.gridy = 2;
    buckSettings.add(showDebug, constraints);
    constraints.gridx = 0;
    constraints.gridy = 3;
    buckSettings.add(enableAutoDeps, constraints);
    JPanel installSettings = new JPanel(new BorderLayout());
    installSettings.setBorder(IdeBorderFactory.createTitledBorder("Buck Install Settings", true));
    container.add(container = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
    container.add(installSettings, BorderLayout.NORTH);
    installSettings.add(runAfterInstall, BorderLayout.NORTH);
    installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
    installSettings.add(multiInstallMode, BorderLayout.NORTH);
    installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
    installSettings.add(uninstallBeforeInstall, BorderLayout.NORTH);
    installSettings.add(installSettings = new JPanel(new BorderLayout()), BorderLayout.SOUTH);
    final GridBagConstraints customConstraints = new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0);
    JPanel customizedInstallSetting = new JPanel(new GridBagLayout());
    customizedInstallSetting.add(this.customizedInstallSetting, customConstraints);
    customConstraints.gridx = 1;
    customConstraints.weightx = 1;
    customConstraints.fill = GridBagConstraints.HORIZONTAL;
    customizedInstallSetting.add(customizedInstallSettingField, customConstraints);
    installSettings.add(customizedInstallSetting, BorderLayout.NORTH);
}
Also used : JCheckBox(javax.swing.JCheckBox) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) TextFieldWithBrowseButton(com.intellij.openapi.ui.TextFieldWithBrowseButton) Insets(java.awt.Insets) BorderLayout(java.awt.BorderLayout) GridBagLayout(java.awt.GridBagLayout) FileChooserDescriptor(com.intellij.openapi.fileChooser.FileChooserDescriptor) JLabel(javax.swing.JLabel) JBTextField(com.intellij.ui.components.JBTextField)

Example 2 with Insets

use of java.awt.Insets in project languagetool by languagetool-org.

the class LanguageManagerDialog method show.

public void show() {
    dialog = new JDialog(owner, true);
    dialog.setTitle(messages.getString("guiLanguageManagerDialog"));
    // close dialog when user presses Escape key:
    // TODO: taken from ConfigurationDialog, avoid duplication:
    KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
    ActionListener actionListener = new ActionListener() {

        @Override
        @SuppressWarnings("unused")
        public void actionPerformed(ActionEvent actionEvent) {
            dialog.setVisible(false);
        }
    };
    JRootPane rootPane = dialog.getRootPane();
    rootPane.registerKeyboardAction(actionListener, stroke, JComponent.WHEN_IN_FOCUSED_WINDOW);
    Container contentPane = dialog.getContentPane();
    contentPane.setLayout(new GridBagLayout());
    list = new JList<>(ruleFiles.toArray(new File[ruleFiles.size()]));
    GridBagConstraints cons = new GridBagConstraints();
    cons.insets = new Insets(4, 4, 4, 4);
    cons.gridx = 0;
    cons.gridy = 0;
    cons.fill = GridBagConstraints.BOTH;
    cons.weightx = 2.0f;
    cons.weighty = 2.0f;
    contentPane.add(new JScrollPane(list), cons);
    cons = new GridBagConstraints();
    cons.insets = new Insets(4, 4, 4, 4);
    cons.fill = GridBagConstraints.HORIZONTAL;
    JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new GridBagLayout());
    addButton = new JButton(messages.getString("guiAddButton"));
    addButton.addActionListener(this);
    cons.gridx = 1;
    cons.gridy = 0;
    buttonPanel.add(addButton, cons);
    removeButton = new JButton(messages.getString("guiRemoveButton"));
    removeButton.addActionListener(this);
    cons.gridx = 1;
    cons.gridy = 1;
    buttonPanel.add(removeButton, cons);
    closeButton = new JButton(messages.getString("guiCloseButton"));
    closeButton.addActionListener(this);
    cons.gridx = 1;
    cons.gridy = 2;
    buttonPanel.add(closeButton, cons);
    cons.gridx = 1;
    cons.gridy = 0;
    cons = new GridBagConstraints();
    cons.anchor = GridBagConstraints.NORTH;
    contentPane.add(buttonPanel, cons);
    dialog.pack();
    dialog.setSize(300, 200);
    dialog.setLocationByPlatform(true);
    dialog.setVisible(true);
}
Also used : JScrollPane(javax.swing.JScrollPane) JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) GridBagLayout(java.awt.GridBagLayout) ActionEvent(java.awt.event.ActionEvent) JButton(javax.swing.JButton) Container(java.awt.Container) ActionListener(java.awt.event.ActionListener) KeyStroke(javax.swing.KeyStroke) JRootPane(javax.swing.JRootPane) JDialog(javax.swing.JDialog)

Example 3 with Insets

use of java.awt.Insets in project groovy by apache.

the class TableLayout method addCell.

/**
     * Adds a new cell to the current grid
     * @param cell the td component
     */
public void addCell(TableLayoutCell cell) {
    GridBagConstraints constraints = cell.getConstraints();
    constraints.insets = new Insets(cellpadding, cellpadding, cellpadding, cellpadding);
    add(cell.getComponent(), constraints);
}
Also used : GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets)

Example 4 with Insets

use of java.awt.Insets in project pcgen by PCGen.

the class SummaryInfoTab method initRightPanel.

private void initRightPanel(JPanel rightPanel) {
    rightPanel.setLayout(new GridBagLayout());
    /*
		 * initialize Components
		 */
    racePanel.setOpaque(false);
    classPanel.setOpaque(false);
    ageField.setHorizontalAlignment(SwingConstants.RIGHT);
    expField.setHorizontalAlignment(SwingConstants.RIGHT);
    nextlevelField.setHorizontalAlignment(SwingConstants.RIGHT);
    nextlevelField.setEnabled(false);
    expmodField.setHorizontalAlignment(SwingConstants.RIGHT);
    //$NON-NLS-1$
    raceComboBox.setPrototypeDisplayValue("PrototypeDisplayValue");
    //$NON-NLS-1$
    classComboBox.setPrototypeDisplayValue("PrototypeDisplayValue");
    expaddButton.setMargin(new Insets(0, 8, 0, 8));
    expsubtractButton.setMargin(new Insets(0, 8, 0, 8));
    hpButton.setMargin(new Insets(0, 0, 0, 0));
    JPanel expmodPanel = new JPanel(new GridBagLayout());
    JPanel levelPanel = new JPanel();
    //$NON-NLS-1$
    JLabel raceLabel = createLabel("in_sumRace");
    //$NON-NLS-1$
    JLabel ageLabel = createLabel("in_sumAge");
    //$NON-NLS-1$
    JLabel classLabel = createLabel("in_sumClass");
    //$NON-NLS-1$
    JLabel hpLabel = createLabel("in_sumTotalHP");
    //$NON-NLS-1$
    JLabel expLabel = createLabel("in_sumCurrentXp");
    //$NON-NLS-1$
    JLabel nextlevelLabel = createLabel("in_sumNextlevel");
    //$NON-NLS-1$
    JLabel xpTableLabel = createLabel("in_sumXpTable");
    //$NON-NLS-1$
    JLabel expmodLabel = createLabel("in_sumExpMod");
    expmodLabel.setHorizontalAlignment(SwingConstants.CENTER);
    initLevelPanel(levelPanel);
    /*
		 * initialize constant variables
		 */
    Insets racePanelInsets = racePanel.getInsets();
    Insets classPanelInsets = classPanel.getInsets();
    /*
		 * racePanel
		 */
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(racePanelInsets.top, racePanelInsets.left, 0, 0);
    gbc.gridwidth = 2;
    rightPanel.add(raceLabel, gbc);
    gbc.insets = new Insets(racePanelInsets.top, 1, 1, racePanelInsets.right);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    rightPanel.add(raceComboBox, gbc);
    gbc.insets = new Insets(0, racePanelInsets.left, 0, 1);
    gbc.gridwidth = 1;
    rightPanel.add(ageLabel, gbc);
    gbc.insets = new Insets(1, 1, 1, 1);
    rightPanel.add(ageField, gbc);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(1, 1, 1, racePanelInsets.right);
    rightPanel.add(ageComboBox, gbc);
    gbc.insets = new Insets(1, racePanelInsets.left, racePanelInsets.bottom, racePanelInsets.right);
    rightPanel.add(createMonsterButton, gbc);
    /*
		 * classPanel
		 */
    gbc.gridwidth = 2;
    gbc.insets = new Insets(classPanelInsets.top, classPanelInsets.left, 0, 0);
    rightPanel.add(classLabel, gbc);
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.insets = new Insets(classPanelInsets.top, 0, 0, classPanelInsets.right);
    rightPanel.add(classComboBox, gbc);
    gbc.weighty = 1;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = new Insets(7, classPanelInsets.left, 0, classPanelInsets.right);
    rightPanel.add(levelPanel, gbc);
    gbc.insets.top = 0;
    gbc.insets.bottom = 10;
    gbc.weighty = 0;
    {
        JPanel hpPanel = new JPanel(new FlowLayout());
        hpPanel.add(hpLabel);
        hpPanel.add(Box.createHorizontalStrut(3));
        hpPanel.add(totalHPLabel);
        hpPanel.add(hpButton);
        rightPanel.add(hpPanel, gbc);
    }
    gbc.insets.bottom = 0;
    //gbc.ipady = 20;
    GridBagConstraints leftgbc = new GridBagConstraints();
    leftgbc.insets = new Insets(0, classPanelInsets.left, 0, 0);
    leftgbc.gridwidth = 2;
    leftgbc.fill = GridBagConstraints.BOTH;
    GridBagConstraints rightgbc = new GridBagConstraints();
    rightgbc.insets = new Insets(0, 0, 0, classPanelInsets.right);
    rightgbc.gridwidth = GridBagConstraints.REMAINDER;
    rightgbc.fill = GridBagConstraints.BOTH;
    rightPanel.add(expLabel, leftgbc);
    rightPanel.add(expField, rightgbc);
    rightPanel.add(nextlevelLabel, leftgbc);
    rightPanel.add(nextlevelField, rightgbc);
    rightPanel.add(xpTableLabel, leftgbc);
    rightPanel.add(xpTableComboBox, rightgbc);
    gbc.insets.top = 10;
    rightPanel.add(expmodLabel, gbc);
    {
        GridBagConstraints gbc2 = new GridBagConstraints();
        gbc2.fill = GridBagConstraints.HORIZONTAL;
        gbc2.weightx = 1.0;
        gbc2.insets = new Insets(0, 1, 0, 1);
        expmodPanel.add(expaddButton, gbc2);
        expmodPanel.add(expsubtractButton, gbc2);
    }
    leftgbc.insets.bottom = classPanelInsets.bottom;
    leftgbc.weightx = 0.3;
    rightPanel.add(expmodPanel, leftgbc);
    rightgbc.insets.bottom = classPanelInsets.bottom;
    rightgbc.weightx = 0.7;
    rightPanel.add(expmodField, rightgbc);
    gbc = new GridBagConstraints();
    gbc.gridx = gbc.gridy = 0;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.gridheight = 3;
    gbc.fill = GridBagConstraints.BOTH;
    rightPanel.add(racePanel, gbc);
    gbc.gridy = 3;
    gbc.gridheight = GridBagConstraints.REMAINDER;
    rightPanel.add(classPanel, gbc);
}
Also used : JPanel(javax.swing.JPanel) GridBagConstraints(java.awt.GridBagConstraints) Insets(java.awt.Insets) FlowLayout(java.awt.FlowLayout) GridBagLayout(java.awt.GridBagLayout) JLabel(javax.swing.JLabel)

Example 5 with Insets

use of java.awt.Insets in project pcgen by PCGen.

the class Utilities method createSignButton.

public static JButton createSignButton(Sign sign) {
    JButton button = new JButton();
    button.setMargin(new Insets(0, 8, 0, 8));
    button.setIcon(new SignIcon(sign));
    return button;
}
Also used : Insets(java.awt.Insets) SignIcon(pcgen.gui2.util.SignIcon) JButton(javax.swing.JButton)

Aggregations

Insets (java.awt.Insets)1623 GridBagConstraints (java.awt.GridBagConstraints)1049 GridBagLayout (java.awt.GridBagLayout)828 JPanel (javax.swing.JPanel)728 JLabel (javax.swing.JLabel)652 Dimension (java.awt.Dimension)411 JButton (javax.swing.JButton)366 ActionEvent (java.awt.event.ActionEvent)296 ActionListener (java.awt.event.ActionListener)277 JScrollPane (javax.swing.JScrollPane)226 BorderLayout (java.awt.BorderLayout)221 JTextField (javax.swing.JTextField)205 JCheckBox (javax.swing.JCheckBox)142 Component (java.awt.Component)113 Color (java.awt.Color)103 Font (java.awt.Font)100 Point (java.awt.Point)100 ImageIcon (javax.swing.ImageIcon)100 EmptyBorder (javax.swing.border.EmptyBorder)92 FlowLayout (java.awt.FlowLayout)91