Example usage for java.awt GridBagConstraints HORIZONTAL

List of usage examples for java.awt GridBagConstraints HORIZONTAL

Introduction

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

Prototype

int HORIZONTAL

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

Click Source Link

Document

Resize the component horizontally but not vertically.

Usage

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

@Override
protected JComponent createFormControl() {
    // add field panel
    final JPanel contentPanel = new JPanel(new GridBagLayout());
    int row = 0;/*ww w .j a v a  2s  . c o m*/
    final int col = 0;
    GridBagConstraints gbc = LayoutUtil.buildGridBagConstraints(col, row++, 1, 1, 0, 0,
            GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST);
    addFieldPannel = new AddFieldPanel();
    contentPanel.add(addFieldPannel, gbc);

    gbc = LayoutUtil.buildGridBagConstraints(col, row++, 1, 1, 0, 0, GridBagConstraints.HORIZONTAL,
            GridBagConstraints.CENTER);
    contentPanel.add(new JSeparator(), gbc);

    // bag-info input form
    form = createFormFields();
    gbc = LayoutUtil.buildGridBagConstraints(col, row++, 1, 1, 1, 1, GridBagConstraints.BOTH,
            GridBagConstraints.WEST);
    contentPanel.add(form, gbc);
    return contentPanel;
}

From source file:org.openconcerto.erp.graph.GraphFamilleArticlePanel.java

public GraphFamilleArticlePanel(Date d1, Date d2) {
    this.d1 = d1;
    this.d2 = d2;
    List<String> labels = new ArrayList<String>();
    List<Number> values = new ArrayList<Number>();
    BigDecimal total = updateDataset(labels, values);
    PieChart chart = new PieChart();
    chart.setDimension(new Dimension(800, 360));
    chart.setData(values);/*  w  w  w  .j  a v a2 s . c  o  m*/
    for (String label : labels) {
        chart.addLabel(new Label(label));
    }

    ChartPanel p = new ChartPanel(chart);
    this.setLayout(new GridBagLayout());
    final GridBagConstraints c = new DefaultGridBagConstraints();
    c.insets = new Insets(4, 6, 4, 4);
    p.setOpaque(false);
    this.setBackground(Color.WHITE);
    this.add(p, c);

    final JPanel p1 = new JPanel();
    p1.setOpaque(false);
    p1.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5));
    SimpleDateFormat format = new SimpleDateFormat("dd/MM/yy");
    p1.add(new JLabelBold("Rpartition du chiffre d'affaire du " + format.format(d1) + " au "
            + format.format(d2) + " pour un total de "
            + decFormat.format(total.setScale(2, RoundingMode.HALF_UP).doubleValue()) + ""));

    c.gridy++;
    c.weighty = 1;
    c.fill = GridBagConstraints.HORIZONTAL;
    c.anchor = GridBagConstraints.NORTHWEST;
    this.add(p1, c);
}

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

private void initialize() {
    GridBagConstraints gridBagConstraints9 = new GridBagConstraints();
    gridBagConstraints9.gridx = 2;/*from   www . j a v  a2 s  .  c  o m*/
    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.anchor = GridBagConstraints.CENTER;
    gridBagConstraints7.weighty = 1.0;
    gridBagConstraints7.gridy = 0;
    this.setLayout(new GridBagLayout());
    this.add(getJPanelValue(), gridBagConstraints7);
    this.add(getJPanelButtons(), gridBagConstraints9);
}

From source file:EditorPaneExample10.java

