Example usage for javax.swing JLabel setText

List of usage examples for javax.swing JLabel setText

Introduction

In this page you can find the example usage for javax.swing JLabel setText.

Prototype

@BeanProperty(preferred = true, visualUpdate = true, description = "Defines the single line of text this component will display.")
public void setText(String text) 

Source Link

Document

Defines the single line of text this component will display.

Usage

From source file:uk.ac.soton.mib104.t2.activities.json.ui.config.JSONPathConfigurationPanel.java

protected void initGui() {
    this.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
    this.setLayout(new GridBagLayout());

    jsonPathAsTextField.setMinimumSize(new Dimension(240, jsonPathAsTextField.getMinimumSize().height));
    jsonPathAsTextField.setPreferredSize(jsonPathAsTextField.getMinimumSize());
    jsonPathAsTextField.setText("");

    jsonPathButton.addActionListener(new ActionListener() {

        @Override//  w w w.j  a  va 2  s .c  om
        public void actionPerformed(final ActionEvent e) {
            final JSONPathInputDialog jsonPathInputDialog = new JSONPathInputDialog(
                    SwingUtilities.getWindowAncestor(JSONPathConfigurationPanel.this));

            final JSONPathInputPanel jsonPathInputPane = jsonPathInputDialog.getJSONPathInputPane();

            jsonPathInputPane.getJSONDocumentEditorPane().setText(jsonPathInputDialog_jsonPathEditorPane_text);

            jsonPathInputPane.getJsonPathEditorPane()
                    .setJSONValue(jsonPathInputDialog_jsonPathEditorPane_value);
            jsonPathInputPane.getJsonPathEditorPane()
                    .setTreeVisible(jsonPathInputDialog_jsonPathEditorPane_treeVisible);
            jsonPathInputPane.getJsonPathEditorPane().setText(jsonPathAsTextField.getText());

            jsonPathInputDialog.setVisible(true);

            switch (jsonPathInputDialog.getOption()) {
            case JOptionPane.OK_OPTION:
                break;
            default:
                return;
            }

            jsonPathInputDialog_jsonPathEditorPane_text = jsonPathInputPane.getJSONDocumentEditorPane()
                    .getText();
            jsonPathInputDialog_jsonPathEditorPane_treeVisible = jsonPathInputPane.getJsonPathEditorPane()
                    .isTreeVisible();
            jsonPathInputDialog_jsonPathEditorPane_value = jsonPathInputPane.getJsonPathEditorPane()
                    .getJSONValue();

            jsonPathAsTextField.setText(jsonPathInputPane.getJsonPathEditorPane().getText());
        }

    });
    jsonPathButton.setFont(jsonPathButton.getFont().deriveFont(11f));
    jsonPathButton.setIcon(JSONPathServiceIcon.getIcon());
    jsonPathButton.setText(jsonPathButtonText);
    jsonPathButton.setToolTipText(jsonPathButtonTip);

    final JLabel portDepthLabel = new JLabel();
    portDepthLabel.setFont(portDepthLabel.getFont().deriveFont(11f));
    portDepthLabel.setHorizontalAlignment(JLabel.LEFT);
    portDepthLabel.setIcon(Silk.getHelpIcon());
    portDepthLabel.setText(portDepthInputPaneText);
    portDepthLabel.setToolTipText(portDepthInputPaneTip);

    final GridBagConstraints constraints = new GridBagConstraints();
    constraints.fill = GridBagConstraints.HORIZONTAL;
    constraints.gridx = 0;
    constraints.gridy = 0;

    constraints.anchor = GridBagConstraints.WEST;
    this.add(JSONPathTextField.createLabelForDocument(jsonPathAsTextField.getDocument()), constraints);

    constraints.gridx++;

    constraints.anchor = GridBagConstraints.EAST;
    constraints.weightx = 1d;
    this.add(jsonPathAsTextField, constraints);
    constraints.weightx = 0;

    constraints.gridx++;

    constraints.fill = GridBagConstraints.NONE;
    this.add(jsonPathButton, constraints);

    constraints.gridx--;

    constraints.gridy++;

    constraints.anchor = GridBagConstraints.CENTER;
    this.add(JSONPathTextField.createLabelForDocumentationURI(), constraints);
    constraints.fill = GridBagConstraints.HORIZONTAL;

    constraints.gridx = 0;
    constraints.gridy++;

    constraints.gridwidth = 3;
    this.add(new JSeparator(JSeparator.HORIZONTAL), constraints);
    constraints.gridwidth = 1;

    constraints.gridx = 0;
    constraints.gridy++;

    constraints.anchor = GridBagConstraints.WEST;
    this.add(portDepthLabel, constraints);

    constraints.gridx++;

    constraints.anchor = GridBagConstraints.EAST;
    constraints.gridwidth = 2;
    this.add(portDepthInputPane, constraints);
    constraints.gridwidth = 1;
}

