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.kse.gui.dialogs.sign.DSignMidlet.java

private void initComponents() {
    GridBagConstraints gbcLbl = new GridBagConstraints();
    gbcLbl.gridx = 0;/*w ww.j  a  v  a 2 s  .c  o m*/
    gbcLbl.gridwidth = 1;
    gbcLbl.gridheight = 1;
    gbcLbl.insets = new Insets(5, 5, 5, 5);
    gbcLbl.anchor = GridBagConstraints.EAST;
    gbcLbl.weightx = 0;

    GridBagConstraints gbcCtrl = new GridBagConstraints();
    gbcCtrl.gridx = 1;
    gbcCtrl.gridwidth = 1;
    gbcCtrl.gridheight = 1;
    gbcCtrl.insets = new Insets(5, 5, 5, 5);
    gbcCtrl.anchor = GridBagConstraints.WEST;
    gbcCtrl.fill = GridBagConstraints.NONE;
    gbcCtrl.weightx = 1;

    GridBagConstraints gbcBrws = new GridBagConstraints();
    gbcBrws.gridx = 2;
    gbcBrws.gridwidth = 1;
    gbcBrws.gridheight = 1;
    gbcBrws.insets = new Insets(5, 5, 5, 5);
    gbcBrws.anchor = GridBagConstraints.WEST;
    gbcBrws.fill = GridBagConstraints.NONE;
    gbcBrws.weightx = 1;

    jlInputJad = new JLabel(res.getString("DSignMidlet.jlInputJad.text"));
    GridBagConstraints gbc_jlInputJad = (GridBagConstraints) gbcLbl.clone();
    gbc_jlInputJad.gridy = 0;

    jtfInputJad = new JTextField(30);
    jtfInputJad.setCaretPosition(0);
    jtfInputJad.setToolTipText(res.getString("DSignMidlet.jtfInputJad.tooltip"));
    GridBagConstraints gbc_jtfInputJad = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfInputJad.gridy = 0;

    jbInputJadBrowse = new JButton(res.getString("DSignMidlet.jbInputJadBrowse.text"));
    PlatformUtil.setMnemonic(jbInputJadBrowse,
            res.getString("DSignMidlet.jbInputJadBrowse.mnemonic").charAt(0));
    jbInputJadBrowse.setToolTipText(res.getString("DSignMidlet.jbInputJadBrowse.tooltip"));
    jbInputJadBrowse.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DSignMidlet.this);
                inputJadBrowsePressed();
            } finally {
                CursorUtil.setCursorFree(DSignMidlet.this);
            }
        }
    });
    GridBagConstraints gbc_jbInputJadBrowse = (GridBagConstraints) gbcBrws.clone();
    gbc_jbInputJadBrowse.gridy = 0;

    jlSignDirectly = new JLabel(res.getString("DSignMidlet.jlSignDirectly.text"));
    GridBagConstraints gbc_jlSignDirectly = (GridBagConstraints) gbcLbl.clone();
    gbc_jlSignDirectly.gridy = 1;

    jcbSignDirectly = new JCheckBox();
    jcbSignDirectly.setSelected(true);
    jcbSignDirectly.setToolTipText(res.getString("DSignMidlet.jcbSignDirectly.tooltip"));
    GridBagConstraints gbc_jcbSignDirectly = (GridBagConstraints) gbcCtrl.clone();
    gbc_jcbSignDirectly.gridy = 1;

    jcbSignDirectly.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent evt) {
            jtfOutputJad.setEnabled(!jcbSignDirectly.isSelected());
            jbOutputJadBrowse.setEnabled(!jcbSignDirectly.isSelected());
        }
    });

    jlOutputJad = new JLabel(res.getString("DSignMidlet.jlOutputJad.text"));
    GridBagConstraints gbc_jlOutputJad = (GridBagConstraints) gbcLbl.clone();
    gbc_jlOutputJad.gridy = 2;

    jtfOutputJad = new JTextField(30);
    jtfOutputJad.setEnabled(false);
    jtfOutputJad.setCaretPosition(0);
    jtfOutputJad.setToolTipText(res.getString("DSignMidlet.jtfOutputJad.tooltip"));
    GridBagConstraints gbc_jtfOutputJad = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfOutputJad.gridy = 2;

    jbOutputJadBrowse = new JButton(res.getString("DSignMidlet.jbOutputJadBrowse.text"));
    PlatformUtil.setMnemonic(jbOutputJadBrowse,
            res.getString("DSignMidlet.jbOutputJadBrowse.mnemonic").charAt(0));
    jbOutputJadBrowse.setToolTipText(res.getString("DSignMidlet.jbOutputJadBrowse.tooltip"));
    jbOutputJadBrowse.setEnabled(false);
    jbOutputJadBrowse.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DSignMidlet.this);
                outputJadBrowsePressed();
            } finally {
                CursorUtil.setCursorFree(DSignMidlet.this);
            }
        }
    });
    GridBagConstraints gbc_jbOutputJadBrowse = (GridBagConstraints) gbcBrws.clone();
    gbc_jbOutputJadBrowse.gridy = 2;

    jlJar = new JLabel(res.getString("DSignMidlet.jlJar.text"));
    GridBagConstraints gbc_jlJar = (GridBagConstraints) gbcLbl.clone();
    gbc_jlJar.gridy = 3;

    jtfJar = new JTextField(30);
    jtfJar.setCaretPosition(0);
    jtfJar.setToolTipText(res.getString("DSignMidlet.jtfJar.tooltip"));
    GridBagConstraints gbc_jtfJar = (GridBagConstraints) gbcCtrl.clone();
    gbc_jtfJar.gridy = 3;

    jbJarBrowse = new JButton(res.getString("DSignMidlet.jbJarBrowse.text"));
    PlatformUtil.setMnemonic(jbJarBrowse, res.getString("DSignMidlet.jbJarBrowse.mnemonic").charAt(0));
    jbJarBrowse.setToolTipText(res.getString("DSignMidlet.jbJarBrowse.tooltip"));
    jbJarBrowse.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            try {
                CursorUtil.setCursorBusy(DSignMidlet.this);
                jarBrowsePressed();
            } finally {
                CursorUtil.setCursorFree(DSignMidlet.this);
            }
        }
    });
    GridBagConstraints gbc_jbJarBrowse = (GridBagConstraints) gbcBrws.clone();
    gbc_jbJarBrowse.gridy = 3;

    jpOptions = new JPanel(new GridBagLayout());
    jpOptions.setBorder(new CompoundBorder(new EmptyBorder(5, 5, 5, 5), new EtchedBorder()));

    jpOptions.add(jlInputJad, gbc_jlInputJad);
    jpOptions.add(jtfInputJad, gbc_jtfInputJad);
    jpOptions.add(jbInputJadBrowse, gbc_jbInputJadBrowse);
    jpOptions.add(jlSignDirectly, gbc_jlSignDirectly);
    jpOptions.add(jcbSignDirectly, gbc_jcbSignDirectly);
    jpOptions.add(jlOutputJad, gbc_jlOutputJad);
    jpOptions.add(jtfOutputJad, gbc_jtfOutputJad);
    jpOptions.add(jbOutputJadBrowse, gbc_jbOutputJadBrowse);
    jpOptions.add(jlJar, gbc_jlJar);
    jpOptions.add(jtfJar, gbc_jtfJar);
    jpOptions.add(jbJarBrowse, gbc_jbJarBrowse);

    jbOK = new JButton(res.getString("DSignMidlet.jbOK.text"));
    jbOK.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            okPressed();
        }
    });

    jbCancel = new JButton(res.getString("DSignMidlet.jbCancel.text"));
    jbCancel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            cancelPressed();
        }
    });
    jbCancel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
            CANCEL_KEY);
    jbCancel.getActionMap().put(CANCEL_KEY, new AbstractAction() {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent evt) {
            cancelPressed();
        }
    });

    jpButtons = PlatformUtil.createDialogButtonPanel(jbOK, jbCancel, false);

    getContentPane().setLayout(new BorderLayout());
    getContentPane().add(jpOptions, BorderLayout.NORTH);
    getContentPane().add(jpButtons, BorderLayout.SOUTH);

    addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent evt) {
            closeDialog();
        }
    });

    setResizable(false);

    getRootPane().setDefaultButton(jbOK);

    pack();
}