public EditorPaneExample10() {
    super("JEditorPane Example 10");

    pane = new JEditorPane();
    pane.setEditable(false); // Read-only
    getContentPane().add(new JScrollPane(pane), "Center");

    // Build the panel of controls
    JPanel panel = new JPanel();

    panel.setLayout(new GridBagLayout());
    GridBagConstraints c = new GridBagConstraints();
    c.gridwidth = 1;/* w w  w.  jav a2 s .c om*/
    c.gridheight = 1;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.NONE;
    c.weightx = 0.0;
    c.weighty = 0.0;

    JLabel urlLabel = new JLabel("URL: ", JLabel.RIGHT);
    panel.add(urlLabel, c);
    JLabel loadingLabel = new JLabel("State: ", JLabel.RIGHT);
    c.gridy = 1;
    panel.add(loadingLabel, c);
    JLabel typeLabel = new JLabel("Type: ", JLabel.RIGHT);
    c.gridy = 2;
    panel.add(typeLabel, c);
    c.gridy = 3;
    panel.add(new JLabel(LOAD_TIME), c);

    c.gridy = 4;
    c.gridwidth = 2;
    c.weightx = 1.0;
    c.anchor = GridBagConstraints.WEST;
    onlineLoad = new JCheckBox("Online Load");
    panel.add(onlineLoad, c);
    onlineLoad.setSelected(true);
    onlineLoad.setForeground(typeLabel.getForeground());

    c.gridx = 1;
    c.gridy = 0;
    c.anchor = GridBagConstraints.EAST;
    c.fill = GridBagConstraints.HORIZONTAL;

    urlCombo = new JComboBox();
    panel.add(urlCombo, c);
    urlCombo.setEditable(true);
    loadingState = new JLabel(spaces, JLabel.LEFT);
    loadingState.setForeground(Color.black);
    c.gridy = 1;
    panel.add(loadingState, c);
    loadedType = new JLabel(spaces, JLabel.LEFT);
    loadedType.setForeground(Color.black);
    c.gridy = 2;
    panel.add(loadedType, c);
    timeLabel = new JLabel("");
    c.gridy = 3;
    panel.add(timeLabel, c);

    getContentPane().add(panel, "South");

    // Change page based on combo selection
    urlCombo.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent evt) {
            if (populatingCombo == true) {
                return;
            }
            Object selection = urlCombo.getSelectedItem();
            try {
                // Check if the new page and the old
                // page are the same.
                URL url;
                if (selection instanceof URL) {
                    url = (URL) selection;
                } else {
                    url = new URL((String) selection);
                }

                URL loadedURL = pane.getPage();
                if (loadedURL != null && loadedURL.sameFile(url)) {
                    return;
                }

                // Try to display the page
                urlCombo.setEnabled(false); // Disable input
                urlCombo.paintImmediately(0, 0, urlCombo.getSize().width, urlCombo.getSize().height);
                setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                // Busy cursor
                loadingState.setText("Loading...");
                loadingState.paintImmediately(0, 0, loadingState.getSize().width,
                        loadingState.getSize().height);
                loadedType.setText("");
                loadedType.paintImmediately(0, 0, loadedType.getSize().width, loadedType.getSize().height);

                timeLabel.setText("");
                timeLabel.paintImmediately(0, 0, timeLabel.getSize().width, timeLabel.getSize().height);

                startTime = System.currentTimeMillis();

                // Choose the loading method
                if (onlineLoad.isSelected()) {
                    // Usual load via setPage
                    pane.setPage(url);
                    loadedType.setText(pane.getContentType());
                } else {
                    pane.setContentType("text/html");
                    loadedType.setText(pane.getContentType());
                    if (loader == null) {
                        loader = new HTMLDocumentLoader();
                    }
                    HTMLDocument doc = loader.loadDocument(url);
                    loadComplete();
                    pane.setDocument(doc);
                    displayLoadTime();
                    populateCombo(findLinks(doc, null));
                    enableInput();
                }
            } catch (Exception e) {
                System.out.println(e);
                JOptionPane.showMessageDialog(pane,
                        new String[] { "Unable to open file", selection.toString() }, "File Open Error",
                        JOptionPane.ERROR_MESSAGE);
                loadingState.setText("Failed");
                enableInput();
            }
        }
    });

    // Listen for page load to complete
    pane.addPropertyChangeListener(new PropertyChangeListener() {
        public void propertyChange(PropertyChangeEvent evt) {
            if (evt.getPropertyName().equals("page")) {
                loadComplete();
                displayLoadTime();
                populateCombo(findLinks(pane.getDocument(), null));
                enableInput();
            }
        }
    });
}

From source file:org.executequery.gui.scriptgenerators.GenerateScriptsPanelThree.java

private void init() throws Exception {

    openInQueryEditor = new JCheckBox("View in a new Query Editor", true);

    gbc = new GridBagConstraints();
    gbc.gridx++;/*from  w  w w.java  2 s . com*/
    gbc.gridy++;
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.insets.top = 10;
    gbc.insets.left = 10;
    add(openInQueryEditor, gbc);
    gbc.gridy++;
    gbc.insets.left = 0;
    add(createFileOutputPanel(), gbc);

    gbc.gridy++;
    gbc.insets.top = 10;
    gbc.insets.bottom = 0;
    gbc.weighty = 1.0;
    gbc.weightx = 1.0;

    if (parent.getScriptType() == GenerateScriptsWizard.CREATE_TABLES) {

        createTableOptionsPanel();
        add(createTableOptionsPanel, gbc);

    } else {

        createUseCascadeCheck();
        useCascadeCheck.setBorder(BorderFactory.createEmptyBorder(0, 13, 0, 0));
        add(useCascadeCheck, gbc);
    }

}