From source file:uk.nhs.cfh.dsp.srth.desktop.modules.querycreationtreepanel.renderer.ReportingQueryStatementTreeCellRenderer.java

public Component getTreeCellRendererComponent(JTree tree, Object value, boolean selected, boolean expanded,
        boolean leaf, int row, boolean hasFocus) {

    final JLabel label = new JLabel();
    if (value instanceof QueryExpression) {
        QueryExpression expression = (QueryExpression) value;

        if (expression instanceof QueryStatement) {
            label.setText("Get patients who have");
        } else if (expression instanceof QueryIntersectionExpression) {
            QueryIntersectionExpression intersectionObject = (QueryIntersectionExpression) expression;
            QueryExpression.QueryOperatorType operatorType = intersectionObject.getOperator();
            if (operatorType != QueryExpression.QueryOperatorType.AND) {
                label.setText("ALL of the following (" + operatorType.toString() + ")");
            } else {
                label.setText("ALL of the following");
            }/*from w w w .  ja va 2s .  c  om*/
        } else if (expression instanceof QueryUnionExpression) {
            label.setText("ANY of the following");
        } else if (expression instanceof QueryComponentExpression) {
            QueryComponentExpression componentExpression = (QueryComponentExpression) value;
            TerminologyConstraint includedConstraint = componentExpression.getIncludedConstraint();
            if (includedConstraint != null) {
                String text = humanReadableRender
                        .getHumanReadableLabel((CloseToUserExpression) includedConstraint.getExpression());
                label.setText(text);
            }

            final Collection<TerminologyConstraint> excludedTerms = componentExpression
                    .getExcludedConstraints();
            if (excludedTerms.size() > 0) {
                label.setIcon(icon);
            }

            SwingUtilities.updateComponentTreeUI(label);
        }

        // set label text color based on run time status
        setFontColor(expression, label);
    }

    if (hasFocus) {
        Color lineColor = UIManager.getColor("Tree.selectionBorderColor");
        label.setBorder(BorderFactory.createLineBorder(lineColor));
        label.setBackground(UIManager.getColor("Tree.selectionBackground"));
    } else {
        label.setBorder(BorderFactory.createEmptyBorder(1, 1, 1, 1));
        label.setBackground(UIManager.getColor("Tree.background"));
    }

    return label;
}

From source file:uk.nhs.cfh.dsp.yasb.searchpanel.renderer.SearchResultListCellRenderer.java

