Example usage for java.awt GridBagConstraints NORTH

List of usage examples for java.awt GridBagConstraints NORTH

Introduction

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

Prototype

int NORTH

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

Click Source Link

Document

Put the component at the top of its display area, centered horizontally.

Usage

From source file:org.apache.marmotta.splash.common.ui.SelectionDialog.java

public static int select(String title, String message, String description, List<Option> options,
        int defaultOption) {
    final JDialog dialog = new JDialog((Frame) null, title);
    dialog.setModal(true);/*from   www . j a v  a2  s . c o  m*/
    dialog.setDefaultCloseOperation(WindowConstants.HIDE_ON_CLOSE);

    final AtomicInteger result = new AtomicInteger(Math.max(defaultOption, -1));

    JButton defaultBtn = null;

    final JPanel root = new JPanel(new GridBagLayout());
    root.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
    dialog.getRootPane().setContentPane(root);

    JLabel lblMsg = new JLabel("<html>" + StringEscapeUtils.escapeHtml3(message).replaceAll("\\n", "<br>"));
    lblMsg.setFont(lblMsg.getFont().deriveFont(Font.BOLD, 16f));
    GridBagConstraints cLabel = new GridBagConstraints();
    cLabel.gridx = 0;
    cLabel.gridy = 0;
    cLabel.fill = GridBagConstraints.BOTH;
    cLabel.weightx = 1;
    cLabel.weighty = 0.5;
    cLabel.insets = new Insets(5, 5, 5, 5);
    root.add(lblMsg, cLabel);

    JLabel lblDescr = new JLabel(
            "<html>" + StringEscapeUtils.escapeHtml3(description).replaceAll("\\n", "<br>"));
    cLabel.gridy++;
    cLabel.insets = new Insets(0, 5, 5, 5);
    root.add(lblDescr, cLabel);

    // All the options
    cLabel.ipadx = 10;
    cLabel.ipady = 10;
    cLabel.insets = new Insets(5, 15, 0, 15);
    for (int i = 0; i < options.size(); i++) {
        cLabel.gridy++;

        final Option o = options.get(i);
        final JButton btn = new JButton(
                "<html>" + StringEscapeUtils.escapeHtml3(o.label).replaceAll("\\n", "<br>"),
                MessageDialog.loadIcon(o.icon));
        if (StringUtils.isNotBlank(o.info)) {
            btn.setToolTipText("<html>" + StringEscapeUtils.escapeHtml3(o.info).replaceAll("\\n", "<br>"));
        }

        btn.setHorizontalAlignment(AbstractButton.LEADING);
        btn.setVerticalTextPosition(AbstractButton.CENTER);
        btn.setHorizontalTextPosition(AbstractButton.TRAILING);

        final int myAnswer = i;
        btn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                result.set(myAnswer);
                dialog.setVisible(false);
            }
        });

        root.add(btn, cLabel);
        if (i == defaultOption) {
            dialog.getRootPane().setDefaultButton(btn);
            defaultBtn = btn;
        }
    }

    final Icon icon = MessageDialog.loadIcon();
    if (icon != null) {
        JLabel lblIcn = new JLabel(icon);

        GridBagConstraints cIcon = new GridBagConstraints();
        cIcon.gridx = 1;
        cIcon.gridy = 0;
        cIcon.gridheight = 2 + options.size();
        cIcon.fill = GridBagConstraints.NONE;
        cIcon.weightx = 0;
        cIcon.weighty = 1;
        cIcon.anchor = GridBagConstraints.NORTH;
        cIcon.insets = new Insets(10, 5, 5, 0);
        root.add(lblIcn, cIcon);
    }

    final JButton close = new JButton("Cancel");
    close.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            result.set(-1);
            dialog.setVisible(false);
        }
    });
    GridBagConstraints cClose = new GridBagConstraints();
    cClose.gridx = 0;
    cClose.gridy = 2 + options.size();
    cClose.gridwidth = 2;
    cClose.weightx = 1;
    cClose.weighty = 0;
    cClose.insets = new Insets(15, 5, 5, 5);

    root.add(close, cClose);
    if (defaultOption < 0) {
        dialog.getRootPane().setDefaultButton(close);
        defaultBtn = close;
    }

    dialog.pack();
    dialog.setLocationRelativeTo(null);
    defaultBtn.requestFocusInWindow();

    dialog.setVisible(true);
    dialog.dispose();

    return result.get();
}

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

