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:ro.nextreports.designer.wizpublish.SelectEntityWizardPanel.java

private void jbInit() {
    this.setLayout(new GridBagLayout());
    banner.setTitle(I18NSupport.getString("wizard.publish.entities.select"));

    btnAdd.setIcon(ImageUtil.getImageIcon("add"));
    btnAdd.setPreferredSize(btnDim);/*from ww  w .  ja  va  2s .c o  m*/
    btnAdd.setMinimumSize(btnDim);
    btnAdd.setMaximumSize(btnDim);
    btnAdd.setToolTipText(I18NSupport.getString("listselectionpanel.add"));
    btnAdd.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            add();
        }
    });

    btnRem.setIcon(ImageUtil.getImageIcon("delete"));
    btnRem.setPreferredSize(btnDim);
    btnRem.setMinimumSize(btnDim);
    btnRem.setMaximumSize(btnDim);
    btnRem.setToolTipText(I18NSupport.getString("listselectionpanel.remove"));
    btnRem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            remove();
        }
    });

    list.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            if (e.getClickCount() == 2) {
                remove();
            }
        }
    });

    scrList.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
    scrList.setMinimumSize(scrDim);
    scrList.setPreferredSize(scrDim);
    scrList.getViewport().add(list, null);
    list.setModel(listModel);

    JPanel btnPanel = new JPanel();
    btnPanel.setLayout(new BoxLayout(btnPanel, BoxLayout.Y_AXIS));
    btnPanel.add(Box.createGlue());
    btnPanel.add(btnAdd);
    btnPanel.add(Box.createRigidArea(new Dimension(5, 5)));
    btnPanel.add(btnRem);
    btnPanel.add(Box.createGlue());

    add(scrList, new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.NORTHEAST,
            GridBagConstraints.BOTH, new Insets(5, 5, 5, 5), 0, 0));

    add(btnPanel, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTH,
            GridBagConstraints.NONE, new Insets(5, 0, 5, 5), 0, 0));
}

From source file:ImageOpByRomain.java