From source file:org.rdv.ui.ImportDialog.java

private void initComponents() {
    JPanel container = new JPanel();
    setContentPane(container);/*from   w w  w .j a  v a  2  s.c o m*/

    InputMap inputMap = container.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW);
    ActionMap actionMap = container.getActionMap();

    container.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.weighty = 1;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.ipadx = 0;
    c.ipady = 0;

    JLabel headerLabel = new JLabel("Please specify the desired source name for the data.");
    headerLabel.setBackground(Color.white);
    headerLabel.setOpaque(true);
    headerLabel.setBorder(
            BorderFactory.createCompoundBorder(BorderFactory.createMatteBorder(0, 0, 1, 0, Color.gray),
                    BorderFactory.createEmptyBorder(10, 10, 10, 10)));
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0;
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.insets = new java.awt.Insets(0, 0, 0, 0);
    container.add(headerLabel, c);

    c.fill = GridBagConstraints.NONE;
    c.weightx = 0;
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 1;
    c.anchor = GridBagConstraints.NORTHEAST;
    c.insets = new java.awt.Insets(10, 10, 10, 5);
    container.add(new JLabel("Source name: "), c);

    sourceNameTextField = new JTextField();
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 1;
    c.gridx = 1;
    c.gridy = 1;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new java.awt.Insets(10, 0, 10, 10);
    container.add(sourceNameTextField, c);

    importProgressBar = new JProgressBar(0, 100000);
    importProgressBar.setStringPainted(true);
    importProgressBar.setValue(0);
    importProgressBar.setVisible(false);
    c.fill = GridBagConstraints.HORIZONTAL;
    c.weightx = 0.5;
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = GridBagConstraints.REMAINDER;
    ;
    c.anchor = GridBagConstraints.CENTER;
    c.insets = new java.awt.Insets(0, 10, 10, 10);
    container.add(importProgressBar, c);

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

    Action importAction = new AbstractAction() {
        /** serialization version identifier */
        private static final long serialVersionUID = -4719316285523193555L;

        public void actionPerformed(ActionEvent e) {
            importData();
        }
    };
    importAction.putValue(Action.NAME, "Import");
    inputMap.put(KeyStroke.getKeyStroke("ENTER"), "import");
    actionMap.put("export", importAction);
    importButton = new JButton(importAction);
    getRootPane().setDefaultButton(importButton);
    panel.add(importButton);

    Action cancelAction = new AbstractAction() {
        /** serialization version identifier */
        private static final long serialVersionUID = 7909429022904810958L;

        public void actionPerformed(ActionEvent e) {
            cancel();
        }
    };
    cancelAction.putValue(Action.NAME, "Cancel");
    inputMap.put(KeyStroke.getKeyStroke("ESCAPE"), "cancel");
    actionMap.put("cancel", cancelAction);
    cancelButton = new JButton(cancelAction);
    panel.add(cancelButton);

    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.5;
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = GridBagConstraints.REMAINDER;
    ;
    c.anchor = GridBagConstraints.LINE_END;
    c.insets = new java.awt.Insets(0, 0, 10, 5);
    container.add(panel, c);

    pack();

    sourceNameTextField.requestFocusInWindow();

    setLocationByPlatform(true);
    setVisible(true);
}