/**
 * Creates a new HostsTab object./*from   w w  w. j a  va  2 s .c  o m*/
 *
 * @param hostKeyVerifier
 */
public HostsTab(AbstractKnownHostsKeyVerification hostKeyVerifier) {
    super();
    this.hostKeyVerifier = hostKeyVerifier;
    hosts = new JList(model = new HostsListModel());
    hosts.setVisibleRowCount(10);
    hosts.setCellRenderer(new HostRenderer());
    hosts.addListSelectionListener(new ListSelectionListener() {
        public void valueChanged(ListSelectionEvent evt) {
            setAvailableActions();
        }
    });
    remove = new JButton("Remove", new ResourceIcon(REMOVE_ICON));
    remove.addActionListener(this);

    //deny = new JButton("Deny", new ResourceIcon(DENY_ICON));
    //deny.addActionListener(this);
    JPanel b = new JPanel(new GridBagLayout());
    b.setBorder(BorderFactory.createEmptyBorder(0, 8, 0, 0));

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets = new Insets(0, 0, 4, 0);
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.weightx = 1.0;
    UIUtil.jGridBagAdd(b, remove, gbc, GridBagConstraints.REMAINDER);
    gbc.weighty = 1.0;

    //UIUtil.jGridBagAdd(b, deny, gbc, GridBagConstraints.REMAINDER);
    JPanel s = new JPanel(new BorderLayout());
    s.add(new JScrollPane(hosts), BorderLayout.CENTER);
    s.add(b, BorderLayout.EAST);

    IconWrapperPanel w = new IconWrapperPanel(new ResourceIcon(GLOBAL_ICON), s);

    //  This tab
    setLayout(new BorderLayout());
    add(w, BorderLayout.CENTER);
    setBorder(BorderFactory.createEmptyBorder(4, 4, 4, 4));
    reset();
}

From source file:com.sec.ose.osi.ui.dialog.setting.JPanReportProperty.java

/**
 * This method initializes this//from   w w w  . j  av  a  2s .com
 * 
 * @return void
 */
private void initialize() {
    GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
    gridBagConstraints9.gridx = 2;
    gridBagConstraints9.fill = GridBagConstraints.HORIZONTAL;
    gridBagConstraints9.gridwidth = 2;
    gridBagConstraints9.insets = new Insets(10, 10, 0, 10);
    gridBagConstraints9.anchor = GridBagConstraints.NORTH;
    gridBagConstraints9.gridy = 0;
    GridBagConstraints gridBagConstraints7 = new GridBagConstraints();
    gridBagConstraints7.gridx = 0;
    gridBagConstraints7.fill = GridBagConstraints.BOTH;
    gridBagConstraints7.gridwidth = 2;
    gridBagConstraints7.insets = new Insets(0, 0, 0, 0);
    gridBagConstraints7.weightx = 1.0;
    gridBagConstraints7.weighty = 1.0;
    gridBagConstraints7.anchor = GridBagConstraints.CENTER;
    gridBagConstraints7.gridy = 0;
    this.setLayout(new GridBagLayout());
    this.add(getJPanelValue(), gridBagConstraints7);
    this.add(getJPanelButtons(), gridBagConstraints9);
}

From source file:com.digitalgeneralists.assurance.ui.components.ScanPathMappingPanel.java