From source file:org.jets3t.gui.ProgressPanel.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 v  a 2 s .  co m*/
        UIManager.setLookAndFeel(lookAndFeel);
    } catch (UnsupportedLookAndFeelException e) {
        log.error("Unable to set skinned LookAndFeel", e);
    }

    this.setLayout(new GridBagLayout());

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

    progressBar = skinsFactory.createSkinnedJProgressBar("ProgressPanelProgressBar", 0, 100);
    this.add(progressBar, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, insetsDefault, 0, 0));

    // Display the cancel button if a cancel event listener is available.
    cancelButton = skinsFactory.createSkinnedJButton("ProgressPanelCancelButton");
    guiUtils.applyIcon(cancelButton, "/images/nuvola/16x16/actions/cancel.png");
    cancelButton.setActionCommand("Cancel");
    cancelButton.addActionListener(this);
    cancelButton.setEnabled(cancelEventTrigger != null);

    this.add(cancelButton, new GridBagConstraints(2, 0, 1, 1, 0, 0, GridBagConstraints.EAST,
            GridBagConstraints.NONE, insetsDefault, 0, 0));
}

From source file:com.sshtools.sshterm.SshTermCommandTab.java

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

    JPanel main = new JPanel(new GridBagLayout());
    GridBagConstraints gbc = new GridBagConstraints();
    gbc.fill = GridBagConstraints.HORIZONTAL;
    gbc.anchor = GridBagConstraints.NORTH;
    gbc.insets = new Insets(0, 2, 2, 2);

    Insets ins2 = new Insets(2, 24, 2, 2);
    gbc.weightx = 1.0;
    requestPseudoTerminal.getModel().setSelected(false);
    disconnectOnSessionClose.getModel().setSelected(true);
    UIUtil.jGridBagAdd(main, requestPseudoTerminal, gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, disconnectOnSessionClose, gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, new JSeparator(JSeparator.HORIZONTAL), gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, onceAuthenticated, gbc, GridBagConstraints.REMAINDER);
    group.add(doNothing);
    group.add(startShell);
    group.add(executeCommands);
    startShell.setSelected(true);
    UIUtil.jGridBagAdd(main, doNothing, gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, startShell, gbc, GridBagConstraints.REMAINDER);
    UIUtil.jGridBagAdd(main, executeCommands, gbc, GridBagConstraints.REMAINDER);
    gbc.fill = GridBagConstraints.BOTH;
    gbc.insets = ins2;
    gbc.weighty = 1.0;

    //commands.setLineWrap(true);
    commands.setBorder(BorderFactory.createEtchedBorder());

    JScrollPane scroll = new JScrollPane(commands);
    scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
    scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
    UIUtil.jGridBagAdd(main, scroll, gbc, GridBagConstraints.REMAINDER);

    IconWrapperPanel iconProxyDetailsPanel = new IconWrapperPanel(new ResourceIcon(COMMANDS_ICON), main);
    commands.setRows(8);

    //  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:geneon.intellij.plugin.jenkins.ui.EditServerDialog.java

@Nullable
@Override// www .ja  v  a 2 s  . c om
protected JComponent createCenterPanel() {
    nameTextField.setMinimumSize(new Dimension(300, 10));
    urlTextField.setMinimumSize(new Dimension(300, 10));

    JButton testButton = new JButton("Test");
    testButton.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            testSettings();
        }
    });

    JPanel panel = new JPanel(new GridBagLayout());
    JLabel nameLabel = new JLabel("Server name:");
    panel.add(nameLabel, new GridBagConstraints(0, 0, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(0, 0, 5, 10), 0, 0));
    panel.add(nameTextField, new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0));
    JLabel urlLabel = new JLabel("URL:");
    panel.add(urlLabel, new GridBagConstraints(0, 1, 1, 1, 0, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(0, 0, 5, 10), 0, 0));
    panel.add(urlTextField, new GridBagConstraints(1, 1, 1, 1, 1, 0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0));
    panel.add(testButton, new GridBagConstraints(0, 2, 2, 1, 1, 0, GridBagConstraints.WEST,
            GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, 0));

    return panel;
}