From source file:com.game.ui.views.ItemPanel.java

public void doCommonStuffForContent() {
    JPanel panel1 = new JPanel();
    panel1.setAlignmentX(0);/*  w  w  w .jav a 2s . c  om*/
    panel1.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
    panel1.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTHWEST;
    c.insets = new Insets(5, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 0.2;
    c.gridwidth = 2;
    JLabel dtlLbl = new JLabel(type + "Details : ");
    dtlLbl.setFont(new Font("Times New Roman", Font.BOLD, 15));
    panel1.add(dtlLbl, c);
    c.gridwidth = 1;
    c.gridy = 1;
    JLabel nameLbl = new JLabel("Name : ");
    panel1.add(nameLbl, c);
    c.gridx = 1;
    JTextField name = new JTextField("");
    name.setColumns(20);
    panel1.add(name, c);
    if (ringPanel) {
        createComponentsForRing(panel1, c);
    } else if (armourPanel) {
        createComponentsForArmour(panel1, c);
    } else if (potionPanel) {
        createComponentsForPotion(panel1, c);
    } else if (treasurePanel) {
        createComponentsForTreasure(panel1, c);
    }
    c.gridx = 0;
    c.gridy = c.gridy + 1;
    c.gridwidth = 2;
    JButton submit = new JButton("Save");
    submit.addActionListener(this);
    submit.setActionCommand("button");
    panel1.add(submit, c);
    c.gridx = 0;
    c.gridy = c.gridy + 1;
    c.gridwidth = 2;
    c.weighty = 0;
    c.weightx = 1;
    validationMess = new JLabel("Pls enter all the fields or pls choose a " + type + " from the drop down");
    validationMess.setForeground(Color.red);
    validationMess.setVisible(false);
    panel1.add(validationMess, c);
    c.gridy++;
    c.weighty = 1;
    c.weightx = 1;
    panel1.add(new JPanel(), c);
    panel1.setBorder(LineBorder.createGrayLineBorder());
    add(panel1);
    add(Box.createVerticalGlue());
}

From source file:ShowDocument.java

public URLWindow(AppletContext appletContext) {
    super("Show a Document!");
    this.appletContext = appletContext;

    JPanel contentPane = new JPanel(new GridBagLayout());
    setContentPane(contentPane);//from  w w w  .j a v a  2  s  .  c  om
    contentPane.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    GridBagConstraints c = new GridBagConstraints();
    c.fill = GridBagConstraints.HORIZONTAL;

    JLabel label1 = new JLabel("URL of document to show: ", JLabel.TRAILING);
    add(label1, c);

    urlField = new JTextField("http://java.sun.com/", 20);
    label1.setLabelFor(urlField);
    urlField.addActionListener(this);
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.weightx = 1.0;
    add(urlField, c);

    JLabel label2 = new JLabel("Window/frame to show it in: ", JLabel.TRAILING);
    c.gridwidth = 1;
    c.weightx = 0.0;
    add(label2, c);

    String[] strings = { "(browser's choice)", //don't specify
            "My Personal Window", //a window named "My Personal Window"
            "_blank", //a new, unnamed window
            "_self", "_parent", "_top" //the Frame that contained this applet
    };
    choice = new JComboBox(strings);
    label2.setLabelFor(choice);
    c.fill = GridBagConstraints.NONE;
    c.gridwidth = GridBagConstraints.REMAINDER;
    c.insets = new Insets(5, 0, 0, 0);
    c.anchor = GridBagConstraints.LINE_START;
    add(choice, c);

    JButton button = new JButton("Show document");
    button.addActionListener(this);
    c.weighty = 1.0;
    c.ipadx = 10;
    c.ipady = 10;
    c.insets = new Insets(10, 0, 0, 0);
    c.anchor = GridBagConstraints.PAGE_END;
    add(button, c);
}

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

/**
 * This method initializes this/*from  ww w.jav a2 s  .c  o m*/
 * 
 * @return void
 */
private void initialize() {
    GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
    gridBagConstraints10.gridx = 1;
    gridBagConstraints10.anchor = GridBagConstraints.NORTH;
    gridBagConstraints10.insets = new Insets(10, 0, 0, 0);
    gridBagConstraints10.fill = GridBagConstraints.NONE;
    gridBagConstraints10.gridy = 0;
    GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
    gridBagConstraints9.gridx = 0;
    gridBagConstraints9.insets = new Insets(10, 10, 10, 0);
    gridBagConstraints9.fill = GridBagConstraints.BOTH;
    gridBagConstraints9.weightx = 0.1;
    gridBagConstraints9.weighty = 0.1;
    gridBagConstraints9.gridheight = 1;
    gridBagConstraints9.gridy = 0;

    JPanel p = new JPanel();
    p.setSize(600, 300);
    p.setLayout(new GridBagLayout());
    p.add(getJPanelPjtList(), gridBagConstraints9);
    p.add(getJPanelButton(), gridBagConstraints10);

    getContentPane().add(p);
}

From source file:de.codesourcery.jasm16.ide.ui.utils.UIUtils.java

/**
 * /*from  www .  ja v a2  s. c om*/
 * @param parent
 * @param title
 * @param message
 * @return <code>true</code> if project should also be physically deleted,
 * <code>false</code> is project should be deleted but all files should be left alone,
 * <code>null</code> if user cancelled the dialog/project should not be deleted
 */
public static Boolean showDeleteProjectDialog(IAssemblyProject project) {
    final JDialog dialog = new JDialog((Window) null, "Delete project " + project.getName());

    dialog.setModal(true);

    final JTextArea message = createMultiLineLabel(
            "Do you really want to delete project '" + project.getName() + " ?");
    final JCheckBox checkbox = new JCheckBox("Delete project files");

    final DialogResult[] outcome = { DialogResult.CANCEL };

    final JButton yesButton = new JButton("Yes");
    yesButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            outcome[0] = DialogResult.YES;
            dialog.dispose();
        }
    });

    final JButton noButton = new JButton("No");
    noButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            outcome[0] = DialogResult.NO;
            dialog.dispose();
        }
    });
    final JButton cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            outcome[0] = DialogResult.CANCEL;
            dialog.dispose();
        }
    });

    final JPanel buttonPanel = new JPanel();
    buttonPanel.setLayout(new FlowLayout());
    buttonPanel.add(yesButton);
    buttonPanel.add(noButton);
    buttonPanel.add(cancelButton);

    final JPanel messagePanel = new JPanel();
    messagePanel.setLayout(new GridBagLayout());

    GridBagConstraints cnstrs = constraints(0, 0, true, false, GridBagConstraints.NONE);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.weighty = 0;
    cnstrs.gridheight = 1;
    messagePanel.add(message, cnstrs);

    cnstrs = constraints(0, 1, true, true, GridBagConstraints.NONE);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = 1;
    cnstrs.weighty = 0;
    messagePanel.add(checkbox, cnstrs);

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

    cnstrs = constraints(0, 0, true, false, GridBagConstraints.NONE);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = 1;
    cnstrs.weighty = 0;
    cnstrs.insets = new Insets(5, 2, 5, 2); // top,left,bottom,right         
    panel.add(messagePanel, cnstrs);

    cnstrs = constraints(0, 1, true, true, GridBagConstraints.HORIZONTAL);
    cnstrs.gridwidth = GridBagConstraints.REMAINDER;
    cnstrs.gridheight = 1;
    cnstrs.weighty = 0;
    cnstrs.insets = new Insets(0, 2, 10, 2); // top,left,bottom,right      
    panel.add(buttonPanel, cnstrs);

    dialog.getContentPane().add(panel);
    dialog.pack();
    dialog.setVisible(true);

    if (outcome[0] != DialogResult.YES) {
        return null;
    }
    return checkbox.isSelected();
}

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