protected void initializeComponent() {
    if (!this.initialized) {
        if (this.mappingDefinition == null) {
            this.mode = AssuranceDialogMode.ADD;
            this.dialogTitle = "Add New Path Mapping";
            this.mappingDefinition = new ScanMappingDefinition();
        } else {/* w  ww. j a  va  2  s  .  co  m*/
            this.mode = AssuranceDialogMode.EDIT;
            this.dialogTitle = "Edit Path Mapping";
        }

        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

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

        Border pathsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        pathsPanelBorder = BorderFactory.createTitledBorder(pathsPanelBorder, "Paths", TitledBorder.CENTER,
                TitledBorder.TOP);

        GridBagConstraints scanPathsPanelConstraints = new GridBagConstraints();
        scanPathsPanelConstraints.anchor = GridBagConstraints.NORTH;
        scanPathsPanelConstraints.fill = GridBagConstraints.HORIZONTAL;
        scanPathsPanelConstraints.gridx = 0;
        scanPathsPanelConstraints.gridy = 0;
        scanPathsPanelConstraints.weightx = 1.0;
        scanPathsPanelConstraints.weighty = 1.0;
        scanPathsPanelConstraints.gridheight = 1;
        scanPathsPanelConstraints.gridwidth = 2;
        scanPathsPanelConstraints.insets = new Insets(5, 5, 5, 5);

        scanPathsPanel.setBorder(pathsPanelBorder);
        this.add(scanPathsPanel, scanPathsPanelConstraints);

        GridBagConstraints sourcePathFieldConstraints = new GridBagConstraints();
        sourcePathFieldConstraints.anchor = GridBagConstraints.NORTH;
        sourcePathFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        sourcePathFieldConstraints.gridx = 0;
        sourcePathFieldConstraints.gridy = 0;
        sourcePathFieldConstraints.weightx = 1.0;
        sourcePathFieldConstraints.weighty = 1.0;
        sourcePathFieldConstraints.gridheight = 1;
        sourcePathFieldConstraints.gridwidth = 1;
        sourcePathFieldConstraints.insets = new Insets(0, 5, 5, 5);

        GridBagConstraints targetPathFieldConstraints = new GridBagConstraints();
        targetPathFieldConstraints.anchor = GridBagConstraints.NORTH;
        targetPathFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        targetPathFieldConstraints.gridx = 0;
        targetPathFieldConstraints.gridy = 1;
        targetPathFieldConstraints.weightx = 1.0;
        targetPathFieldConstraints.weighty = 1.0;
        targetPathFieldConstraints.gridheight = 1;
        targetPathFieldConstraints.gridwidth = 1;
        targetPathFieldConstraints.insets = new Insets(5, 5, 5, 5);

        scanPathsPanel.add(this.sourcePathPickerField, sourcePathFieldConstraints);
        scanPathsPanel.add(this.targetPathPickerField, targetPathFieldConstraints);

        if (mappingDefinition != null) {
            File source = mappingDefinition.getSource();
            if (source != null) {
                this.sourcePathPickerField.setValue(source.getPath());
            } else {
                this.sourcePathPickerField.setValue("");
            }
            File target = mappingDefinition.getTarget();
            if (target != null) {
                this.targetPathPickerField.setValue(target.getPath());
            } else {
                this.targetPathPickerField.setValue("");
            }
        }

        Border existingExclusionsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        existingExclusionsPanelBorder = BorderFactory.createTitledBorder(existingExclusionsPanelBorder,
                "Exclusions", TitledBorder.CENTER, TitledBorder.TOP);

        GridBagConstraints existingExclusionsPanelConstraints = new GridBagConstraints();
        existingExclusionsPanelConstraints.anchor = GridBagConstraints.WEST;
        existingExclusionsPanelConstraints.fill = GridBagConstraints.BOTH;
        existingExclusionsPanelConstraints.gridx = 0;
        existingExclusionsPanelConstraints.gridy = 1;
        existingExclusionsPanelConstraints.weightx = 1.0;
        existingExclusionsPanelConstraints.weighty = 0.9;
        existingExclusionsPanelConstraints.gridheight = 1;
        existingExclusionsPanelConstraints.gridwidth = 2;
        existingExclusionsPanelConstraints.insets = new Insets(0, 5, 0, 5);

        JPanel existingExclusionsPanel = new JPanel();
        GridBagLayout panelGridbag = new GridBagLayout();
        existingExclusionsPanel.setLayout(panelGridbag);
        existingExclusionsPanel.setBorder(existingExclusionsPanelBorder);
        this.add(existingExclusionsPanel, existingExclusionsPanelConstraints);

        GridBagConstraints existingExclusionsListConstraints = new GridBagConstraints();
        existingExclusionsListConstraints.anchor = GridBagConstraints.WEST;
        existingExclusionsListConstraints.fill = GridBagConstraints.BOTH;
        existingExclusionsListConstraints.gridx = 0;
        existingExclusionsListConstraints.gridy = 0;
        existingExclusionsListConstraints.weightx = 1.0;
        existingExclusionsListConstraints.weighty = 0.9;
        existingExclusionsListConstraints.gridheight = 1;
        existingExclusionsListConstraints.gridwidth = 2;
        existingExclusionsListConstraints.insets = new Insets(5, 5, 5, 5);

        this.mappingDefinition = (ScanMappingDefinition) ModelUtils.initializeEntity(this.mappingDefinition,
                ScanMappingDefinition.EXCLUSIONS_PROPERTY);
        this.exclusionsPanel = new ListInputPanel<FileReference>(this.mappingDefinition, this);
        existingExclusionsPanel.add(this.exclusionsPanel, existingExclusionsListConstraints);

        this.initialized = true;
    }
}

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