private void buildControlsPanel() {
    JPanel controls = new JPanel(new GridBagLayout());

    // red component
    controls.add(new JLabel("Red: 0"), new GridBagConstraints(0, 0, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_END,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(redSlider = new JSlider(0, 255, 255), new GridBagConstraints(1, 0, 1, 1, 1.0, 1.0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(new JLabel("255"), new GridBagConstraints(2, 0, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

    // green component
    controls.add(new JLabel("Green: 0"), new GridBagConstraints(0, 1, 1, 1, 1.0, 1.0,
            GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(greenSlider = new JSlider(0, 255, 255), new GridBagConstraints(1, 1, 1, 1, 1.0, 1.0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(new JLabel("255"), new GridBagConstraints(2, 1, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

    // blue component
    controls.add(new JLabel("Blue: 0"), new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0,
            GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(blueSlider = new JSlider(0, 255, 255), new GridBagConstraints(1, 2, 1, 1, 1.0, 1.0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(new JLabel("255"), new GridBagConstraints(2, 2, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

    // mix value//from  w w  w . jav  a 2 s  .  c  o  m
    controls.add(new JLabel("Mix: 0%"), new GridBagConstraints(0, 3, 1, 1, 1.0, 1.0,
            GridBagConstraints.LINE_END, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(alphaSlider = new JSlider(0, 100, 50), new GridBagConstraints(1, 3, 1, 1, 1.0, 1.0,
            GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    controls.add(new JLabel("100%"), new GridBagConstraints(2, 3, 1, 1, 1.0, 1.0, GridBagConstraints.LINE_START,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0));

    // change listener
    ChangeListener colorChange = new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            imagePanel.setColor(new Color(redSlider.getValue(), greenSlider.getValue(), blueSlider.getValue()));
        }
    };
    redSlider.addChangeListener(colorChange);
    greenSlider.addChangeListener(colorChange);
    blueSlider.addChangeListener(colorChange);

    // alpha listener
    alphaSlider.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            imagePanel.setMix((float) alphaSlider.getValue() / 100.0f);
        }
    });

    add(controls, BorderLayout.SOUTH);
}

From source file:com.sshtools.common.ui.SshToolsConnectionKerberosTab.java

/**
 * Creates a new SshToolsConnectionKerberosTab object.
 *//* w  w  w .  j a  v a  2  s .c  o m*/
public SshToolsConnectionKerberosTab() {
    super();

    //  Create the main connection details panel
    JPanel mainConnectionDetailsPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(0, 2, 2, 2);
    //  enabled option
    //gbc.fill = GridBagConstraints.NONE;
    useKerberos = new JCheckBox("Use MyProxy Kerberos support");
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, useKerberos, gbc, GridBagConstraints.REMAINDER);
    //  Host name
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Hostname"), gbc, GridBagConstraints.REMAINDER);
    //gbc.fill = GridBagConstraints.HORIZONTAL;
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextHostname, gbc, GridBagConstraints.REMAINDER);
    //gbc.fill = GridBagConstraints.NONE;

    //  Username
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Username"), gbc, GridBagConstraints.REMAINDER);
    //gbc.fill = GridBagConstraints.HORIZONTAL;
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextUsername, gbc, GridBagConstraints.REMAINDER);

    JPanel settingsPanel = new JPanel(new GridBagLayout());
    settingsPanel
            .setBorder(BorderFactory.createTitledBorder("Settings if krb5.conf or krb5.ini file not found: "));
    GridBagConstraints gbc2 = new GridBagConstraints();
    gbc2.fill = GridBagConstraints.HORIZONTAL;
    gbc2.anchor = GridBagConstraints.NORTHWEST;
    gbc2.insets = new Insets(0, 2, 2, 2);
    gbc2.weightx = 1.0;

    //  realm
    UIUtil.jGridBagAdd(settingsPanel, new JLabel("Realm"), gbc2, GridBagConstraints.REMAINDER);
    gbc2.fill = GridBagConstraints.HORIZONTAL;
    UIUtil.jGridBagAdd(settingsPanel, jTextRealm, gbc2, GridBagConstraints.REMAINDER);
    gbc2.fill = GridBagConstraints.NONE;

    //  kdc
    UIUtil.jGridBagAdd(settingsPanel, new JLabel("KDC"), gbc2, GridBagConstraints.REMAINDER);
    gbc2.fill = GridBagConstraints.HORIZONTAL;
    gbc2.weighty = 1.0;
    UIUtil.jGridBagAdd(settingsPanel, jTextKDC, gbc2, GridBagConstraints.REMAINDER);
    gbc2.fill = GridBagConstraints.NONE;

    //
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    gbc.insets = new Insets(4, 2, 2, 2);
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, settingsPanel, gbc, GridBagConstraints.REMAINDER);

    IconWrapperPanel iconMainConnectionDetailsPanel = new IconWrapperPanel(
            new ResourceIcon(SshToolsConnectionHostTab.class, AUTH_ICON), mainConnectionDetailsPanel);

    setLayout(new GridBagLayout());
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.BOTH;
    gbc.anchor = GridBagConstraints.WEST;
    gbc.insets = new Insets(2, 2, 2, 2);
    gbc.weightx = 1.0;
    gbc.weighty = 1.0;
    UIUtil.jGridBagAdd(this, iconMainConnectionDetailsPanel, gbc, GridBagConstraints.REMAINDER);

}

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

protected JPanel createPanel() {
    textArea.setEditable(false);/*from   w ww  .j a  va2s . c o m*/
    setColors(textArea);
    textArea.setFont(getMonospacedFont());
    textArea.setEditable(false);

    // dump panel
    final JPanel dumpPanel = new JPanel();
    setColors(dumpPanel);
    dumpPanel.setLayout(new GridBagLayout());
    GridBagConstraints cnstrs = constraints(0, 0, true, true, GridBagConstraints.BOTH);
    dumpPanel.add(textArea, cnstrs);

    // toolbar panel
    final JPanel toolbarPanel = new JPanel();
    setColors(toolbarPanel);
    toolbarPanel.setLayout(new GridBagLayout());

    cnstrs = constraints(0, 0, false, false, GridBagConstraints.NONE);
    toolbarPanel.add(new JLabel("Goto"), cnstrs);

    final JTextField gotoTextfield = new JTextField();
    gotoTextfield.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent e) {
            final String val = gotoTextfield.getText();
            Address adr;
            if (StringUtils.isBlank(val)) {
                gotoTextfield.setText("0000");
                adr = Address.wordAddress(0);
            } else {
                try {
                    adr = Address.wordAddress(Misc.parseHexString(val));
                } catch (NumberFormatException e1) {
                    gotoTextfield.setText("0000");
                    adr = Address.wordAddress(0);
                }
            }
            dumpStartAddress = adr;
            refreshDisplay();
        }
    });

    cnstrs = constraints(0, 1, true, true, GridBagConstraints.HORIZONTAL);
    toolbarPanel.add(gotoTextfield, cnstrs);

    // create result panel
    final JPanel result = new JPanel();
    setColors(result);
    result.setLayout(new GridBagLayout());
    cnstrs = constraints(0, 0, false, true, GridBagConstraints.BOTH);
    result.add(dumpPanel, cnstrs);
    cnstrs = constraints(1, 0, true, true, GridBagConstraints.VERTICAL);
    result.add(toolbarPanel, cnstrs);

    textArea.addKeyListener(new PagingKeyAdapter() {

        @Override
        protected void onePageUp() {
            HexDumpView.this.onePageUp();
        }

        @Override
        protected void onePageDown() {
            HexDumpView.this.onePageDown();
        }

        @Override
        protected void oneLineUp() {
            HexDumpView.this.oneLineUp();
        }

        @Override
        protected void oneLineDown() {
            HexDumpView.this.oneLineDown();
        }
    });

    result.addComponentListener(new ComponentAdapter() {

        @Override
        public void componentResized(ComponentEvent e) {
            refreshDisplay();
        }
    });

    return result;
}

From source file:com._17od.upm.gui.OptionsDialog.java

public OptionsDialog(JFrame frame) {
    super(frame, Translator.translate("options"), true);

    Container container = getContentPane();

    // Create a pane with an empty border for spacing
    Border emptyBorder = BorderFactory.createEmptyBorder(2, 5, 5, 5);
    JPanel emptyBorderPanel = new JPanel();
    emptyBorderPanel.setLayout(new BoxLayout(emptyBorderPanel, BoxLayout.Y_AXIS));
    emptyBorderPanel.setBorder(emptyBorder);
    container.add(emptyBorderPanel);/*  ww w .  j  a  va2 s . co m*/

    // ******************
    // *** The DB TO Load On Startup Section
    // ******************
    // Create a pane with an title etched border
    Border etchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
    Border etchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder,
            ' ' + Translator.translate("general") + ' ');
    JPanel mainPanel = new JPanel(new GridBagLayout());
    mainPanel.setBorder(etchedTitleBorder);
    emptyBorderPanel.add(mainPanel);

    GridBagConstraints c = new GridBagConstraints();

    // The "Database to Load on Startup" row
    JLabel urlLabel = new JLabel(Translator.translate("dbToLoadOnStartup"));
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(urlLabel, c);

    // The "Database to Load on Startup" input field row
    dbToLoadOnStartup = new JTextField(Preferences.get(Preferences.ApplicationOptions.DB_TO_LOAD_ON_STARTUP),
            25);
    dbToLoadOnStartup.setHorizontalAlignment(JTextField.LEFT);
    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(dbToLoadOnStartup, c);

    JButton dbToLoadOnStartupButton = new JButton("...");
    dbToLoadOnStartupButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            getDBToLoadOnStartup();
        }
    });
    c.gridx = 1;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_END;
    c.insets = new Insets(0, 0, 5, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(dbToLoadOnStartupButton, c);

    // The "Language" label row
    JLabel localeLabel = new JLabel(Translator.translate("language"));
    c.gridx = 0;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(localeLabel, c);

    // The "Locale" field row
    localeComboBox = new JComboBox(getSupportedLocaleNames());
    for (int i = 0; i < localeComboBox.getItemCount(); i++) {
        // If the locale language is blank then set it to the English language
        // I'm not sure why this happens. Maybe it's because the default locale
        // is English???
        String currentLanguage = Translator.getCurrentLocale().getLanguage();
        if (currentLanguage.equals("")) {
            currentLanguage = "en";
        }

        if (currentLanguage.equals(Translator.SUPPORTED_LOCALES[i].getLanguage())) {
            localeComboBox.setSelectedIndex(i);
            break;
        }
    }
    c.gridx = 0;
    c.gridy = 3;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 8, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(localeComboBox, c);

    // The "Hide account password" row
    Boolean hideAccountPassword = new Boolean(
            Preferences.get(Preferences.ApplicationOptions.ACCOUNT_HIDE_PASSWORD, "true"));
    hideAccountPasswordCheckbox = new JCheckBox(Translator.translate("hideAccountPassword"),
            hideAccountPassword.booleanValue());
    c.gridx = 0;
    c.gridy = 4;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 2, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(hideAccountPasswordCheckbox, c);

    // The "Database auto lock" row
    Boolean databaseAutoLock = new Boolean(
            Preferences.get(Preferences.ApplicationOptions.DATABASE_AUTO_LOCK, "false"));
    databaseAutoLockCheckbox = new JCheckBox(Translator.translate("databaseAutoLock"),
            databaseAutoLock.booleanValue());
    c.gridx = 0;
    c.gridy = 5;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 2, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(databaseAutoLockCheckbox, c);
    databaseAutoLockCheckbox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            databaseAutoLockTime.setEnabled(e.getStateChange() == ItemEvent.SELECTED);
        }
    });

    // The "Database auto lock" field row
    databaseAutoLockTime = new JTextField(
            Preferences.get(Preferences.ApplicationOptions.DATABASE_AUTO_LOCK_TIME), 5);
    c.gridx = 1;
    c.gridy = 5;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(databaseAutoLockTime, c);
    databaseAutoLockTime.setEnabled(databaseAutoLockCheckbox.isSelected());

    // The "Generated password length" row
    accountPasswordLengthLabel = new JLabel(Translator.translate("generatedPasswodLength"));
    c.gridx = 0;
    c.gridy = 6;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 2, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    mainPanel.add(accountPasswordLengthLabel, c);

    accountPasswordLength = new JTextField(
            Preferences.get(Preferences.ApplicationOptions.ACCOUNT_PASSWORD_LENGTH, "8"), 5);
    c.gridx = 1;
    c.gridy = 6;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    mainPanel.add(accountPasswordLength, c);

    // Some spacing
    emptyBorderPanel.add(Box.createVerticalGlue());

    // ******************
    // *** The HTTPS Section
    // ******************
    // Create a pane with an title etched border
    Border httpsEtchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder, " HTTPS ");
    final JPanel httpsPanel = new JPanel(new GridBagLayout());
    httpsPanel.setBorder(httpsEtchedTitleBorder);
    emptyBorderPanel.add(httpsPanel);

    // The "Accept Self Sigend Certificates" checkbox row
    Boolean acceptSelfSignedCerts = new Boolean(
            Preferences.get(Preferences.ApplicationOptions.HTTPS_ACCEPT_SELFSIGNED_CERTS, "false"));
    acceptSelfSignedCertsCheckbox = new JCheckBox(Translator.translate("acceptSelfSignedCerts"),
            acceptSelfSignedCerts.booleanValue());
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 2, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    httpsPanel.add(acceptSelfSignedCertsCheckbox, c);

    // ******************
    // *** The Proxy Section
    // ******************
    // Create a pane with an title etched border
    Border proxyEtchedTitleBorder = BorderFactory.createTitledBorder(etchedBorder,
            ' ' + Translator.translate("httpProxy") + ' ');
    final JPanel proxyPanel = new JPanel(new GridBagLayout());
    proxyPanel.setBorder(proxyEtchedTitleBorder);
    emptyBorderPanel.add(proxyPanel);

    // The "Enable Proxy" row
    Boolean proxyEnabled = new Boolean(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_ENABLED));
    enableProxyCheckbox = new JCheckBox(Translator.translate("enableProxy"), proxyEnabled.booleanValue());
    enableProxyCheckbox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                enableProxyComponents(true);
            } else {
                enableProxyComponents(false);
            }
        }
    });
    c.gridx = 0;
    c.gridy = 0;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 2, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(enableProxyCheckbox, c);

    // The "HTTP Proxy" label row
    proxyLabel = new JLabel(Translator.translate("httpProxy"));
    c.gridx = 0;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(proxyLabel, c);

    // The "HTTP Proxy Port" label
    proxyPortLabel = new JLabel(Translator.translate("port"));
    c.gridx = 1;
    c.gridy = 1;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(proxyPortLabel, c);

    // The "HTTP Proxy" field row
    httpProxyHost = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_HOST), 20);
    c.gridx = 0;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    proxyPanel.add(httpProxyHost, c);

    httpProxyPort = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_PORT), 6);
    c.gridx = 1;
    c.gridy = 2;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 5);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    proxyPanel.add(httpProxyPort, c);

    // The "HTTP Proxy Username" label row
    proxyUsernameLabel = new JLabel(Translator.translate("httpProxyUsername"));
    c.gridx = 0;
    c.gridy = 3;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(proxyUsernameLabel, c);

    // The "HTTP Proxy Username" field row
    httpProxyUsername = new JTextField(Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_USERNAME), 20);
    c.gridx = 0;
    c.gridy = 4;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.HORIZONTAL;
    proxyPanel.add(httpProxyUsername, c);

    // The "HTTP Proxy Password" label row
    proxyPasswordLabel = new JLabel(Translator.translate("httpProxyPassword"));
    c.gridx = 0;
    c.gridy = 5;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 3, 0);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 2;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(proxyPasswordLabel, c);

    // The "HTTP Proxy Password" field row
    String encodedPassword = Preferences.get(Preferences.ApplicationOptions.HTTP_PROXY_PASSWORD);
    String decodedPassword = null;
    if (encodedPassword != null) {
        decodedPassword = new String(Base64.decodeBase64(encodedPassword.getBytes()));
    }
    httpProxyPassword = new JPasswordField(decodedPassword, 20);
    c.gridx = 0;
    c.gridy = 6;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 5);
    c.weightx = 1;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    proxyPanel.add(httpProxyPassword, c);

    hidePasswordCheckbox = new JCheckBox(Translator.translate("hide"), true);
    defaultEchoChar = httpProxyPassword.getEchoChar();
    hidePasswordCheckbox.addItemListener(new ItemListener() {
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                httpProxyPassword.setEchoChar(defaultEchoChar);
            } else {
                httpProxyPassword.setEchoChar((char) 0);
            }
        }
    });
    c.gridx = 1;
    c.gridy = 6;
    c.anchor = GridBagConstraints.LINE_START;
    c.insets = new Insets(0, 5, 5, 0);
    c.weightx = 0;
    c.weighty = 0;
    c.gridwidth = 1;
    c.fill = GridBagConstraints.NONE;
    proxyPanel.add(hidePasswordCheckbox, c);

    // Some spacing
    emptyBorderPanel.add(Box.createVerticalGlue());

    // The buttons row
    JPanel buttonPanel = new JPanel(new FlowLayout());
    emptyBorderPanel.add(buttonPanel);
    JButton okButton = new JButton(Translator.translate("ok"));
    okButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            okButtonAction();
        }
    });
    buttonPanel.add(okButton);

    JButton cancelButton = new JButton(Translator.translate("cancel"));
    cancelButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            setVisible(false);
            dispose();
        }
    });
    buttonPanel.add(cancelButton);

    enableProxyComponents(proxyEnabled.booleanValue());
}