public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected,
        boolean hasFocus) {

    JLabel label = new JLabel();
    label.setOpaque(true);/*w  w  w.j a v a 2 s  .co m*/
    if (value instanceof Document) {
        // get field that has value of the fully specified name
        Document doc = (Document) value;
        if (isRenderConceptId()) {
            label.setText("<html><b>" + doc.get("TERM") + "</b><font color=\"eee\">|" + doc.get("CONCEPTID")
                    + "|</font></html>");
        } else {
            label.setText("<html><b>" + doc.get("TERM") + "</b></html>");
        }

        // set icon based on status
        String status = doc.get("STATUS");
        if ("limited".equalsIgnoreCase(status)) {
            label.setIcon(limitedStatusIcon);
        } else if ("duplicate".equalsIgnoreCase(status)) {
            label.setIcon(duplicateStatusIcon);
        } else if ("ambiguous".equalsIgnoreCase(status)) {
            label.setIcon(ambiguousStatusIcon);
        } else {
            label.setIcon(currentStatusIcon);
        }

        // always set tooltip to FSN + concept id
        label.setToolTipText("<html><b>" + doc.get("TERM") + "</b><font color=\"eee\">|" + doc.get("CONCEPTID")
                + "|</font></html>");
    }

    if (isSelected) {
        label.setBackground(UIManager.getColor("Tree.selectionbackground"));
    } else {
        label.setBackground(UIManager.getColor("Tree.background"));
    }

    return label;
}

From source file:View.ReadView.java

public ReadView(ReadController controller, Email obj) throws IOException {
    this.frame = new JFrame();
    this.topPane = new JPanel();
    this.topLeftPane = new JPanel();
    this.topRightPane = new JPanel();
    this.topBottomPane = new JPanel();
    this.container = frame.getContentPane();
    this.controller = controller;
    this.bottomPane = new JPanel();

    frame.setTitle("Ler Email");

    container.setLayout(new BorderLayout(20, 20));

    JButton btnSave = new JButton("Salvar no Banco");
    btnSave.addActionListener((ActionEvent e) -> {
        try {//www .  ja  v  a2  s .c om
            if (controller.save()) {
                JOptionPane.showMessageDialog(null, "Mensagem salva com sucesso");
            } else {
                JOptionPane.showMessageDialog(null, "Erro ao salvar mensagem");
            }
        } catch (ClassNotFoundException | SQLException | ParseException ex) {
            Logger.getLogger(ReadView.class.getName()).log(Level.SEVERE, null, ex);
        }
    });

    JLabel labelAddress = new JLabel();
    labelAddress.setText("Email: " + obj.getAddress());

    JLabel labelDate = new JLabel();
    labelDate.setText("Data: " + obj.getDate());

    JLabel labelSubject = new JLabel();
    labelSubject.setText("Assunto: " + obj.getSubject());

    JTextArea message = new JTextArea();
    message.append("Mensagem aqui..." + obj.getMessage());

    messagePane = new JScrollPane(message);

    topPane.setLayout(new BorderLayout(20, 20));
    topPane.add(BorderLayout.WEST, topLeftPane);
    topPane.add(BorderLayout.EAST, topRightPane);
    topPane.add(BorderLayout.SOUTH, topBottomPane);

    topLeftPane.setLayout(new FlowLayout(FlowLayout.LEFT));
    topRightPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
    topBottomPane.setLayout(new FlowLayout(FlowLayout.LEFT));

    topLeftPane.add(labelAddress);
    topRightPane.add(labelDate);
    topBottomPane.add(labelSubject);

    bottomPane.add(btnSave);

    container.add(BorderLayout.NORTH, topPane);
    container.add(BorderLayout.CENTER, messagePane);
    container.add(BorderLayout.SOUTH, bottomPane);

    frame.pack();

    frame.setResizable(false);
    frame.setLocationRelativeTo(null);
    frame.setSize(600, 600);

    Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
    frame.setLocation(dim.width / 2 - frame.getSize().width / 2, dim.height / 2 - frame.getSize().height / 2);

    frame.setVisible(true);
}

From source file:Widgets.Simulation.java