/**
 * This method initializes jPanel   //from w  ww .  j a va 2 s . co m
 *    
 * @return javax.swing.JPanel   
 */
private JPanel getJPanelbutton() {
    if (jPanel == null) {
        GridBagConstraints gridBagConstraints4 = new GridBagConstraints();
        gridBagConstraints4.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints4.insets = new Insets(10, 0, 0, 10);
        gridBagConstraints4.anchor = GridBagConstraints.NORTH;
        GridBagConstraints gridBagConstraints5 = new GridBagConstraints();
        gridBagConstraints5.fill = GridBagConstraints.HORIZONTAL;
        gridBagConstraints5.insets = new Insets(10, 0, 0, 10);
        gridBagConstraints5.gridx = 0;
        gridBagConstraints5.gridy = 1;

        jPanel = new JPanel();
        jPanel.setLayout(new GridBagLayout());
        jPanel.add(getJButtonReportExport(), gridBagConstraints4);
    }
    return jPanel;
}

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

/**
 * Creates a new SshToolsConnectionProxyTab object.
 *///from  w ww  . j  a  v  a 2s  .c o  m
public SshToolsConnectionProxyTab() {
    super();
    group.add(noProxy);
    group.add(httpProxy);
    group.add(socks4Proxy);
    group.add(socks5Proxy);

    ChangeListener listener = new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            if (noProxy.isSelected()) {
                username.setEnabled(false);
                password.setEnabled(false);
                proxy.setEnabled(false);

                //port.setEnabled(false);
                port.setForeground(Color.white);
            } else {
                username.setEnabled(true);
                password.setEnabled(true);
                proxy.setEnabled(true);

                //port.setEnabled(true);
                port.setForeground(Color.black);

                if (httpProxy.isSelected()) {
                    port.setText("80");
                } else {
                    port.setText("1080");
                }
            }
        }
    };

    noProxy.getModel().addChangeListener(listener);
    httpProxy.getModel().addChangeListener(listener);
    socks4Proxy.getModel().addChangeListener(listener);
    socks5Proxy.getModel().addChangeListener(listener);

    //  Create the main connection details panel
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.insets = new Insets(0, 2, 2, 2);
    gbc.weightx = 1.0;
    proxyframe.setBorder(BorderFactory.createTitledBorder("Connect using the following proxy"));

    //  No proxy label
    gbc.insets = new Insets(2, 10, 2, 2);
    UIUtil.jGridBagAdd(proxyframe, noProxy, gbc, GridBagConstraints.RELATIVE);

    // Socks 4 label
    gbc.insets = new Insets(2, 15, 2, 2);
    UIUtil.jGridBagAdd(proxyframe, socks4Proxy, gbc, GridBagConstraints.REMAINDER);

    //gbc.fill = GridBagConstraints.HORIZONTAL;
    // Http Proxy
    gbc.insets = new Insets(2, 10, 2, 2);
    UIUtil.jGridBagAdd(proxyframe, httpProxy, gbc, GridBagConstraints.RELATIVE);

    // Socks 5 label
    gbc.insets = new Insets(2, 15, 2, 2);
    UIUtil.jGridBagAdd(proxyframe, socks5Proxy, gbc, GridBagConstraints.REMAINDER);

    gbc.insets = new Insets(2, 10, 2, 10);

    JPanel connect = new JPanel(new GridBagLayout());
    connect.setBorder(BorderFactory.createTitledBorder("Proxy Details"));
    UIUtil.jGridBagAdd(connect, new JLabel("Host"), gbc, GridBagConstraints.REMAINDER);

    UIUtil.jGridBagAdd(connect, proxy, gbc, GridBagConstraints.REMAINDER);

    UIUtil.jGridBagAdd(connect, new JLabel("Port"), gbc, GridBagConstraints.REMAINDER);
    gbc.anchor = GridBagConstraints.WEST;
    gbc.fill = GridBagConstraints.NONE;

    UIUtil.jGridBagAdd(connect, port, gbc, GridBagConstraints.REMAINDER);
    gbc.fill = GridBagConstraints.HORIZONTAL;

    UIUtil.jGridBagAdd(connect, new JLabel("Username"), gbc, GridBagConstraints.REMAINDER);

    UIUtil.jGridBagAdd(connect, username, gbc, GridBagConstraints.REMAINDER);

    UIUtil.jGridBagAdd(connect, new JLabel("Password"), gbc, GridBagConstraints.REMAINDER);
    gbc.insets = new Insets(2, 10, 10, 10);
    UIUtil.jGridBagAdd(connect, password, gbc, GridBagConstraints.REMAINDER);

    JPanel main = new JPanel(new GridBagLayout());
    gbc.insets = new Insets(2, 2, 2, 2);
    UIUtil.jGridBagAdd(main, proxyframe, gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, connect, gbc, GridBagConstraints.REMAINDER);

    IconWrapperPanel iconProxyDetailsPanel = new IconWrapperPanel(new ResourceIcon(PROXY_ICON), main);
    noProxy.setSelected(true);

    //  This panel
    setLayout(new BorderLayout());
    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;
    add(iconProxyDetailsPanel, BorderLayout.NORTH);
}