From source file:verdandi.ui.ProjectViewerPanel.java

private JToolBar getToolbar() {
    // JPanel toolbar = new JPanel();
    // toolbar.setLayout(new BoxLayout(toolbar, BoxLayout.LINE_AXIS));
    JToolBar toolbar = new JToolBar(SwingConstants.HORIZONTAL);

    toolbar.setLayout(new GridBagLayout());

    GridBagConstraints c = new GridBagConstraints();
    c.gridx = 0;/*ww  w  .  ja v  a2s.c  om*/
    c.gridy = 0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.WEST;
    c.weightx = 0.0;
    c.weighty = 0.0;

    URL imageURL = null;
    imageURL = Thread.currentThread().getContextClassLoader()
            .getResource(THEME_RC.getString("icon.project.add"));
    ImageIcon addProjectIcon = new ImageIcon(imageURL, "add");

    JButton addProject = new JButton(addProjectIcon);
    addProject.setActionCommand(CMD_ADD_PROJECT);
    addProject.setToolTipText(RB.getString("projectviewer.add.tooltip"));
    addProject.addActionListener(this);
    toolbar.add(addProject, c);
    c.gridx++;

    imageURL = getClass().getClassLoader().getResource(THEME_RC.getString("icon.project.edit"));
    ImageIcon editProjectIcon = new ImageIcon(imageURL, "edit");

    JButton editProject = new JButton(editProjectIcon);
    editProject.setActionCommand(CMD_EDIT_PROJECT);
    editProject.setToolTipText(RB.getString("projectviewer.edit.tooltip"));
    editProject.addActionListener(this);
    toolbar.add(editProject, c);
    c.gridx++;

    imageURL = getClass().getClassLoader().getResource(THEME_RC.getString("icon.projects.import"));
    ImageIcon importProjectIcon = new ImageIcon(imageURL, "import");
    JButton importProject = new JButton(importProjectIcon);
    importProject.setActionCommand(CMD_IMPORT_PROJECT);
    importProject.setToolTipText(RB.getString("projectviewer.import.tooltip"));
    importProject.addActionListener(this);
    toolbar.add(importProject, c);
    c.gridx++;

    // THEME_RC.getString("")
    imageURL = getClass().getClassLoader().getResource(THEME_RC.getString("icon.projects.export"));
    ImageIcon exportProjectIcon = new ImageIcon(imageURL, "export");
    JButton exportProject = new JButton(exportProjectIcon);
    exportProject.setActionCommand(CMD_EXPORT_PROJECT);
    exportProject.setToolTipText(RB.getString("projectviewer.export.tooltip"));
    exportProject.addActionListener(this);
    toolbar.add(exportProject, c);
    c.gridx++;

    toolbar.add(new JToolBar.Separator(), c);
    c.gridx++;

    imageURL = getClass().getClassLoader().getResource(THEME_RC.getString("icon.project.hide.active"));
    hideActiveIcon = new ImageIcon(imageURL, "hide active");
    imageURL = getClass().getClassLoader().getResource(THEME_RC.getString("icon.project.show.active"));
    showActiveIcon = new ImageIcon(imageURL, "show active");
    toggleShowActive = new JToggleButton(hideActiveIcon);
    toggleShowActive.setActionCommand(CMD_TOGGLE_SHOW_ACTIVE);
    toggleShowActive.setToolTipText(RB.getString("projectviewer.toggleshowactive.tooltip"));
    toggleShowActive.addActionListener(this);
    toolbar.add(toggleShowActive, c);
    c.gridx++;

    c.weightx = 0.5;
    toolbar.add(Box.createHorizontalGlue(), c);
    c.weightx = 0.0;
    c.gridx++;

    c.insets = new Insets(0, 5, 0, 5);
    toolbar.add(new JLabel("Filter"), c);
    c.gridx++;
    c.insets = new Insets(0, 0, 0, 0);
    searchField = new JTextField(10);
    searchField.getDocument().addDocumentListener(this);
    searchField.setToolTipText(RB.getString("projectviewer.searchfield.tooltip"));
    toolbar.add(searchField, c);

    toolbar.setFloatable(false);
    return toolbar;
}