public Simulation(final JFrame aFrame, NetworkElement item) {
    super(aFrame);
    grn = ((DynamicalModelElement) item).getGeneNetwork();
    plot = new Plot2DPanel();

    //closing listener
    this.addWindowListener(new WindowAdapter() {
        @Override/*from   w  w  w.  j  a va  2  s.c om*/
        public void windowClosing(WindowEvent windowEvent) {
            if (simulation != null && simulation.myThread_.isAlive()) {
                simulation.stop();
                System.out.print("Simulation is canceled.\n");
                JOptionPane.showMessageDialog(new Frame(), "Simulation is canceled.", "Warning!",
                        JOptionPane.INFORMATION_MESSAGE);
            }
            escapeAction();
        }
    });

    // Model
    model_.setModel(new DefaultComboBoxModel(new String[] { "Deterministic Model (ODEs)",
            "Stochastic Model (SDEs)", "Stochastic Simulation (Gillespie Algorithm)" }));
    model_.setSelectedIndex(0);

    setModelAction();

    //set plot part
    //display result
    if (grn.getTimeScale().size() >= 1) {
        //update parameters
        numTimeSeries_.setValue(grn.getTraj_itsValue());
        tmax_.setValue(grn.getTraj_maxTime());
        sdeDiffusionCoeff_.setValue(grn.getTraj_noise());

        if (grn.getTraj_model().equals("ode"))
            model_.setSelectedIndex(0);
        else if (grn.getTraj_model().equals("sde"))
            model_.setSelectedIndex(1);
        else
            model_.setSelectedIndex(2);

        //update plot
        trajPlot.removeAll();
        trajPlot.add(trajectoryTabb());
        trajPlot.updateUI();
        trajPlot.setVisible(true);
        trajPlot.repaint();

        analyzeResult.setVisible(true);
    }

    /**
     * ACTIONS
     */

    model_.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent arg0) {
            setModelAction();
        }
    });

    analyzeResult.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            final JDialog a = new JDialog();
            a.setSize(new Dimension(500, 450));
            a.setModal(true);
            a.setTitle("Gene List (seperated by ';')");
            a.setLocationRelativeTo(null);

            final JTextArea focusGenesArea = new JTextArea();
            focusGenesArea.setLineWrap(true);
            focusGenesArea.setEditable(false);
            focusGenesArea.setRows(3);

            String geneNames = "";
            for (int i = 0; i < grn.getNodes().size(); i++)
                geneNames += grn.getNodes().get(i).getLabel() + ";";
            focusGenesArea.setText(geneNames);

            JButton submitButton = new JButton("Submit");
            JButton cancelButton = new JButton("Cancel");
            JPanel buttonPanel = new JPanel();
            buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
            buttonPanel.add(submitButton);
            buttonPanel.add(cancelButton);

            cancelButton.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent arg0) {
                    a.dispose();
                }
            });

            submitButton.addActionListener(new ActionListener() {
                public void actionPerformed(final ActionEvent arg0) {
                    a.dispose();
                    final JDialog a = new JDialog();
                    a.setSize(new Dimension(500, 450));
                    a.setModal(true);
                    a.setTitle("Statistics");
                    a.setLocationRelativeTo(null);

                    if (grn.getTimeSeries().isEmpty()) {
                        JOptionPane.showMessageDialog(new Frame(), "Please run the simulation first.",
                                "Warning!", JOptionPane.INFORMATION_MESSAGE);
                    } else {
                        JPanel infoPanel = new JPanel();
                        infoPanel.setLayout(new BorderLayout());

                        //output 
                        String[] focusGenes = focusGenesArea.getText().split(";");
                        ;
                        String content = "";

                        //discrete the final state
                        int dimension = grn.getNodes().size();

                        //get gene index
                        int[] focus_index = new int[focusGenes.length];
                        for (int j = 0; j < focusGenes.length; j++)
                            for (int i = 0; i < dimension; i++)
                                if (grn.getNode(i).getLabel().equals(focusGenes[j]))
                                    focus_index[j] = i;

                        JScrollPane jsp = new JScrollPane();
                        //calculate steady states      
                        grn.setLand_itsValue((Integer) numTimeSeries_.getModel().getValue());
                        int[] isConverge = new int[grn.getTraj_itsValue()];
                        String out = calculateSteadyStates(focusGenes, focus_index, isConverge);

                        //show the convergence
                        final JDialog ifconvergent = new JDialog();
                        ifconvergent.setSize(new Dimension(500, 450));
                        ifconvergent.setModal(true);
                        ifconvergent.setTitle("Convergence");
                        ifconvergent.setLocationRelativeTo(null);

                        ConvergenceTable tablePanel = new ConvergenceTable(isConverge);
                        JButton continueButton = new JButton("Click to check the attractors.");
                        continueButton.addActionListener(new ActionListener() {
                            public void actionPerformed(final ActionEvent arg0) {
                                ifconvergent.dispose();
                            }
                        });

                        JPanel ifconvergentPanel = new JPanel();
                        ifconvergentPanel.setLayout(new BorderLayout());
                        ifconvergentPanel.add(tablePanel, BorderLayout.NORTH);
                        ifconvergentPanel.add(continueButton, BorderLayout.SOUTH);

                        ifconvergent.add(ifconvergentPanel);
                        ifconvergent.setVisible(true);

                        //show attractors
                        if (out.equals("ok")) {
                            AttractorTable panel = new AttractorTable(grn, focusGenes);
                            jsp.setViewportView(panel);
                        } else if (grn.getSumPara().size() == 0)
                            content += "Cannot find a steady state!";
                        else
                            content += "\nI dont know why!";

                        if (content != "") {
                            JLabel warningLabel = new JLabel();
                            warningLabel.setText(content);
                            jsp.setViewportView(warningLabel);
                        }

                        grn.setSumPara(null);
                        grn.setCounts(null);

                        //jsp.setPreferredSize(new Dimension(280,130));
                        jsp.setVerticalScrollBarPolicy(ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED);
                        jsp.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
                        infoPanel.add(jsp, BorderLayout.CENTER);

                        a.add(infoPanel);
                        a.setVisible(true);
                    } //end of else
                }

            });

            JPanel options3 = new JPanel();
            options3.setLayout(new BorderLayout());
            options3.add(focusGenesArea, BorderLayout.NORTH);
            options3.add(buttonPanel);

            options3.setBorder(new EmptyBorder(5, 0, 5, 0));

            a.add(options3);
            a.setVisible(true);
        }
    });

    runButton_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            //System.out.print("Memory start: "+s_runtime.totalMemory()+"\n"); 
            enterAction();
        }
    });

    cancelButton_.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            if (simulation != null)
                simulation.stop();
            System.out.print("Simulation is canceled!\n");
        }
    });

    fixButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            JDialog a = new JDialog();
            a.setTitle("Fixed initial values");
            a.setSize(new Dimension(400, 400));
            a.setLocationRelativeTo(null);

            JPanel speciesPanel = new JPanel();
            String[] columnName = { "Name", "InitialValue" };
            boolean editable = false; //false;
            new SpeciesTable(speciesPanel, columnName, grn, editable);

            /** LAYOUT **/
            JPanel wholePanel = new JPanel();
            wholePanel.setLayout(new BoxLayout(wholePanel, BoxLayout.Y_AXIS));
            wholePanel.add(speciesPanel);

            a.add(wholePanel);
            a.setModal(true);
            a.setVisible(true);
        }
    });

    randomButton.addActionListener(new ActionListener() {
        public void actionPerformed(final ActionEvent arg0) {
            final JDialog a = new JDialog();
            a.setTitle("Set boundaries");
            a.setSize(new Dimension(300, 200));
            a.setModal(true);
            a.setLocationRelativeTo(null);

            JPanel upPanel = new JPanel();
            JLabel upLabel = new JLabel("Input the upper boundary: ");
            final JTextField upValue = new JTextField("3");
            upPanel.setLayout(new BoxLayout(upPanel, BoxLayout.X_AXIS));
            upPanel.add(upLabel);
            upPanel.add(upValue);

            JPanel lowPanel = new JPanel();
            JLabel lowLabel = new JLabel("Input the lower boundary: ");
            final JTextField lowValue = new JTextField("0");
            lowPanel.setLayout(new BoxLayout(lowPanel, BoxLayout.X_AXIS));
            lowPanel.add(lowLabel);
            lowPanel.add(lowValue);

            JPanel buttonPanel = new JPanel();
            JButton submit = new JButton("Submit");
            JButton cancel = new JButton("Cancel");
            buttonPanel.setLayout(new BoxLayout(buttonPanel, BoxLayout.X_AXIS));
            buttonPanel.add(submit);
            buttonPanel.add(cancel);
            buttonPanel.setBorder(new EmptyBorder(5, 5, 5, 5));

            submit.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    if (upValue.getText().equals(""))
                        JOptionPane.showMessageDialog(null, "Please input upper boundary", "Error",
                                JOptionPane.ERROR_MESSAGE);
                    else {
                        try {
                            upbound = Double.parseDouble(upValue.getText());

                            if (lowValue.getText().equals(""))
                                JOptionPane.showMessageDialog(null, "Please input lower boundary", "Error",
                                        JOptionPane.ERROR_MESSAGE);
                            else {
                                try {
                                    lowbound = Double.parseDouble(lowValue.getText());

                                    if (upbound < lowbound)
                                        JOptionPane.showMessageDialog(null,
                                                "Upper boundary should be not less than lower boundary",
                                                "Error", JOptionPane.ERROR_MESSAGE);
                                    else
                                        a.dispose();
                                } catch (Exception er) {
                                    JOptionPane.showMessageDialog(null, "Invalid value", "Error",
                                            JOptionPane.INFORMATION_MESSAGE);
                                    MsgManager.Messages.errorMessage(er, "Error", "");
                                }
                            }
                        } catch (Exception er) {
                            JOptionPane.showMessageDialog(null, "Invalid value", "Error",
                                    JOptionPane.INFORMATION_MESSAGE);
                            MsgManager.Messages.errorMessage(er, "Error", "");
                        }
                    }

                }
            });

            cancel.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    JOptionPane.showMessageDialog(null, "The default values are used!", "",
                            JOptionPane.INFORMATION_MESSAGE);
                    a.dispose();
                }
            });

            JPanel wholePanel = new JPanel();
            wholePanel.setLayout(new BoxLayout(wholePanel, BoxLayout.Y_AXIS));
            wholePanel.add(upPanel);
            wholePanel.add(lowPanel);
            wholePanel.add(buttonPanel);
            wholePanel.setBorder(new EmptyBorder(5, 5, 5, 5));

            a.add(wholePanel);
            a.setVisible(true);

        }
    });
}