From source file:medsavant.enrichment.app.OntologyAggregatePanel.java

public OntologyAggregatePanel(String page) {
    super(page);//  w  ww . jav  a2s .  c om
    setLayout(new GridBagLayout());

    chooser = new JComboBox(OntologyListItem.DEFAULT_ITEMS);
    chooser.setMaximumSize(new Dimension(400, chooser.getMaximumSize().height));
    progress = new JProgressBar();
    progress.setPreferredSize(new Dimension(600, progress.getMaximumSize().height));
    progress.setStringPainted(true);

    JPanel banner = new JPanel();
    banner.setLayout(new GridBagLayout());
    banner.setBackground(new Color(245, 245, 245));
    banner.setBorder(BorderFactory.createTitledBorder("Ontology"));

    tree = new TreeTable();

    GridBagConstraints gbc = new GridBagConstraints();
    gbc.weightx = 1.0;
    gbc.anchor = GridBagConstraints.WEST;
    banner.add(chooser, gbc);
    gbc.anchor = GridBagConstraints.EAST;
    banner.add(progress, gbc);

    gbc.gridwidth = GridBagConstraints.REMAINDER;
    gbc.weightx = 1.0;
    gbc.weighty = 0.0;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTH;
    add(banner, gbc);

    gbc.weighty = 1.0;
    gbc.fill = GridBagConstraints.BOTH;
    add(new JScrollPane(tree), gbc);

    chooser.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            if (termFetcher != null) {
                termFetcher.cancel(true);
                termFetcher = null;
            }
            recalculate();
        }
    });

    tree.addMouseListener(new MouseAdapter() {
        @Override
        public void mouseReleased(MouseEvent e) {
            if (SwingUtilities.isRightMouseButton(e)) {
                createPopup().show(e.getComponent(), e.getX(), e.getY());
            }
        }
    });
}