/**
 * Initialises all GUI elements./*from  w  w  w.  j  a  v  a  2s . c om*/
 */
private void initGui(String message, String details) {
    // 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(false);
    this.setDefaultCloseOperation(JDialog.HIDE_ON_CLOSE);

    JHtmlLabel messageLabel = skinsFactory.createSkinnedJHtmlLabel("ErrorMessageLabel", hyperlinkListener);
    messageLabel.setText(message);
    messageLabel.setHorizontalAlignment(JLabel.CENTER);
    JHtmlLabel detailsLabel = skinsFactory.createSkinnedJHtmlLabel("ErrorDetailsLabel", hyperlinkListener);
    detailsLabel.setText(details);

    JButton okButton = skinsFactory.createSkinnedJButton("ErrorOkButton");
    okButton.setName("OK");
    okButton.setText("OK");
    okButton.addActionListener(this);
    this.getRootPane().setDefaultButton(okButton);

    JPanel dialogPanel = skinsFactory.createSkinnedJPanel("ErrorDialogPanel");

    int row = 0;
    dialogPanel.setLayout(new GridBagLayout());
    dialogPanel.add(messageLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(12, 5, 12, 5), 0, 0));
    dialogPanel.add(detailsLabel, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, insetsDefault, 0, 0));
    dialogPanel.add(okButton, new GridBagConstraints(0, row++, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    this.getContentPane().add(dialogPanel);
    this.pack();
    this.setLocationRelativeTo(this.getOwner());
}

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

/**
 * Builds the main panel/*from w  w  w  . j  ava 2  s  .  c o m*/
 * @return
 */
private JPanel buildMainPanel() {

    int row;
    GridBagLayout layout;
    GridBagConstraints constraints;
    JPanel main;
    JLabel label;

    layout = new GridBagLayout();
    constraints = new GridBagConstraints();
    main = new JPanel(layout);
    row = 0;
    GUIUtils.add(main,
            new JLabel(stringFactory.getString(LabelStringFactory.SAVEASCONFIG_FRAME_CURRENT_CONFIGURATION)),
            layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, GridBagConstraints.NONE,
            GUIUtils.MED_INSETS);
    GUIUtils.add(main, label = new JLabel(userPrefs.getConfiguration()), layout, constraints, row++, 1, 1, 1,
            GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS);
    label.setForeground(Color.BLUE);
    GUIUtils.add(main, new JSeparator(), layout, constraints, row++, 0, 1, 2, 1, 1, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, GUIUtils.MED_INSETS);
    GUIUtils.add(main,
            new JLabel(stringFactory.getString(LabelStringFactory.SAVEASCONFIG_FRAME_CONFIGURATION_NAME)),
            layout, constraints, row, 0, 1, 1, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE,
            GUIUtils.SMALL_INSETS);
    GUIUtils.add(main, new JScrollPane(configurationName = new JTextField(20)), layout, constraints, row++, 1,
            1, 1, GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS);
    GUIUtils.add(main, new JLabel(stringFactory.getString(LabelStringFactory.SAVEASCONFIG_FRAME_MAKE_DEFAULT)),
            layout, constraints, row, 0, 1, 1, GridBagConstraints.EAST, GridBagConstraints.NONE,
            GUIUtils.SMALL_INSETS);
    GUIUtils.add(main, makeDefault = new JCheckBox(), layout, constraints, row++, 1, 1, 1,
            GridBagConstraints.WEST, GridBagConstraints.NONE, GUIUtils.SMALL_INSETS);
    return main;
}

From source file:org.mbs3.juniuploader.gui.pnlFormVariables.java

private void initGUI() {
    try {/*from w  w  w.  j  a v  a  2 s.c om*/
        GridBagLayout thisLayout = new GridBagLayout();
        this.setLayout(thisLayout);
        {
            btnAddPair = new JButton();
            this.add(btnAddPair, new GridBagConstraints(3, 3, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
            btnAddPair.setText("Add a New Pair");
            btnAddPair.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    btnAddPairActionPerformed(evt);
                }
            });
        }
        {
            btnRemPair = new JButton();
            this.add(btnRemPair, new GridBagConstraints(3, 6, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
            btnRemPair.setText("Remove Selected Pair");
            btnRemPair.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    btnRemPairActionPerformed(evt);
                }
            });
        }
        {

            cmbFormGroups = new JComboBox();
            this.add(cmbFormGroups, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
            cmbFormGroups.setModel(frmMain.formGroups);
            cmbFormGroups.addItemListener(new ItemListener() {
                public void itemStateChanged(ItemEvent evt) {
                    cmbFormGroupsItemStateChanged(evt);
                }
            });
        }
        {

            DefaultComboBoxModel groups = frmMain.formGroups;
            FormPairGroup fpg = (FormPairGroup) groups.getSelectedItem();
            DefaultComboBoxModel dcbmFormPairs;
            if (fpg != null)
                dcbmFormPairs = new DefaultComboBoxModel(fpg.getPairs());
            else
                dcbmFormPairs = new DefaultComboBoxModel();

            lstFormPairValues = new JList();
            lstFormPairValues.setModel(dcbmFormPairs);

            this.add(lstFormPairValues, new GridBagConstraints(1, 3, 1, 4, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
            lstFormPairValues.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
        }

        {
            btnAddGroup = new JButton();
            this.add(btnAddGroup, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
            btnAddGroup.setText("Add a Group");
            btnAddGroup.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    btnAddGroupActionPerformed(evt);
                }
            });
        }
        {
            btnRemSelGrp = new JButton();
            this.add(btnRemSelGrp, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
            btnRemSelGrp.setText("Remove This Group");
            btnRemSelGrp.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent evt) {
                    btnRemSelGrpActionPerformed(evt);
                }
            });
        }
        {
            btnEditPair = new JButton();
            this.add(btnEditPair, new GridBagConstraints(3, 4, 3, 1, 0.0, 0.0, GridBagConstraints.CENTER,
                    GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
            btnEditPair.setText("Edit This Pair");
            btnEditPair.setEnabled(false);
        }
        thisLayout.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.1, 0.1, 0.0, 0.1, 0.0 };
        thisLayout.rowHeights = new int[] { 8, 24, 9, 20, 7, 8, 7, 9 };
        thisLayout.columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
        thisLayout.columnWidths = new int[] { 11, 335, 9, 97, 10, 119, 10 };
        this.setPreferredSize(new java.awt.Dimension(614, 382));
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:savant.plugin.Tool.java

@Override
public void init(JPanel panel) {
    mainPanel = panel;//  w  w  w .j av a  2 s .  c om
    panel.setLayout(new CardLayout());

    JPanel settingsPanel = new ToolSettingsPanel(this);
    panel.add(new JScrollPane(settingsPanel), "Settings");

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

    // Left side filler.
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(5, 100, 0, 100);
    waitCard.add(new JLabel(getDescriptor().getName()), gbc);

    progressBar = new JProgressBar();
    progressBar.setPreferredSize(new Dimension(240, progressBar.getPreferredSize().height));
    waitCard.add(progressBar, gbc);

    progressInfo = new JLabel();
    progressInfo.setAlignmentX(1.0f);
    Font f = progressInfo.getFont();
    f = f.deriveFont(f.getSize() - 2.0f);
    progressInfo.setFont(f);
    waitCard.add(progressInfo, gbc);

    cancelButton = new JButton("Cancel");
    cancelButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            if (toolProc != null) {
                Process p = toolProc;
                toolProc = null;
                p.destroy();
            }
            showCard("Settings");
        }
    });
    gbc.fill = GridBagConstraints.NONE;
    waitCard.add(cancelButton, gbc);

    // Console output at the bottom.
    console = new JTextArea();
    console.setFont(f);
    console.setLineWrap(false);
    console.setEditable(false);

    JScrollPane consolePane = new JScrollPane(console);
    consolePane.setPreferredSize(new Dimension(800, 200));
    gbc.weighty = 1.0;
    gbc.insets = new Insets(30, 5, 5, 5);
    gbc.fill = GridBagConstraints.BOTH;
    waitCard.add(consolePane, gbc);

    panel.add(waitCard, "Progress");
}