From source file:com.litt.core.security.license.gui.ValidatePanel.java

/**
 * Create the panel.//from w  w  w.jav a  2  s  . co m
 */
public ValidatePanel() {
    GridBagLayout gbl_validatePanel = new GridBagLayout();
    gbl_validatePanel.columnWidths = new int[] { 0, 0, 0 };
    gbl_validatePanel.rowHeights = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
    gbl_validatePanel.columnWeights = new double[] { 0.0, 1.0, Double.MIN_VALUE };
    gbl_validatePanel.rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            Double.MIN_VALUE };
    this.setLayout(gbl_validatePanel);

    JLabel label_10 = new JLabel("");
    GridBagConstraints gbc_label_10 = new GridBagConstraints();
    gbc_label_10.insets = new Insets(0, 0, 5, 5);
    gbc_label_10.anchor = GridBagConstraints.EAST;
    gbc_label_10.gridx = 0;
    gbc_label_10.gridy = 0;
    this.add(label_10, gbc_label_10);

    field_pubKeyFilePath = new JTextField();
    field_pubKeyFilePath.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            JFileChooser fileChooser = new JFileChooser();
            //fileChooser.setVisible(true);
            LicenseFileFilter fileFilter = new LicenseFileFilter(new String[] { "key" });
            fileChooser.setFileFilter(fileFilter);
            fileChooser.addChoosableFileFilter(fileFilter);
            fileChooser.showOpenDialog(e.getComponent());
            File pubKeyFile = fileChooser.getSelectedFile();

            field_pubKeyFilePath.setText(pubKeyFile.getAbsolutePath());

        }
    });
    GridBagConstraints gbc_field_pubKeyFilePath = new GridBagConstraints();
    gbc_field_pubKeyFilePath.insets = new Insets(0, 0, 5, 0);
    gbc_field_pubKeyFilePath.fill = GridBagConstraints.HORIZONTAL;
    gbc_field_pubKeyFilePath.gridx = 1;
    gbc_field_pubKeyFilePath.gridy = 0;
    this.add(field_pubKeyFilePath, gbc_field_pubKeyFilePath);
    field_pubKeyFilePath.setColumns(10);

    JLabel label_19 = new JLabel("?");
    GridBagConstraints gbc_label_19 = new GridBagConstraints();
    gbc_label_19.anchor = GridBagConstraints.EAST;
    gbc_label_19.insets = new Insets(0, 0, 5, 5);
    gbc_label_19.gridx = 0;
    gbc_label_19.gridy = 1;
    this.add(label_19, gbc_label_19);

    field_licenseFilePath = new JTextField();
    field_licenseFilePath.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {
            JFileChooser fileChooser = new JFileChooser();
            //fileChooser.setVisible(true);
            LicenseFileFilter fileFilter = new LicenseFileFilter(new String[] { "xml" });
            fileChooser.setFileFilter(fileFilter);
            fileChooser.addChoosableFileFilter(fileFilter);
            fileChooser.showOpenDialog(e.getComponent());
            File licenseFile = fileChooser.getSelectedFile();

            field_licenseFilePath.setText(licenseFile.getAbsolutePath());
        }
    });
    GridBagConstraints gbc_textField1 = new GridBagConstraints();
    gbc_textField1.insets = new Insets(0, 0, 5, 0);
    gbc_textField1.fill = GridBagConstraints.HORIZONTAL;
    gbc_textField1.gridx = 1;
    gbc_textField1.gridy = 1;
    this.add(field_licenseFilePath, gbc_textField1);
    field_licenseFilePath.setColumns(10);

    JLabel lblid = new JLabel("?ID");
    lblid.setHorizontalAlignment(SwingConstants.CENTER);
    GridBagConstraints gbc_lblid = new GridBagConstraints();
    gbc_lblid.insets = new Insets(0, 0, 5, 5);
    gbc_lblid.gridx = 0;
    gbc_lblid.gridy = 2;
    this.add(lblid, gbc_lblid);

    label_licenseId = new JLabel("");
    label_licenseId.setHorizontalAlignment(SwingConstants.CENTER);
    GridBagConstraints gbc_label_licenseId = new GridBagConstraints();
    gbc_label_licenseId.insets = new Insets(0, 0, 5, 0);
    gbc_label_licenseId.gridx = 1;
    gbc_label_licenseId.gridy = 2;
    this.add(label_licenseId, gbc_label_licenseId);

    JLabel label_12 = new JLabel("?");
    GridBagConstraints gbc_label_12 = new GridBagConstraints();
    gbc_label_12.insets = new Insets(0, 0, 5, 5);
    gbc_label_12.gridx = 0;
    gbc_label_12.gridy = 3;
    this.add(label_12, gbc_label_12);

    label_licenseType = new JLabel("");
    GridBagConstraints gbc_label_licenseType = new GridBagConstraints();
    gbc_label_licenseType.insets = new Insets(0, 0, 5, 0);
    gbc_label_licenseType.gridx = 1;
    gbc_label_licenseType.gridy = 3;
    this.add(label_licenseType, gbc_label_licenseType);

    JLabel label_13 = new JLabel("???");
    GridBagConstraints gbc_label_13 = new GridBagConstraints();
    gbc_label_13.insets = new Insets(0, 0, 5, 5);
    gbc_label_13.gridx = 0;
    gbc_label_13.gridy = 4;
    this.add(label_13, gbc_label_13);

    label_productName = new JLabel("");
    GridBagConstraints gbc_label_productName = new GridBagConstraints();
    gbc_label_productName.insets = new Insets(0, 0, 5, 0);
    gbc_label_productName.gridx = 1;
    gbc_label_productName.gridy = 4;
    this.add(label_productName, gbc_label_productName);

    JLabel label_14 = new JLabel("???");
    GridBagConstraints gbc_label_14 = new GridBagConstraints();
    gbc_label_14.insets = new Insets(0, 0, 5, 5);
    gbc_label_14.gridx = 0;
    gbc_label_14.gridy = 5;
    this.add(label_14, gbc_label_14);

    label_companyName = new JLabel("");
    GridBagConstraints gbc_label_companyName = new GridBagConstraints();
    gbc_label_companyName.insets = new Insets(0, 0, 5, 0);
    gbc_label_companyName.gridx = 1;
    gbc_label_companyName.gridy = 5;
    this.add(label_companyName, gbc_label_companyName);

    JLabel label_15 = new JLabel("??");
    GridBagConstraints gbc_label_15 = new GridBagConstraints();
    gbc_label_15.insets = new Insets(0, 0, 5, 5);
    gbc_label_15.gridx = 0;
    gbc_label_15.gridy = 6;
    this.add(label_15, gbc_label_15);

    label_customerName = new JLabel("");
    GridBagConstraints gbc_label_customerName = new GridBagConstraints();
    gbc_label_customerName.insets = new Insets(0, 0, 5, 0);
    gbc_label_customerName.gridx = 1;
    gbc_label_customerName.gridy = 6;
    this.add(label_customerName, gbc_label_customerName);

    JLabel label_16 = new JLabel("");
    GridBagConstraints gbc_label_16 = new GridBagConstraints();
    gbc_label_16.insets = new Insets(0, 0, 5, 5);
    gbc_label_16.gridx = 0;
    gbc_label_16.gridy = 7;
    this.add(label_16, gbc_label_16);

    label_version = new JLabel("");
    GridBagConstraints gbc_label_version = new GridBagConstraints();
    gbc_label_version.insets = new Insets(0, 0, 5, 0);
    gbc_label_version.gridx = 1;
    gbc_label_version.gridy = 7;
    this.add(label_version, gbc_label_version);

    JLabel label_11 = new JLabel("");
    GridBagConstraints gbc_label_11 = new GridBagConstraints();
    gbc_label_11.insets = new Insets(0, 0, 5, 5);
    gbc_label_11.gridx = 0;
    gbc_label_11.gridy = 8;
    this.add(label_11, gbc_label_11);

    label_createDate = new JLabel("");
    GridBagConstraints gbc_label_createDate = new GridBagConstraints();
    gbc_label_createDate.insets = new Insets(0, 0, 5, 0);
    gbc_label_createDate.gridx = 1;
    gbc_label_createDate.gridy = 8;
    this.add(label_createDate, gbc_label_createDate);

    JLabel label_17 = new JLabel("");
    GridBagConstraints gbc_label_17 = new GridBagConstraints();
    gbc_label_17.insets = new Insets(0, 0, 5, 5);
    gbc_label_17.gridx = 0;
    gbc_label_17.gridy = 9;
    this.add(label_17, gbc_label_17);

    label_expiredDate = new JLabel("");
    GridBagConstraints gbc_label_expiredDate = new GridBagConstraints();
    gbc_label_expiredDate.insets = new Insets(0, 0, 5, 0);
    gbc_label_expiredDate.gridx = 1;
    gbc_label_expiredDate.gridy = 9;
    this.add(label_expiredDate, gbc_label_expiredDate);

    JButton button_2 = new JButton("");
    button_2.addMouseListener(new MouseAdapter() {
        public void mouseClicked(MouseEvent e) {

            String licenseFilePath = Utility.trimNull(field_licenseFilePath.getText());
            String pubKeyFilePath = Utility.trimNull(field_pubKeyFilePath.getText());
            if (Utility.isEmpty(licenseFilePath)) {
                JOptionPane.showMessageDialog(e.getComponent(), "?!");
                return;
            }
            if (Utility.isEmpty(pubKeyFilePath)) {
                JOptionPane.showMessageDialog(e.getComponent(), "!");
                return;
            }
            File licenseFile = new File(licenseFilePath);
            try {
                XMLConfiguration config = new XMLConfiguration(licenseFile);
                config.setAutoSave(true);

                label_licenseId.setText(config.getString(("licenseId")));
                label_licenseType.setText(config.getString("licenseType"));
                label_productName.setText(config.getString("productName"));
                label_companyName.setText(config.getString("companyName"));
                label_customerName.setText(config.getString("customerName"));
                label_version.setText(config.getString("version"));
                label_createDate.setText(config.getString("createDate"));
                label_expiredDate.setText(config.getString("expiredDate"));

            } catch (Exception e1) {
                // TODO Auto-generated catch block
                JOptionPane.showMessageDialog(e.getComponent(), e1.getMessage());
            }

            try {
                LicenseManager.validateLicense(licenseFile.getAbsolutePath(), pubKeyFilePath);
                JOptionPane.showMessageDialog(e.getComponent(), "?");
            } catch (LicenseException e1) {
                // TODO Auto-generated catch block
                JOptionPane.showMessageDialog(e.getComponent(), e1.getMessage());
            }

        }
    });
    GridBagConstraints gbc_button_2 = new GridBagConstraints();
    gbc_button_2.gridx = 1;
    gbc_button_2.gridy = 10;
    this.add(button_2, gbc_button_2);
}