From source file:it.cnr.icar.eric.client.ui.swing.FindParamsPanel.java

/**
 * Class Constructor.//  ww  w . j a  va2s  .co m
 */
public FindParamsPanel(DiscoveryPanel discoveryPanel) throws JAXRException {
    this.discoveryPanel = discoveryPanel;

    GridBagLayout gbl = new GridBagLayout();
    setLayout(gbl);

    //The searchTypeSelectionPanel at the top of the panel
    JPanel searchTypePanel = createSearchTypePanel();
    c.gridx = 0;
    c.gridy = 0;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTH;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(searchTypePanel, c);
    add(searchTypePanel);

    //The federated CheckBox
    federatedCheckBox = new JCheckBox(resourceBundle.getString("label.federatedQuery"));
    federatedCheckBox.setSelected(false);
    federatedCheckBox.setEnabled(true);
    c.gridx = 0;
    c.gridy = 1;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTH;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(federatedCheckBox, c);
    add(federatedCheckBox);

    //The actionPanel
    JPanel actionPanel = createActionPanel();
    c.gridx = 0;
    c.gridy = 2;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.0;
    c.weighty = 0.0;
    c.fill = GridBagConstraints.NONE;
    c.anchor = GridBagConstraints.NORTH;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(searchTypePanel, c);
    add(actionPanel);

    //Next is the panel that is the parent of both adhocQueryPanel and
    //businessQueryPanel
    paramEntryParentPanel = createParamEntryParentPanel();
    c.gridx = 0;
    c.gridy = 3;
    c.gridwidth = 1;
    c.gridheight = 1;
    c.weightx = 0.5;
    c.weighty = 0.5;
    c.fill = GridBagConstraints.BOTH;
    c.anchor = GridBagConstraints.NORTH;
    c.insets = new Insets(4, 4, 0, 4);
    gbl.setConstraints(paramEntryParentPanel, c);
    add(paramEntryParentPanel);

    //RegistryBrowser.getInstance().getConceptsTreeDialog().addPropertyChangeListener(this);
    //add listener for 'locale' bound property
    RegistryBrowser.getInstance().addPropertyChangeListener(RegistryBrowser.PROPERTY_LOCALE, this);
}

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