From source file:verdandi.ui.settings.DefaultSettingsPanel.java

private JPanel getPersistenceSettingsPanel() {
    JPanel res = new JPanel(new GridBagLayout());
    res.setBorder(BorderFactory.createTitledBorder(RC.getString("settingseditor.persistence.title")));

    GridBagConstraints c = new GridBagConstraints();
    c.insets = new Insets(5, 5, 5, 5);
    c.gridy = 0;//from   ww  w. j a v a 2  s  .c om
    c.weighty = 0.0;
    c.anchor = GridBagConstraints.WEST;

    PersistenceConfigurationDescription pdc = conf.getPersistenceConfigurationDescription();
    if (pdc == null) {
        return res;
    }

    for (String key : pdc.getOrderedKeys()) {
        c.weightx = 0.1;
        c.gridx = 0;
        c.fill = GridBagConstraints.NONE;
        JLabel lbl = new JLabel(pdc.get(key).getName());
        lbl.setToolTipText(pdc.get(key).getDescription());
        res.add(lbl, c);
        c.gridx = 1;
        c.weightx = 1.0;
        c.fill = GridBagConstraints.HORIZONTAL;
        JTextField txt = new JTextField(20);
        txt.setText(conf.getString(pdc.get(key).getConfigKey()));
        res.add(txt, c);
        persistenceFields.put(pdc.get(key).getConfigKey(), txt);
        c.gridy++;
    }

    return res;
}