From source file:net.daboross.outputtablesclient.gui.OutputInterface.java

public OutputInterface(final Application application) {
    this.application = application;

    // persistEnabled
    JSONObject parentObj = application.getPersist().getStorageObject();
    JSONObject tempPersistEnabled = parentObj.optJSONObject("last-shown-panels");
    if (tempPersistEnabled == null) {
        tempPersistEnabled = new JSONObject();
        parentObj.put("last-shown-panels", tempPersistEnabled);
    }//from w w  w . j a v  a 2  s. c  o m
    persistEnabled = tempPersistEnabled;

    // constraints
    toggleButtonConstraints = new GBC().ipadx(2).ipady(2).gridx(0).gridy(-1)
            .fill(GridBagConstraints.HORIZONTAL);
    tablePanelConstraints = new GBC().gridx(0).gridy(-1).weightx(1).weighty(0).anchor(GridBagConstraints.EAST)
            .fill(GridBagConstraints.HORIZONTAL);

    // mainTabPanel
    mainTabPanel = new JPanel();
    mainTabPanel.setLayout(new GridBagLayout());
    application.getRoot().getMainPanel().add(mainTabPanel,
            new GBC().weightx(1).weighty(1).fill(GridBagConstraints.BOTH).gridx(0).gridy(1));

    // toggleButtonPanel
    toggleButtonPanel = new JPanel();
    toggleButtonPanel.setLayout(new GridBagLayout());
    mainTabPanel.add(toggleButtonPanel, new GBC().weightx(0).weighty(0).gridx(0).gridy(0)
            .insets(new Insets(0, 0, 10, 10)).anchor(GridBagConstraints.NORTHWEST));

    // tableRootPanel
    tableRootPanel = new JPanel(new GridBagLayout());
    mainTabPanel.add(tableRootPanel, new GBC().weightx(1).weighty(1).fill(GridBagConstraints.BOTH).gridx(2)
            .gridy(0).anchor(GridBagConstraints.EAST));

    // maps
    tableKeyToTableButton = new TreeMap<>();
    tableKeyToTableEnabled = new TreeMap<>();
    tableKeyToTablePanel = new HashMap<>();
    tableKeyAndKeyToValuePanel = new HashMap<>();
    tableKeyAndKeyToValueLabel = new HashMap<>();
    tableKeyToTableTitledBoarder = new HashMap<>();
}