/**
 * This method initializes this/*from   ww w . j ava  2s.  co 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:com.digitalgeneralists.assurance.ui.components.SettingsPanel.java

@Override
protected void initializeComponent() {
    if (!this.initialized) {
        this.dialogTitle = Application.applicationShortName + " Settings";

        // NOTE:  There is no notion of add-mode in this dialog.  There should
        // always be a single instance of the application configuration.
        if (this.configuration == null) {
            this.configuration = ApplicationConfiguration.createDefaultConfiguration();
        }//from w  w w  . j a v a 2 s . c  om
        this.mode = AssuranceDialogMode.EDIT;

        GridBagLayout gridbag = new GridBagLayout();
        this.setLayout(gridbag);

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

        Border scanSettingsPanelBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
        scanSettingsPanelBorder = BorderFactory.createTitledBorder(scanSettingsPanelBorder, "Scan Settings",
                TitledBorder.CENTER, TitledBorder.TOP);

        GridBagConstraints scanSettingsPanelConstraints = new GridBagConstraints();
        scanSettingsPanelConstraints.anchor = GridBagConstraints.NORTH;
        scanSettingsPanelConstraints.fill = GridBagConstraints.HORIZONTAL;
        scanSettingsPanelConstraints.gridx = 0;
        scanSettingsPanelConstraints.gridy = 0;
        scanSettingsPanelConstraints.weightx = 1.0;
        scanSettingsPanelConstraints.weighty = 1.0;
        scanSettingsPanelConstraints.gridheight = 1;
        scanSettingsPanelConstraints.gridwidth = 2;
        scanSettingsPanelConstraints.insets = new Insets(5, 5, 5, 5);

        scanSettingsPanel.setBorder(scanSettingsPanelBorder);
        this.add(scanSettingsPanel, scanSettingsPanelConstraints);

        GridBagConstraints ignoredFileNamesLabelConstraints = new GridBagConstraints();
        ignoredFileNamesLabelConstraints.anchor = GridBagConstraints.NORTHWEST;
        ignoredFileNamesLabelConstraints.fill = GridBagConstraints.NONE;
        ignoredFileNamesLabelConstraints.gridx = 0;
        ignoredFileNamesLabelConstraints.gridy = 0;
        ignoredFileNamesLabelConstraints.weightx = 1.0;
        ignoredFileNamesLabelConstraints.weighty = 1.0;
        ignoredFileNamesLabelConstraints.gridheight = 1;
        ignoredFileNamesLabelConstraints.gridwidth = 1;
        ignoredFileNamesLabelConstraints.insets = new Insets(5, 10, 0, 5);

        final JLabel ignoredFileNamesLabel = new JLabel("Ignored Files", SwingConstants.LEFT);
        scanSettingsPanel.add(ignoredFileNamesLabel, ignoredFileNamesLabelConstraints);

        GridBagConstraints ignoredFileNamesTextFieldConstraints = new GridBagConstraints();
        ignoredFileNamesTextFieldConstraints.anchor = GridBagConstraints.NORTH;
        ignoredFileNamesTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        ignoredFileNamesTextFieldConstraints.gridx = 0;
        ignoredFileNamesTextFieldConstraints.gridy = 1;
        ignoredFileNamesTextFieldConstraints.weightx = 1.0;
        ignoredFileNamesTextFieldConstraints.weighty = 1.0;
        ignoredFileNamesTextFieldConstraints.gridheight = 1;
        ignoredFileNamesTextFieldConstraints.gridwidth = 2;
        ignoredFileNamesTextFieldConstraints.insets = new Insets(2, 5, 5, 5);

        GridBagConstraints ignoredFileExtensionsLabelConstraints = new GridBagConstraints();
        ignoredFileExtensionsLabelConstraints.anchor = GridBagConstraints.NORTHWEST;
        ignoredFileExtensionsLabelConstraints.fill = GridBagConstraints.NONE;
        ignoredFileExtensionsLabelConstraints.gridx = 0;
        ignoredFileExtensionsLabelConstraints.gridy = 2;
        ignoredFileExtensionsLabelConstraints.weightx = 1.0;
        ignoredFileExtensionsLabelConstraints.weighty = 1.0;
        ignoredFileExtensionsLabelConstraints.gridheight = 1;
        ignoredFileExtensionsLabelConstraints.gridwidth = 1;
        ignoredFileExtensionsLabelConstraints.insets = new Insets(5, 10, 0, 5);

        final JLabel ignoredFileExtensionsLabel = new JLabel("Ignored File Extensions", SwingConstants.LEFT);
        scanSettingsPanel.add(ignoredFileExtensionsLabel, ignoredFileExtensionsLabelConstraints);

        GridBagConstraints ignoredFileExtensionsTextFieldConstraints = new GridBagConstraints();
        ignoredFileExtensionsTextFieldConstraints.anchor = GridBagConstraints.NORTH;
        ignoredFileExtensionsTextFieldConstraints.fill = GridBagConstraints.HORIZONTAL;
        ignoredFileExtensionsTextFieldConstraints.gridx = 0;
        ignoredFileExtensionsTextFieldConstraints.gridy = 3;
        ignoredFileExtensionsTextFieldConstraints.weightx = 1.0;
        ignoredFileExtensionsTextFieldConstraints.weighty = 1.0;
        ignoredFileExtensionsTextFieldConstraints.gridheight = 1;
        ignoredFileExtensionsTextFieldConstraints.gridwidth = 2;
        ignoredFileExtensionsTextFieldConstraints.insets = new Insets(2, 5, 5, 5);

        scanSettingsPanel.add(this.ignoredFileNamesTextField, ignoredFileNamesTextFieldConstraints);
        this.ignoredFileNamesTextField.getDocument().addDocumentListener(this.textPropertyValidationListener);
        scanSettingsPanel.add(this.ignoredFileExtensionsTextField, ignoredFileExtensionsTextFieldConstraints);
        this.ignoredFileExtensionsTextField.getDocument()
                .addDocumentListener(this.textPropertyValidationListener);

        GridBagConstraints numberScanThreadsLabelConstraints = new GridBagConstraints();
        numberScanThreadsLabelConstraints.anchor = GridBagConstraints.NORTH;
        numberScanThreadsLabelConstraints.fill = GridBagConstraints.NONE;
        numberScanThreadsLabelConstraints.gridx = 0;
        numberScanThreadsLabelConstraints.gridy = 4;
        numberScanThreadsLabelConstraints.weightx = 1.0;
        numberScanThreadsLabelConstraints.weighty = 1.0;
        numberScanThreadsLabelConstraints.gridheight = 1;
        numberScanThreadsLabelConstraints.gridwidth = 1;
        numberScanThreadsLabelConstraints.insets = new Insets(10, 5, 0, 5);

        final JLabel numberOfThreadsLabel = new JLabel("Number of Threads", SwingConstants.RIGHT);
        scanSettingsPanel.add(numberOfThreadsLabel, numberScanThreadsLabelConstraints);

        GridBagConstraints numberScanThreadsSpinnerConstraints = new GridBagConstraints();
        numberScanThreadsSpinnerConstraints.anchor = GridBagConstraints.NORTHWEST;
        numberScanThreadsSpinnerConstraints.fill = GridBagConstraints.NONE;
        numberScanThreadsSpinnerConstraints.gridx = 1;
        numberScanThreadsSpinnerConstraints.gridy = 4;
        numberScanThreadsSpinnerConstraints.weightx = 1.0;
        numberScanThreadsSpinnerConstraints.weighty = 1.0;
        numberScanThreadsSpinnerConstraints.gridheight = 1;
        numberScanThreadsSpinnerConstraints.gridwidth = 1;
        numberScanThreadsSpinnerConstraints.insets = new Insets(5, 5, 5, 5);

        scanSettingsPanel.add(this.numberScanThreadsSpinner, numberScanThreadsSpinnerConstraints);

        if (this.configuration != null) {
            this.ignoredFileNamesTextField.setText(this.configuration.getIgnoredFileNames());
            this.ignoredFileExtensionsTextField.setText(this.configuration.getIgnoredFileExtensions());
            this.numberScanThreadsSpinner.setValue(this.configuration.getNumberOfScanThreads());
        }

        this.initialized = true;
    }
}