From source file:com.sshtools.common.ui.SshToolsConnectionHostTab.java

/**
 * Creates a new SshToolsConnectionHostTab object.
 *//*from  w  w w.ja v a 2  s  .  c o m*/
public SshToolsConnectionHostTab() {
    super();

    //  Create the main connection details panel
    JPanel mainConnectionDetailsPanel = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(0, 2, 2, 2);
    gbc.weightx = 1.0;

    //  Host name
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Hostname"), gbc, GridBagConstraints.REMAINDER);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextHostname, gbc, GridBagConstraints.REMAINDER);
    gbc.fill = GridBagConstraints.NONE;

    //  Port
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Port"), gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextPort, gbc, GridBagConstraints.REMAINDER);

    //  Username
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, new JLabel("Username"), gbc, GridBagConstraints.REMAINDER);
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.weighty = 1.0;
    UIUtil.jGridBagAdd(mainConnectionDetailsPanel, jTextUsername, gbc, GridBagConstraints.REMAINDER);
    gbc.fill = GridBagConstraints.NONE;

    //
    IconWrapperPanel iconMainConnectionDetailsPanel = new IconWrapperPanel(
            new ResourceIcon(SshToolsConnectionHostTab.class, CONNECT_ICON), mainConnectionDetailsPanel);

    //  Authentication methods panel
    JPanel authMethodsPanel = new JPanel(new GridBagLayout());
    authMethodsPanel.setBorder(BorderFactory.createEmptyBorder(4, 0, 0, 0));
    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTHWEST;
    gbc.insets = new Insets(2, 2, 2, 2);
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 0;
    gbc.gridwidth = 2;

    GridBagConstraints gbc2 = new GridBagConstraints();
    gbc2.fill = GridBagConstraints.HORIZONTAL;
    gbc2.anchor = GridBagConstraints.NORTHWEST;
    gbc2.insets = new Insets(2, 2, 2, 2);
    gbc2.weightx = 1.0;
    gbc2.weighty = 0.0;
    gbc2.gridx = 0;
    gbc2.gridy = 1;
    gbc2.gridwidth = 2;

    GridBagConstraints gbc3 = new GridBagConstraints();
    gbc3.fill = GridBagConstraints.HORIZONTAL;
    gbc3.anchor = GridBagConstraints.NORTHWEST;
    gbc3.insets = new Insets(2, 2, 2, 2);
    gbc3.weightx = 1.0;
    gbc3.weighty = 0.0;
    gbc3.gridx = 0;
    gbc3.gridy = 2;
    gbc3.gridwidth = 2;

    GridBagConstraints gbc4 = new GridBagConstraints();
    gbc4.fill = GridBagConstraints.HORIZONTAL;
    gbc4.anchor = GridBagConstraints.NORTHWEST;
    gbc4.insets = new Insets(26, 2, 2, 2);
    gbc4.weightx = 0.0;
    gbc4.weighty = 0.0;
    gbc4.gridx = 0;
    gbc4.gridy = 3;
    gbc4.gridwidth = 1;

    GridBagConstraints gbc5 = new GridBagConstraints();
    gbc5.fill = GridBagConstraints.NONE;
    gbc5.anchor = GridBagConstraints.WEST;
    gbc5.insets = new Insets(26, 2, 2, 2);
    gbc5.weightx = 1.0;
    gbc5.weighty = 0.0;
    gbc5.gridx = 1;
    gbc5.gridy = 3;
    gbc5.gridwidth = 1;

    GridBagConstraints gbc6 = new GridBagConstraints();
    gbc6.fill = GridBagConstraints.HORIZONTAL;
    gbc6.anchor = GridBagConstraints.NORTHWEST;
    gbc6.insets = new Insets(12, 2, 2, 2);
    gbc6.weightx = 0.0;
    gbc6.weighty = 0.0;
    gbc6.gridx = 0;
    gbc6.gridy = 4;
    gbc6.gridwidth = 1;

    GridBagConstraints gbc7 = new GridBagConstraints();
    gbc7.fill = GridBagConstraints.NONE;
    gbc7.anchor = GridBagConstraints.WEST;
    gbc7.insets = new Insets(12, 2, 2, 2);
    gbc7.weightx = 1.0;
    gbc7.weighty = 0.0;
    gbc7.gridx = 1;
    gbc7.gridy = 4;
    gbc7.gridwidth = 1;

    GridBagConstraints gbc8 = new GridBagConstraints();
    gbc8.fill = GridBagConstraints.HORIZONTAL;
    gbc8.anchor = GridBagConstraints.NORTHWEST;
    gbc8.insets = new Insets(12, 2, 2, 2);
    gbc8.weightx = 0.0;
    gbc8.weighty = 0.0;
    gbc8.gridx = 0;
    gbc8.gridy = 5;
    gbc8.gridwidth = 1;

    GridBagConstraints gbc9 = new GridBagConstraints();
    gbc9.fill = GridBagConstraints.NONE;
    gbc9.anchor = GridBagConstraints.WEST;
    gbc9.insets = new Insets(12, 2, 2, 2);
    gbc9.weightx = 1.0;
    gbc9.weighty = 0.0;
    gbc9.gridx = 1;
    gbc9.gridy = 5;
    gbc9.gridwidth = 1;

    GridBagConstraints gbc10 = new GridBagConstraints();
    gbc10.fill = GridBagConstraints.HORIZONTAL;
    gbc10.anchor = GridBagConstraints.NORTHWEST;
    gbc10.insets = new Insets(26, 2, 2, 2);
    gbc10.weightx = 1.0;
    gbc10.weighty = 0.0;
    gbc10.gridx = 0;
    gbc10.gridy = 6;
    gbc10.gridwidth = 2;

    //  Authentication methods
    authMethodsPanel.add(new JLabel("Authentication Methods"), gbc);
    jListAuths.setVisibleRowCount(5);
    authMethodsPanel.add(new JScrollPane(jListAuths), gbc2);

    allowAgentForwarding = new JCheckBox("Allow agent forwarding");
    authMethodsPanel.add(allowAgentForwarding, gbc3);

    String options[] = { "Full", "Limited", "None" };
    delegationOption = new JComboBox(options);
    delegationOption.setSelectedIndex(0);
    authMethodsPanel.add(new JLabel("Delegation Type:"), gbc4);
    authMethodsPanel.add(delegationOption, gbc5);

    String optionsP[] = { "Pre-RFC Impersonation", "RFC Impersonation", "Legacy" };
    proxyOption = new JComboBox(optionsP);
    proxyOption.setSelectedIndex(0);
    authMethodsPanel.add(new JLabel("Proxy Type:"), gbc6);
    authMethodsPanel.add(proxyOption, gbc7);

    authMethodsPanel.add(new JLabel("Proxy Lifetime (hours):"), gbc8);
    proxyLength.setColumns(5);
    authMethodsPanel.add(proxyLength, gbc9);
    gbc.gridx = 0;
    proxySave = new JCheckBox("Save Grid Proxies to Disk");
    authMethodsPanel.add(proxySave, gbc10);

    //
    IconWrapperPanel iconAuthMethodsPanel = new IconWrapperPanel(
            new ResourceIcon(SshToolsConnectionHostTab.class, AUTH_ICON), authMethodsPanel);

    //  This panel
    JPanel mine = new JPanel();
    mine.setLayout(new GridBagLayout());
    mine.setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.insets = new Insets(2, 2, 2, 2);
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 0;
    mine.add(iconMainConnectionDetailsPanel, gbc);
    gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.gridx = 0;
    gbc.gridy = 1;
    gbc.insets = new Insets(20, 2, 2, 2);
    mine.add(iconAuthMethodsPanel, gbc);
    setLayout(new BorderLayout());
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    this.add(mine, BorderLayout.NORTH);
    //  Set up the values in the various components
    addAuthenticationMethods();
}