From source file:windows.ValidateEntity.java

public boolean validate(AbstractForm form, String[] fieldsName, String[] excludeField) {
    List<JLabel> lista = new ArrayList<>();
    Field[] fields = ReflectionUtils.getAllFields(form.getClass());
    for (Field field : fields) {
        if (JLabel.class.isAssignableFrom(field.getType())) {
            JLabel l = ReflectionUtils.runGetter(field, form);
            l.setText(null);
            l.setVisible(false);/*from  w  w w.ja v  a 2s  . c  om*/
            lista.add(l);
        }
    }
    ValidationContex fieldError = validateGeneral(fieldsName, excludeField);
    if (fieldError == null) {
        return true;
    }
    for (JLabel label : lista) {
        if (label.getLabelFor().getName().equalsIgnoreCase(fieldError.field().getName())) {
            label.setText("<html><p>" + fieldError.message().replace("\n", "<br>") + "</p></html>");
            label.setVisible(true);
        }
    }
    return false;
}

From source file:yp.tibco.com.yang.lottery.client.GraphicalLotteryClient.java

private void initComponents() {
    JLabel jLabel1 = new JLabel();
    jTextFieldHost = new JTextField();
    jButtonConnect = new JButton();
    JLabel jLabel3 = new JLabel();
    jSpinnerWidth = new JSpinner();
    JLabel label5 = new JLabel();
    jSpinnerChars = new JSpinner();
    checkBoxContinuous = new JCheckBox();
    JLabel jLabel2 = new JLabel();
    jTextFieldPort = new JTextField();
    jButtonDisconnect = new JButton();
    JLabel jLabel4 = new JLabel();
    jSpinnerHeight = new JSpinner();
    jButtonSendRequest = new JButton();
    imagePanel1 = new LotteryPanel();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    setMinimumSize(new Dimension(700, 300));
    setPreferredSize(new Dimension(740, 600));
    Container contentPane = getContentPane();
    contentPane.setLayout(new GridBagLayout());
    ((GridBagLayout) contentPane.getLayout()).columnWidths = new int[] { 36, 167, 99, 41, 66, 75, 57, 96, 0,
            0 };// w  w  w . j  ava2 s . c  o  m
    ((GridBagLayout) contentPane.getLayout()).rowHeights = new int[] { 10, 31, 31, 256, 0 };
    ((GridBagLayout) contentPane.getLayout()).columnWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 1.0, 1.0E-4 };
    ((GridBagLayout) contentPane.getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 1.0, 1.0E-4 };

    //---- jLabel1 ----
    jLabel1.setText("Host");
    contentPane.add(jLabel1, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
    contentPane.add(jTextFieldHost, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jButtonConnect ----
    jButtonConnect.setText("Connect");
    jButtonConnect.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jButtonConnectActionPerformed();
        }
    });
    contentPane.add(jButtonConnect, new GridBagConstraints(2, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jLabel3 ----
    jLabel3.setText("Width");
    contentPane.add(jLabel3, new GridBagConstraints(3, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
    contentPane.add(jSpinnerWidth, new GridBagConstraints(4, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- label5 ----
    label5.setText("characters");
    contentPane.add(label5, new GridBagConstraints(5, 1, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
            GridBagConstraints.VERTICAL, new Insets(0, 0, 5, 5), 0, 0));
    contentPane.add(jSpinnerChars, new GridBagConstraints(6, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 10), 0, 0));

    //---- checkBoxContinuous ----
    checkBoxContinuous.setText("continuous");
    contentPane.add(checkBoxContinuous, new GridBagConstraints(7, 1, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jLabel2 ----
    jLabel2.setText("Port");
    contentPane.add(jLabel2, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 5), 0, 0));
    contentPane.add(jTextFieldPort, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jButtonDisconnect ----
    jButtonDisconnect.setText("Disconnect");
    jButtonDisconnect.setEnabled(false);
    jButtonDisconnect.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jButtonDisconnectActionPerformed();
        }
    });
    contentPane.add(jButtonDisconnect, new GridBagConstraints(2, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jLabel4 ----
    jLabel4.setText("Height");
    contentPane.add(jLabel4, new GridBagConstraints(3, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 5, 5), 0, 0));
    contentPane.add(jSpinnerHeight, new GridBagConstraints(4, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //---- jButtonSendRequest ----
    jButtonSendRequest.setText("Send Request");
    jButtonSendRequest.setEnabled(false);
    jButtonSendRequest.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            jButtonSendRequestActionPerformed();
        }
    });
    contentPane.add(jButtonSendRequest, new GridBagConstraints(5, 2, 2, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 5, 5, 10), 0, 0));

    //======== imagePanel1 ========
    {
        imagePanel1.setBackground(new Color(51, 153, 255));
        imagePanel1.setPreferredSize(new Dimension(500, 500));

        { // compute preferred size
            Dimension preferredSize = new Dimension();
            for (int i = 0; i < imagePanel1.getComponentCount(); i++) {
                Rectangle bounds = imagePanel1.getComponent(i).getBounds();
                preferredSize.width = Math.max(bounds.x + bounds.width, preferredSize.width);
                preferredSize.height = Math.max(bounds.y + bounds.height, preferredSize.height);
            }
            Insets insets = imagePanel1.getInsets();
            preferredSize.width += insets.right;
            preferredSize.height += insets.bottom;
            imagePanel1.setMinimumSize(preferredSize);
            imagePanel1.setPreferredSize(preferredSize);
        }
    }
    contentPane.add(imagePanel1, new GridBagConstraints(0, 3, 9, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(8, 5, 8, 5), 0, 0));
    pack();
    setLocationRelativeTo(getOwner());
}