From source file:savant.chromatogram.ChromatogramPlugin.java

@Override
public void init(JPanel panel) {

    NavigationUtils.addLocationChangedListener(new Listener<LocationChangedEvent>() {
        @Override// w w  w. j  a v  a 2  s .c  om
        public void handleEvent(LocationChangedEvent event) {
            updateChromatogram();
        }
    });
    GenomeUtils.addGenomeChangedListener(new Listener<GenomeChangedEvent>() {
        @Override
        public void handleEvent(GenomeChangedEvent event) {
            updateChromatogram();
        }
    });
    panel.setLayout(new GridBagLayout());
    panel.setBorder(BorderFactory.createEtchedBorder());
    GridBagConstraints gbc = new GridBagConstraints();

    gbc.gridy = 0;
    gbc.anchor = GridBagConstraints.EAST;
    panel.add(new JLabel("File:"), gbc);

    pathField = new JTextField();
    gbc.gridwidth = 3;
    gbc.weightx = 1.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    panel.add(pathField, gbc);

    JButton browseButton = new JButton("Browse\u2026");
    browseButton.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            File f = DialogUtils.chooseFileForOpen("Chromatogram File", null, null);
            if (f != null) {
                try {
                    pathField.setText(f.getAbsolutePath());
                    if (canvas != null) {
                        canvas.getParent().remove(canvas);
                        canvas = null;
                    }
                    chromatogram = ChromatogramFactory.create(f);
                    updateEndField();
                    updateChromatogram();
                } catch (UnsupportedChromatogramFormatException x) {
                    DialogUtils.displayMessage("Unable to Open Chromatogram", String.format(
                            "<html><i>%s</i> does not appear to be a valid chromatogram file.<br><br><small>Supported formats are ABI and SCF.</small></html>",
                            f.getName()));
                } catch (Exception x) {
                    DialogUtils.displayException("Unable to Open Chromatogram",
                            String.format("<html>There was an error opening <i>%s</i>.</html>", f.getName()),
                            x);
                }
            }
        }
    });
    gbc.weightx = 0.0;
    gbc.fill = GridBagConstraints.NONE;
    panel.add(browseButton, gbc);

    JLabel startLabel = new JLabel("Start Base:");
    gbc.gridy++;
    gbc.gridwidth = 1;
    gbc.anchor = GridBagConstraints.EAST;
    panel.add(startLabel, gbc);

    startField = new JTextField("0");
    startField.setColumns(12);
    startField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            updateEndField();
        }
    });
    gbc.weightx = 0.5;
    gbc.anchor = GridBagConstraints.WEST;
    panel.add(startField, gbc);

    JLabel endLabel = new JLabel("End Base:");
    gbc.weightx = 0.0;
    gbc.anchor = GridBagConstraints.EAST;
    panel.add(endLabel, gbc);

    endField = new JTextField();
    endField.setColumns(12);
    endField.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            try {
                NumberFormat numberParser = NumberFormat.getIntegerInstance();
                int endBase = numberParser.parse(endField.getText()).intValue();
                if (chromatogram != null) {
                    int startBase = endBase - chromatogram.getSequenceLength();
                    startField.setText(String.valueOf(startBase));
                    if (canvas != null) {
                        canvas.updatePos(startBase);
                    }
                }
            } catch (ParseException x) {
                Toolkit.getDefaultToolkit().beep();
            }
        }
    });
    gbc.weightx = 0.5;
    gbc.anchor = GridBagConstraints.WEST;
    panel.add(endField, gbc);

    JCheckBox fillCheck = new JCheckBox("Fill Background");
    fillCheck.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent ae) {
            canvas.updateFillbackground(((JCheckBox) ae.getSource()).isSelected());
        }
    });
    gbc.gridy++;
    gbc.gridx = 1;
    gbc.weightx = 0.0;
    panel.add(fillCheck, gbc);

    // Add a filler panel at the bottom to force our components to the top.
    gbc.gridy++;
    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.fill = GridBagConstraints.BOTH;
    gbc.weighty = 1.0;
    panel.add(new JPanel(), gbc);
}

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

private void initGui() {
    // Initialise skins factory.
    skinsFactory = SkinsFactory.getInstance(applicationProperties);

    // Set Skinned Look and Feel.
    LookAndFeel lookAndFeel = skinsFactory.createSkinnedMetalTheme("SkinnedLookAndFeel");
    try {/*from   w  w w  . j a  va2 s.c  o  m*/
        UIManager.setLookAndFeel(lookAndFeel);
    } catch (UnsupportedLookAndFeelException e) {
        log.error("Unable to set skinned LookAndFeel", e);
    }

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

    JPanel container = new JPanel(new GridBagLayout());

    statusMessageLabel = skinsFactory.createSkinnedJHtmlLabel("ProgressDialogStatusMessageLabel");
    statusMessageLabel.setText(" ");
    statusMessageLabel.setHorizontalAlignment(JLabel.CENTER);
    container.add(statusMessageLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    progressBar = skinsFactory.createSkinnedJProgressBar("ProgressDialogProgressBar", 0, 100);
    progressBar.setPreferredSize(new Dimension(550, 20));

    container.add(progressBar, new GridBagConstraints(0, 1, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    detailsTextLabel = skinsFactory.createSkinnedJHtmlLabel("ProgressDialogDetailedMessageLabel");
    detailsTextLabel.setText(" ");
    detailsTextLabel.setHorizontalAlignment(JLabel.CENTER);
    container.add(detailsTextLabel, new GridBagConstraints(0, 2, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Display the cancel button if a cancel event listener is available.
    cancelButton = skinsFactory.createSkinnedJButton("ProgressDialogCancelButton");
    cancelButton.setText("Cancel");
    cancelButton.setActionCommand("Cancel");
    cancelButton.addActionListener(this);
    cancelButton.setDefaultCapable(true);

    container.add(cancelButton, new GridBagConstraints(0, 3, 1, 1, 0, 0, GridBagConstraints.CENTER,
            GridBagConstraints.NONE, insetsDefault, 0, 0));

    // Set Cancel as the default operation when ESCAPE is pressed.
    this.getRootPane().getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke("ESCAPE"),
            "ESCAPE");
    this.getRootPane().getActionMap().put("ESCAPE", new AbstractAction() {
        private static final long serialVersionUID = 4397881858674185924L;

        public void actionPerformed(ActionEvent actionEvent) {
            cancelButton.doClick();
        }
    });

    this.getContentPane().add(container);

    this.pack();
    this.setLocationRelativeTo(this.getOwner());
}