Example usage for java.awt.event FocusAdapter FocusAdapter

List of usage examples for java.awt.event FocusAdapter FocusAdapter

Introduction

In this page you can find the example usage for java.awt.event FocusAdapter FocusAdapter.

Prototype

FocusAdapter

Source Link

Usage

From source file:op.care.med.structure.DlgTradeForm.java

/**
 * This method is called from within the constructor to
 * initialize the form.//  w  w w . j av a 2 s  . c  o  m
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jPanel1 = new JPanel();
    txtZusatz = new JTextField();
    cmbForm = new JComboBox<>();
    panel2 = new JPanel();
    btnAdd = new JButton();
    hSpacer1 = new JPanel(null);
    btnEdit = new JButton();
    panel4 = new JPanel();
    cbExpiresAfterOpened = new JCheckBox();
    hSpacer2 = new JPanel(null);
    txtExpiresIn = new JTextField();
    hSpacer3 = new JPanel(null);
    cmbDaysWeeks = new JComboBox();
    cbWeightControlled = new JCheckBox();
    panel1 = new JPanel();
    btnCancel = new JButton();
    btnOK = new JButton();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setResizable(false);
    setModal(true);
    Container contentPane = getContentPane();
    contentPane.setLayout(new BoxLayout(contentPane, BoxLayout.X_AXIS));

    //======== jPanel1 ========
    {
        jPanel1.setLayout(new FormLayout(
                "14dlu, $lcgap, default, $lcgap, default:grow, $lcgap, default, $lcgap, 14dlu",
                "fill:14dlu, 2*($lgap, fill:default), $lgap, default, 2*($lgap, fill:default), $lgap, 14dlu"));

        //---- txtZusatz ----
        txtZusatz.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel1.add(txtZusatz, CC.xywh(3, 3, 5, 1));

        //---- cmbForm ----
        cmbForm.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbForm.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel1.add(cmbForm, CC.xywh(3, 5, 3, 1));

        //======== panel2 ========
        {
            panel2.setLayout(new BoxLayout(panel2, BoxLayout.X_AXIS));

            //---- btnAdd ----
            btnAdd.setText(null);
            btnAdd.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAdd.setBorder(null);
            btnAdd.setBorderPainted(false);
            btnAdd.setContentAreaFilled(false);
            btnAdd.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png")));
            btnAdd.addActionListener(e -> btnAddActionPerformed(e));
            panel2.add(btnAdd);
            panel2.add(hSpacer1);

            //---- btnEdit ----
            btnEdit.setText(null);
            btnEdit.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/edit3.png")));
            btnEdit.setBorder(null);
            btnEdit.setBorderPainted(false);
            btnEdit.setContentAreaFilled(false);
            btnEdit.setPressedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png")));
            btnEdit.addActionListener(e -> btnEditActionPerformed(e));
            panel2.add(btnEdit);
        }
        jPanel1.add(panel2, CC.xy(7, 5));

        //======== panel4 ========
        {
            panel4.setLayout(new BoxLayout(panel4, BoxLayout.X_AXIS));

            //---- cbExpiresAfterOpened ----
            cbExpiresAfterOpened.setText("expiresAfterOpened");
            cbExpiresAfterOpened.addItemListener(e -> cbExpiresAfterOpenedItemStateChanged(e));
            panel4.add(cbExpiresAfterOpened);
            panel4.add(hSpacer2);

            //---- txtExpiresIn ----
            txtExpiresIn.setColumns(10);
            txtExpiresIn.setEnabled(false);
            txtExpiresIn.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    txtExpiresInFocusLost(e);
                }
            });
            panel4.add(txtExpiresIn);
            panel4.add(hSpacer3);

            //---- cmbDaysWeeks ----
            cmbDaysWeeks.setEnabled(false);
            cmbDaysWeeks.addItemListener(e -> cmbDaysWeeksItemStateChanged(e));
            panel4.add(cmbDaysWeeks);
        }
        jPanel1.add(panel4, CC.xywh(3, 7, 5, 1));

        //---- cbWeightControlled ----
        cbWeightControlled.setText("text");
        cbWeightControlled.addItemListener(e -> cbWeightControlledItemStateChanged(e));
        jPanel1.add(cbWeightControlled, CC.xywh(3, 9, 5, 1));

        //======== panel1 ========
        {
            panel1.setLayout(new BoxLayout(panel1, BoxLayout.X_AXIS));

            //---- btnCancel ----
            btnCancel.setIcon(new ImageIcon(getClass().getResource("/artwork/16x16/cancel.png")));
            btnCancel.setText(null);
            btnCancel.addActionListener(e -> btnCancelActionPerformed(e));
            panel1.add(btnCancel);

            //---- btnOK ----
            btnOK.setIcon(new ImageIcon(getClass().getResource("/artwork/16x16/apply.png")));
            btnOK.setText(null);
            btnOK.addActionListener(e -> btnOKActionPerformed(e));
            panel1.add(btnOK);
        }
        jPanel1.add(panel1, CC.xywh(5, 11, 3, 1, CC.RIGHT, CC.DEFAULT));
    }
    contentPane.add(jPanel1);
    setSize(425, 220);
    setLocationRelativeTo(getOwner());
}

From source file:greenfoot.gui.export.ExportPublishPane.java

/**
 * Creates a login panel with a username and password and a create account option
 * @return Login panel Component/* w w  w .j a v a2s  . com*/
 */
private JComponent getLoginPanel() {
    JComponent loginPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 8, 4));

    loginPanel.setBackground(background);
    loginPanel.setAlignmentX(LEFT_ALIGNMENT);
    Border border = BorderFactory.createCompoundBorder(BorderFactory.createLoweredBevelBorder(),
            BorderFactory.createEmptyBorder(12, 12, 12, 12));
    loginPanel.setBorder(border);

    JLabel text = new JLabel(Config.getString("export.publish.login"));
    text.setForeground(headingColor);
    text.setVerticalAlignment(SwingConstants.TOP);
    loginPanel.add(text);

    text = new JLabel(Config.getString("export.publish.username"), SwingConstants.TRAILING);
    text.setFont(font);
    loginPanel.add(text);
    userNameField = new JTextField(10);
    userNameField.setInputVerifier(new InputVerifier() {
        @Override
        public boolean verify(JComponent input) {
            String text = userNameField.getText();
            return text.length() > 0;
        }
    });
    userNameField.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            checkForExistingScenario();
        }
    });
    loginPanel.add(userNameField);
    text = new JLabel(Config.getString("export.publish.password"), SwingConstants.TRAILING);
    text.setFont(font);
    loginPanel.add(text);
    passwordField = new JPasswordField(10);
    loginPanel.add(passwordField);

    JLabel createAccountLabel = new JLabel(Config.getString("export.publish.createAccount"));
    {
        createAccountLabel.setBackground(background);

        createAccountLabel.setHorizontalAlignment(SwingConstants.RIGHT);
        GreenfootUtil.makeLink(createAccountLabel, createAccountUrl);
    }
    loginPanel.add(createAccountLabel);
    return loginPanel;
}

From source file:it.isislab.dmason.tools.batch.BatchWizard.java

/**
 * Create the frame.//from  w  w  w  . j  a  va2 s.c  o m
 */
public BatchWizard() {
    setPreferredSize(new Dimension(800, 600));
    setTitle("Batch wizard");
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    setBounds(100, 100, 849, 620);
    contentPane = new JPanel();
    contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
    setContentPane(contentPane);
    contentPane.setLayout(new GridLayout(1, 0, 0, 0));

    JPanel panel = new JPanel();
    panel.setToolTipText("");
    contentPane.add(panel);

    panel_1 = new JPanel();
    panel_1.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "Param Option",
            TitledBorder.LEADING, TitledBorder.TOP, null, new Color(0, 0, 0)));

    JPanel panel_2 = new JPanel();
    panel_2.setBorder(
            new TitledBorder(null, "Params List", TitledBorder.LEADING, TitledBorder.TOP, null, null));

    JPanel panel_3 = new JPanel();

    JPanel panel_4 = new JPanel();
    GroupLayout gl_panel = new GroupLayout(panel);
    gl_panel.setHorizontalGroup(gl_panel.createParallelGroup(Alignment.LEADING).addGroup(gl_panel
            .createSequentialGroup().addContainerGap()
            .addComponent(
                    panel_1, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel.createParallelGroup(Alignment.TRAILING)
                    .addGroup(gl_panel.createSequentialGroup()
                            .addComponent(panel_4, GroupLayout.DEFAULT_SIZE, 529, Short.MAX_VALUE).addGap(20))
                    .addGroup(gl_panel.createSequentialGroup()
                            .addComponent(panel_2, GroupLayout.DEFAULT_SIZE, 545, Short.MAX_VALUE).addGap(4))))
            .addComponent(panel_3, GroupLayout.DEFAULT_SIZE, 823, Short.MAX_VALUE));
    gl_panel.setVerticalGroup(gl_panel.createParallelGroup(Alignment.TRAILING).addGroup(gl_panel
            .createSequentialGroup()
            .addComponent(panel_3, GroupLayout.PREFERRED_SIZE, 47, GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel.createParallelGroup(Alignment.TRAILING)
                    .addGroup(gl_panel.createSequentialGroup()
                            .addComponent(panel_2, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE,
                                    Short.MAX_VALUE)
                            .addGap(25)
                            .addComponent(panel_4, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE))
                    .addComponent(panel_1, GroupLayout.DEFAULT_SIZE, GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
            .addContainerGap()));

    final JButton btnSave = new JButton("Save");
    btnSave.setEnabled(false);
    btnSave.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {

            File saveFile = SaveFileChooser();
            createXML(saveFile.getAbsoluteFile().getPath());
        }
    });

    lblTotTests = new JLabel(totTestsMessage);
    GroupLayout gl_panel_4 = new GroupLayout(panel_4);
    gl_panel_4.setHorizontalGroup(gl_panel_4.createParallelGroup(Alignment.TRAILING)
            .addGroup(gl_panel_4.createSequentialGroup().addGap(21).addComponent(lblTotTests)
                    .addPreferredGap(ComponentPlacement.RELATED, 515, Short.MAX_VALUE).addComponent(btnSave)
                    .addGap(21)));
    gl_panel_4.setVerticalGroup(gl_panel_4.createParallelGroup(Alignment.LEADING)
            .addGroup(gl_panel_4.createSequentialGroup().addContainerGap()
                    .addGroup(gl_panel_4.createParallelGroup(Alignment.BASELINE).addComponent(btnSave)
                            .addComponent(lblTotTests))
                    .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel_4.setLayout(gl_panel_4);

    top = new DefaultMutableTreeNode("Parameters");

    JScrollPane scrollPaneTree = new JScrollPane();

    JLabel lblNumberOfWorkers = new JLabel("Number of Workers:");

    textFieldNumberOfWorkers = new JTextField();
    textFieldNumberOfWorkers.setText("1");
    textFieldNumberOfWorkers.setColumns(10);
    textFieldNumberOfWorkers.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            if (textFieldNumberOfWorkers.isVisible()) {
                boolean checkNumberOfWorkers = true;

                while (checkNumberOfWorkers) {

                    String dist = textFieldNumberOfWorkers.getText();
                    boolean validateDist = dist.matches("(\\d)+");
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldNumberOfWorkers.setText(newDist);
                    }

                    else {
                        checkNumberOfWorkers = false;
                    }
                }
            }
        }
    });

    checkBoxLoadBalancing = new JCheckBox("Load Balancing", false);
    checkBoxLoadBalancing.setEnabled(true);

    GroupLayout gl_panel_2 = new GroupLayout(panel_2);
    gl_panel_2.setHorizontalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_2
            .createSequentialGroup().addContainerGap()
            .addGroup(gl_panel_2.createParallelGroup(Alignment.LEADING)
                    .addComponent(scrollPaneTree, GroupLayout.DEFAULT_SIZE, 520, Short.MAX_VALUE)
                    .addGroup(gl_panel_2.createSequentialGroup().addComponent(lblNumberOfWorkers)
                            .addPreferredGap(ComponentPlacement.UNRELATED)
                            .addComponent(textFieldNumberOfWorkers, GroupLayout.PREFERRED_SIZE, 46,
                                    GroupLayout.PREFERRED_SIZE))
                    .addComponent(checkBoxLoadBalancing, GroupLayout.PREFERRED_SIZE, 114,
                            GroupLayout.PREFERRED_SIZE))
            .addContainerGap()));
    gl_panel_2.setVerticalGroup(gl_panel_2.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_2
            .createSequentialGroup().addContainerGap()
            .addComponent(scrollPaneTree, GroupLayout.PREFERRED_SIZE, 271, GroupLayout.PREFERRED_SIZE)
            .addGap(33)
            .addGroup(gl_panel_2.createParallelGroup(Alignment.BASELINE).addComponent(lblNumberOfWorkers)
                    .addComponent(textFieldNumberOfWorkers, GroupLayout.PREFERRED_SIZE,
                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addComponent(checkBoxLoadBalancing, GroupLayout.PREFERRED_SIZE, 20, GroupLayout.PREFERRED_SIZE)
            .addContainerGap(56, Short.MAX_VALUE)));

    final JTree treeParams = new JTree(top);
    scrollPaneTree.setViewportView(treeParams);
    treeParams.addTreeSelectionListener(new TreeSelectionListener() {

        @Override
        public void valueChanged(TreeSelectionEvent selected) {
            // DefaultMutableTreeNode parent =
            // selected.getPath().getParentPath()

            DefaultMutableTreeNode node = (DefaultMutableTreeNode) treeParams.getLastSelectedPathComponent();
            if (node.getParent() != null) {
                if (node.getParent() == simParams || node.getParent().equals(generalParams)) {

                    selectedParam = (Param) node.getUserObject();
                    if (node.getParent() == simParams) {
                        selectedParamIndex = simParams.getIndex(node);
                        paramType = "simParam";
                    }

                    else {
                        selectedParamIndex = generalParams.getIndex(node);
                        paramType = "generalParam";
                    }
                    if (selectedParam instanceof ParamFixed) {
                        ParamFixed pf = (ParamFixed) selectedParam;
                        lblParamType.setText(pf.getName() + ": " + pf.getType());
                        if (suggestion.get(pf.getName()) != null) {
                            lblDomain.setText("Domain: " + suggestion.get(pf.getName()).getDomain());
                            lblSuggested.setText(
                                    "Suggested Value: " + suggestion.get(pf.getName()).getSuggestedValue());
                        }

                        textFieldRuns.setText("" + pf.getRuns());
                        textFieldValue.setText(pf.getValue());
                        rdbtnFixed.doClick();

                        lblMessage.setVisible(false);
                        setModifyControlEnable(true);

                    }

                    if (selectedParam instanceof ParamRange) {
                        ParamRange pf = (ParamRange) selectedParam;
                        lblParamType.setText(pf.getName() + ": " + pf.getType());
                        if (suggestion.get(pf.getName()) != null) {
                            lblDomain.setText("Domain: " + suggestion.get(pf.getName()).getDomain());
                            lblSuggested.setText(
                                    "Suggested Value: " + suggestion.get(pf.getName()).getSuggestedValue());
                        }
                        textFieldRuns.setText("" + pf.getRuns());
                        textFieldStartValue.setText(pf.getStart());
                        textFieldEndValue.setText(pf.getEnd());
                        textFieldIncrement.setText(pf.getIncrement());
                        rdbtnRange.doClick();

                        lblMessage.setVisible(false);
                        setModifyControlEnable(true);
                    }

                    if (selectedParam instanceof ParamList) {
                        ParamList pl = (ParamList) selectedParam;
                        if (suggestion.get(pl.getName()) != null) {
                            lblDomain.setText("Domain: " + suggestion.get(pl.getName()).getDomain());
                            lblSuggested.setText(
                                    "Suggested Value: " + suggestion.get(pl.getName()).getSuggestedValue());
                        }
                        lblParamType.setText(pl.getName() + ": " + pl.getType());
                        textFieldRuns.setText("" + pl.getRuns());
                        StringBuilder b = new StringBuilder();
                        boolean isFirst = true;
                        for (String element : pl.getValues()) {
                            if (isFirst) {
                                b.append(element);
                                isFirst = false;
                            } else
                                b.append("," + element);
                        }
                        textFieldList.setText(b.toString());
                        rdbtnByvalues.doClick();

                        setListControlvisibility(true);
                        lblMessage.setVisible(false);
                        setModifyControlEnable(true);
                    }
                    if (selectedParam instanceof ParamDistribution) {
                        DistributionType distType = DistributionType.none;
                        if (selectedParam instanceof ParamDistributionUniform) {
                            ParamDistributionUniform pu = (ParamDistributionUniform) selectedParam;
                            lblParamType.setText(pu.getName() + ": " + pu.getType());
                            if (suggestion.get(pu.getName()) != null) {
                                lblDomain.setText("Domain: " + suggestion.get(pu.getName()).getDomain());
                                lblSuggested.setText(
                                        "Suggested Value: " + suggestion.get(pu.getName()).getSuggestedValue());
                            }

                            textFieldRuns.setText("" + pu.getRuns());
                            textFieldA.setText(pu.getA());
                            textFieldB.setText(pu.getB());
                            textFieldNumberOfValues.setText("" + pu.getNumberOfValues());
                            distType = DistributionType.uniform;
                        }
                        if (selectedParam instanceof ParamDistributionExponential) {
                            ParamDistributionExponential pe = (ParamDistributionExponential) selectedParam;
                            lblParamType.setText(pe.getName() + ": " + pe.getType());
                            if (suggestion.get(pe.getName()) != null) {

                                lblDomain.setText("Domain: " + suggestion.get(pe.getName()).getDomain());
                                lblSuggested.setText(
                                        "Suggested Value: " + suggestion.get(pe.getName()).getSuggestedValue());
                            }

                            textFieldRuns.setText("" + pe.getRuns());
                            textFieldA.setText(pe.getLambda());
                            textFieldNumberOfValues.setText("" + pe.getNumberOfValues());
                            distType = DistributionType.exponential;
                        }
                        if (selectedParam instanceof ParamDistributionNormal) {
                            ParamDistributionNormal pn = (ParamDistributionNormal) selectedParam;
                            lblParamType.setText(pn.getName() + ": " + pn.getType());
                            if (suggestion.get(pn.getName()) != null) {
                                lblDomain.setText("Domain: " + suggestion.get(pn.getName()).getDomain());
                                lblSuggested.setText(
                                        "Suggested Value: " + suggestion.get(pn.getName()).getSuggestedValue());
                            }

                            textFieldRuns.setText("" + pn.getRuns());
                            textFieldA.setText(pn.getMean());
                            textFieldB.setText(pn.getStdDev());
                            textFieldNumberOfValues.setText("" + pn.getNumberOfValues());
                            distType = DistributionType.normal;

                        }

                        rdbtnByDistribution.doClick();
                        setDistributionControlVisibility(distType);
                        setDistributionComboBoxVisibility(true);
                        lblMessage.setVisible(false);
                        setModifyControlEnable(true);
                    }
                }
            }
        }
    });

    panel_2.setLayout(gl_panel_2);

    JLabel lblSelectSimulationJar = new JLabel("Select simulation jar:");

    textFieldSimJarPath = new JTextField();
    textFieldSimJarPath.setColumns(10);

    btnLoadParams = new JButton("Load Params");
    btnLoadParams.setEnabled(false);
    btnLoadParams.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            ArrayList<Param> params = loadParams();
            if (params != null) {
                top.removeAllChildren();
                createNodes(top, params);
                treeParams.expandPath(new TreePath(top.getPath()));
                treeParams.expandPath(new TreePath(simParams.getPath()));
                treeParams.expandPath(new TreePath(generalParams.getPath()));
            }

            lblTotTests.setText(totTestsMessage + " " + getTotTests());
            btnSave.setEnabled(true);
        }
    });

    JButton bntChooseSimulation = new JButton();
    bntChooseSimulation.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

            simulationFile = showFileChooser();
            if (simulationFile != null) {
                textFieldSimJarPath.setText(simulationFile.getAbsolutePath());
                btnLoadParams.setEnabled(true);

                isThin = isThinSimulation(simulationFile);
                checkBoxLoadBalancing.setEnabled(!isThin);

            }
        }

    });
    bntChooseSimulation.setIcon(
            new ImageIcon(BatchWizard.class.getResource("/it.isislab.dmason/resource/image/openFolder.png")));
    GroupLayout gl_panel_3 = new GroupLayout(panel_3);
    gl_panel_3.setHorizontalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_3
            .createSequentialGroup().addContainerGap().addComponent(lblSelectSimulationJar)
            .addPreferredGap(ComponentPlacement.RELATED)
            .addComponent(textFieldSimJarPath, GroupLayout.PREFERRED_SIZE, 250, GroupLayout.PREFERRED_SIZE)
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addComponent(bntChooseSimulation, GroupLayout.PREFERRED_SIZE, 30, GroupLayout.PREFERRED_SIZE)
            .addGap(26).addComponent(btnLoadParams).addContainerGap(172, Short.MAX_VALUE)));
    gl_panel_3.setVerticalGroup(gl_panel_3.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_3
            .createSequentialGroup().addContainerGap()
            .addGroup(gl_panel_3.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_3
                    .createParallelGroup(Alignment.BASELINE).addComponent(lblSelectSimulationJar)
                    .addComponent(textFieldSimJarPath, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(bntChooseSimulation, GroupLayout.PREFERRED_SIZE, 25,
                            GroupLayout.PREFERRED_SIZE))
                    .addComponent(btnLoadParams))
            .addContainerGap(GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)));
    panel_3.setLayout(gl_panel_3);

    lblParamType = new JLabel("Param : type");
    lblParamType.setFont(new Font("Tahoma", Font.BOLD, 11));

    JLabel lblRuns = new JLabel("Runs:");
    textFieldRuns = new JTextField();
    textFieldRuns.setColumns(10);
    textFieldRuns.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            if (textFieldRuns.isVisible()) {
                boolean checkRuns = true;

                while (checkRuns) {

                    String dist = textFieldRuns.getText();
                    boolean validateDist = dist.matches("(\\d)+");
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldRuns.setText(newDist);
                    }

                    else {
                        checkRuns = false;
                    }
                }
            }
        }
    });
    JLabel lblParameterSpace = new JLabel("Parameter Space");
    lblParameterSpace.setFont(new Font("Tahoma", Font.BOLD, 11));

    lblValue = new JLabel("Value:");

    textFieldValue = new JTextField();
    textFieldValue.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";
            if (textFieldValue.isVisible()) {
                boolean checkValue = true;

                while (checkValue) {

                    String dist = textFieldValue.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldValue.setText(newDist);
                    }

                    else {
                        checkValue = false;
                    }
                }
            }
        }
    });
    textFieldValue.setColumns(10);
    /*textFieldValue.addKeyListener(new KeyListener() {
            
       @Override
       public void keyTyped(KeyEvent arg0) {}
            
       @Override
       public void keyReleased(KeyEvent arg0) {
    checkError();
            
            
       }
            
       @Override
       public void keyPressed(KeyEvent arg0) {}
    });
    */
    lblStartValue = new JLabel("Start value:");

    textFieldStartValue = new JTextField();
    textFieldStartValue.setText("1");
    textFieldStartValue.setColumns(10);
    textFieldStartValue.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";
            if (textFieldStartValue.isVisible()) {
                boolean checkStartValue = true;

                while (checkStartValue) {

                    String dist = textFieldStartValue.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldStartValue.setText(newDist);
                    }

                    else {
                        checkStartValue = false;
                    }
                }
            }
        }
    });

    lblEndValue = new JLabel("End value:");

    textFieldEndValue = new JTextField();
    textFieldEndValue.setText("1");
    textFieldEndValue.setColumns(10);
    textFieldEndValue.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";
            if (textFieldEndValue.isVisible()) {
                boolean checkEndValue = true;

                while (checkEndValue) {

                    String dist = textFieldEndValue.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldEndValue.setText(newDist);
                    }

                    else {
                        checkEndValue = false;
                    }
                }
            }
        }
    });

    lblIncrement = new JLabel("Increment:");

    textFieldIncrement = new JTextField();
    textFieldIncrement.setText("1");
    textFieldIncrement.setColumns(10);
    textFieldIncrement.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";
            if (textFieldIncrement.isVisible()) {

                boolean checkIncrement = true;

                while (checkIncrement) {

                    String dist = textFieldIncrement.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldIncrement.setText(newDist);
                    }

                    else {
                        checkIncrement = false;
                    }
                }
            }
        }
    });

    rdbtnFixed = new JRadioButton("Fixed");
    rdbtnFixed.setSelected(true);
    rdbtnFixed.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {

            setListControlvisibility(false);
            setDistributionComboBoxVisibility(false);
            setRangeControlVisibility(false);
            setFixedControlVisibility(true);
            setDistributionControlVisibility(DistributionType.none);
        }

    });

    rdbtnRange = new JRadioButton("Range");
    rdbtnRange.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setRangeControlVisibility(true);
            setFixedControlVisibility(false);
            setListControlvisibility(false);
            setDistributionComboBoxVisibility(false);
            setDistributionControlVisibility(DistributionType.none);
        }
    });

    rdbtnByvalues = new JRadioButton("By Values");
    rdbtnByvalues.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setRangeControlVisibility(false);
            setFixedControlVisibility(false);
            setListControlvisibility(true);
            setDistributionComboBoxVisibility(false);
            setDistributionControlVisibility(DistributionType.none);
        }
    });
    rdbtnByDistribution = new JRadioButton("By Distribution");
    rdbtnByDistribution.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            setRangeControlVisibility(false);
            setFixedControlVisibility(false);
            setListControlvisibility(false);
            setDistributionComboBoxVisibility(true);
            setDistributionControlVisibility(DistributionType.none);
        }
    });
    // Group the radio buttons.
    ButtonGroup group = new ButtonGroup();
    group.add(rdbtnFixed);
    group.add(rdbtnRange);
    group.add(rdbtnByvalues);
    group.add(rdbtnByDistribution);

    setRangeControlVisibility(false);
    setFixedControlVisibility(false);

    lblMessage = new JLabel(message);

    btnModify = new JButton("Modify");
    btnModify.addActionListener(new ActionListener() {

        @Override
        public void actionPerformed(ActionEvent arg0) {

            if (rdbtnFixed.isSelected()) {
                ParamFixed param = new ParamFixed(selectedParam.getName(), selectedParam.getType(),
                        Integer.parseInt(textFieldRuns.getText()), textFieldValue.getText());
                DefaultMutableTreeNode p = new DefaultMutableTreeNode(param);

                if (paramType.equals("simParam")) {
                    simParams.remove(selectedParamIndex);

                    simParams.insert(p, selectedParamIndex);
                } else {
                    generalParams.remove(selectedParamIndex);

                    generalParams.insert(p, selectedParamIndex);
                }

                treeParams.updateUI();

                /*
                 * ((ParamFixed)
                 * selectedParam).setValue(textFieldValue.getText());
                 * selectedParam
                 * .setRuns(Integer.parseInt(textFieldRuns.getText()));
                 * treeParams.repaint();
                 */
            }
            if (rdbtnRange.isSelected()) {
                ParamRange param = new ParamRange(selectedParam.getName(), selectedParam.getType(),
                        Integer.parseInt(textFieldRuns.getText()), textFieldStartValue.getText(),
                        textFieldEndValue.getText(), textFieldIncrement.getText());
                DefaultMutableTreeNode p = new DefaultMutableTreeNode(param);

                if (paramType.equals("simParam")) {
                    simParams.remove(selectedParamIndex);

                    simParams.insert(p, selectedParamIndex);
                } else {
                    generalParams.remove(selectedParamIndex);

                    generalParams.insert(p, selectedParamIndex);
                }
                treeParams.updateUI();
                // treeParams.repaint();

            }
            if (rdbtnByvalues.isSelected()) {
                StringTokenizer st = new StringTokenizer(textFieldList.getText(), ",");
                ArrayList<String> values = new ArrayList<String>();
                while (st.hasMoreTokens())
                    values.add(st.nextToken());

                ParamList param = new ParamList(selectedParam.getName(), selectedParam.getType(),
                        Integer.parseInt(textFieldRuns.getText()), values);
                DefaultMutableTreeNode p = new DefaultMutableTreeNode(param);

                if (paramType.equals("simParam")) {
                    simParams.remove(selectedParamIndex);

                    simParams.insert(p, selectedParamIndex);
                } else {
                    generalParams.remove(selectedParamIndex);

                    generalParams.insert(p, selectedParamIndex);
                }
                treeParams.updateUI();
                // treeParams.repaint();

            }
            if (rdbtnByDistribution.isSelected()) {
                DefaultMutableTreeNode p;
                switch (selectedDistribution) {
                case uniform:

                    p = new DefaultMutableTreeNode(
                            new ParamDistributionUniform(selectedParam.getName(), selectedParam.getType(),
                                    Integer.parseInt(textFieldRuns.getText()), textFieldA.getText(),
                                    textFieldB.getText(), Integer.parseInt(textFieldNumberOfValues.getText())));
                    break;
                case exponential:

                    p = new DefaultMutableTreeNode(new ParamDistributionExponential(selectedParam.getName(),
                            selectedParam.getType(), Integer.parseInt(textFieldRuns.getText()),
                            textFieldA.getText(), Integer.parseInt(textFieldNumberOfValues.getText())));
                    break;

                case normal:

                    p = new DefaultMutableTreeNode(
                            new ParamDistributionNormal(selectedParam.getName(), selectedParam.getType(),
                                    Integer.parseInt(textFieldRuns.getText()), textFieldA.getText(),
                                    textFieldA.getText(), Integer.parseInt(textFieldNumberOfValues.getText())));
                    break;
                default:
                    p = new DefaultMutableTreeNode();
                    break;
                }

                if (paramType.equals("simParam")) {
                    simParams.remove(selectedParamIndex);

                    simParams.insert(p, selectedParamIndex);
                } else {
                    generalParams.remove(selectedParamIndex);

                    generalParams.insert(p, selectedParamIndex);
                }
                treeParams.updateUI();
                // treeParams.repaint();

            }
            lblMessage.setVisible(true);
            setModifyControlEnable(false);
            setDistributionControlVisibility(DistributionType.none);
            setDistributionComboBoxVisibility(false);
            setListControlvisibility(false);

            int tot = getTotTests();
            if (tot >= testAlertThreshold)
                lblTotTests.setForeground(Color.RED);
            else
                lblTotTests.setForeground(Color.BLACK);

            lblTotTests.setText(totTestsMessage + " " + tot);

        }
    });

    btnCancel = new JButton("Cancel");
    btnCancel.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent arg0) {
            lblMessage.setVisible(true);
            setModifyControlEnable(false);

        }
    });

    lblCommaSeparatedList = new JLabel("List:");
    lblCommaSeparatedList.setVisible(false);

    textFieldList = new JTextField();
    textFieldList.setVisible(false);
    textFieldList.setToolTipText("Comma separated");
    textFieldList.setColumns(10);
    textFieldList.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            /*if(textFieldList.isVisible())
            {
            boolean checkList=true;
                    
            while(checkList){
                    
               String dist=textFieldList.getText();
               boolean validateDist=dist.matches("(\\d)+|((\\d)+\\.(\\d)+)(,(\\d)+|((\\d)+\\.(\\d)+))*");
               if(!validateDist){   
                  String   newDist=  JOptionPane.showInputDialog(null,"Insert comma separate number list","Number Format Error", 0);
                  textFieldList.setText(newDist);
               }
                    
               else{
                  checkList=false;
               }
            }
            }*/
        }
    });

    lblDistribution = new JLabel("Distribution");
    lblDistribution.setVisible(false);

    lblA = new JLabel("a:");
    lblA.setVisible(false);

    textFieldA = new JTextField();
    textFieldA.setText("1");
    textFieldA.setVisible(false);
    textFieldA.setColumns(10);
    textFieldA.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";

            if (textFieldA.isVisible()) {
                boolean checkA = true;

                while (checkA) {

                    String dist = textFieldA.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldA.setText(newDist);
                    }

                    else {
                        checkA = false;
                    }
                }
            }
        }
    });

    lblB = new JLabel("b:");
    lblB.setVisible(false);

    textFieldB = new JTextField();
    textFieldB.setText("1");
    textFieldB.setVisible(false);
    textFieldB.setColumns(10);
    textFieldB.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {

            String regex = "(\\d)+|((\\d)+\\.(\\d)+)";
            if (textFieldB.isVisible()) {
                boolean checkB = true;

                while (checkB) {

                    String dist = textFieldB.getText();
                    boolean validateDist = dist.matches(regex);
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldB.setText(newDist);
                    }

                    else {
                        checkB = false;
                    }
                }
            }
        }
    });
    jComboBoxDistribution = new JComboBox();
    jComboBoxDistribution.setVisible(false);
    jComboBoxDistribution.addItemListener(new ItemListener() {

        @Override
        public void itemStateChanged(ItemEvent e) {
            // Prevent executing listener's actions two times
            if (e.getStateChange() != ItemEvent.SELECTED)
                return;
            selectedDistribution = ((DistributionType) jComboBoxDistribution.getSelectedItem());

            setDistributionControlVisibility(DistributionType.none);
            setDistributionControlVisibility(selectedDistribution);

        }
    });

    lblOfValues = new JLabel("# of values:");
    lblOfValues.setVisible(false);

    textFieldNumberOfValues = new JTextField();
    textFieldNumberOfValues.setText("1");
    textFieldNumberOfValues.setVisible(false);
    textFieldNumberOfValues.setColumns(10);
    textFieldNumberOfValues.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent arg0) {
            if (textFieldNumberOfValues.isVisible()) {
                boolean checkNumberOfValues = true;

                while (checkNumberOfValues) {

                    String dist = textFieldNumberOfValues.getText();
                    boolean validateDist = dist.matches("(\\d)+");
                    if (!validateDist) {
                        String newDist = JOptionPane.showInputDialog(null, "Insert a number",
                                "Number Format Error", 0);
                        textFieldNumberOfValues.setText(newDist);
                    }

                    else {
                        checkNumberOfValues = false;
                    }
                }
            }
        }
    });

    lblSuggested = new JLabel("Suggested Value:");

    lblDomain = new JLabel("Domain:");

    GroupLayout gl_panel_1 = new GroupLayout(panel_1);
    gl_panel_1.setHorizontalGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING).addGroup(gl_panel_1
            .createSequentialGroup().addContainerGap()
            .addGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING).addGroup(gl_panel_1
                    .createSequentialGroup()
                    .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addComponent(lblParamType)
                            .addComponent(lblMessage).addComponent(lblSuggested))
                    .addContainerGap(77, Short.MAX_VALUE))
                    .addGroup(gl_panel_1.createSequentialGroup().addComponent(btnModify)
                            .addPreferredGap(ComponentPlacement.RELATED).addComponent(btnCancel)
                            .addContainerGap())
                    .addGroup(gl_panel_1.createSequentialGroup().addGroup(gl_panel_1
                            .createParallelGroup(Alignment.LEADING).addComponent(lblParameterSpace)
                            .addGroup(gl_panel_1.createSequentialGroup()
                                    .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
                                            .addComponent(rdbtnFixed).addComponent(rdbtnRange))
                                    .addGap(31)
                                    .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
                                            .addComponent(rdbtnByDistribution).addComponent(rdbtnByvalues)))
                            .addGroup(gl_panel_1.createSequentialGroup().addGroup(gl_panel_1
                                    .createParallelGroup(Alignment.TRAILING)
                                    .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblValue)
                                            .addPreferredGap(ComponentPlacement.RELATED, 59, Short.MAX_VALUE)
                                            .addComponent(textFieldValue, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                    .addGroup(Alignment.LEADING,
                                            gl_panel_1.createSequentialGroup().addComponent(lblStartValue)
                                                    .addPreferredGap(ComponentPlacement.RELATED, 46,
                                                            Short.MAX_VALUE)
                                                    .addComponent(textFieldStartValue,
                                                            GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            GroupLayout.PREFERRED_SIZE))
                                    .addGroup(gl_panel_1.createSequentialGroup()
                                            .addComponent(lblCommaSeparatedList)
                                            .addPreferredGap(ComponentPlacement.RELATED, 69, Short.MAX_VALUE)
                                            .addComponent(textFieldList, GroupLayout.PREFERRED_SIZE,
                                                    GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
                                    .addGroup(gl_panel_1.createSequentialGroup()
                                            .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
                                                    .addComponent(lblEndValue).addComponent(lblIncrement)
                                                    .addComponent(lblDistribution))
                                            .addGap(45)
                                            .addGroup(gl_panel_1.createParallelGroup(Alignment.TRAILING)
                                                    .addGroup(gl_panel_1.createParallelGroup(Alignment.LEADING)
                                                            .addGroup(gl_panel_1
                                                                    .createParallelGroup(Alignment.LEADING,
                                                                            false)
                                                                    .addComponent(jComboBoxDistribution, 0,
                                                                            GroupLayout.DEFAULT_SIZE,
                                                                            Short.MAX_VALUE)
                                                                    .addComponent(textFieldA,
                                                                            GroupLayout.PREFERRED_SIZE,
                                                                            GroupLayout.DEFAULT_SIZE,
                                                                            GroupLayout.PREFERRED_SIZE)
                                                                    .addComponent(textFieldB,
                                                                            GroupLayout.PREFERRED_SIZE,
                                                                            GroupLayout.DEFAULT_SIZE,
                                                                            GroupLayout.PREFERRED_SIZE)
                                                                    .addComponent(textFieldNumberOfValues,
                                                                            GroupLayout.PREFERRED_SIZE,
                                                                            GroupLayout.DEFAULT_SIZE,
                                                                            GroupLayout.PREFERRED_SIZE))
                                                            .addComponent(textFieldIncrement, 89, 89, 89))
                                                    .addComponent(textFieldEndValue, GroupLayout.PREFERRED_SIZE,
                                                            GroupLayout.DEFAULT_SIZE,
                                                            GroupLayout.PREFERRED_SIZE))))
                                    .addPreferredGap(ComponentPlacement.RELATED, 8, GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblA).addPreferredGap(
                                    ComponentPlacement.RELATED, 173, GroupLayout.PREFERRED_SIZE))
                            .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblB).addPreferredGap(
                                    ComponentPlacement.RELATED, 173, GroupLayout.PREFERRED_SIZE))
                            .addComponent(lblOfValues)
                            .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblRuns)
                                    .addPreferredGap(ComponentPlacement.RELATED)
                                    .addComponent(textFieldRuns, GroupLayout.PREFERRED_SIZE,
                                            GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE)
                                    .addPreferredGap(ComponentPlacement.RELATED, 65,
                                            GroupLayout.PREFERRED_SIZE)))
                            .addGap(35))
                    .addGroup(gl_panel_1.createSequentialGroup().addComponent(lblDomain).addContainerGap(186,
                            Short.MAX_VALUE)))));
    gl_panel_1.setVerticalGroup(gl_panel_1.createParallelGroup(Alignment.LEADING).addGroup(gl_panel_1
            .createSequentialGroup().addGap(4).addComponent(lblMessage).addGap(18).addComponent(lblParamType)
            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblSuggested)
            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblDomain).addGap(7)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblRuns).addComponent(
                    textFieldRuns, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                    GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED).addComponent(lblParameterSpace)
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(rdbtnFixed)
                    .addComponent(rdbtnByvalues))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(rdbtnRange)
                    .addComponent(rdbtnByDistribution))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
                    .addComponent(textFieldValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblValue))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
                    .addComponent(textFieldList, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblCommaSeparatedList))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblStartValue)
                    .addComponent(textFieldStartValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblEndValue).addComponent(
                    textFieldEndValue, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                    GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
                    .addComponent(textFieldIncrement, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblIncrement))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE)
                    .addComponent(jComboBoxDistribution, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                            GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblDistribution))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel_1
                    .createParallelGroup(Alignment.BASELINE).addComponent(lblA).addComponent(textFieldA,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED)
            .addGroup(gl_panel_1
                    .createParallelGroup(Alignment.BASELINE).addComponent(lblB).addComponent(textFieldB,
                            GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE, GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.UNRELATED)
            .addGroup(gl_panel_1.createParallelGroup(Alignment.BASELINE).addComponent(lblOfValues).addComponent(
                    textFieldNumberOfValues, GroupLayout.PREFERRED_SIZE, GroupLayout.DEFAULT_SIZE,
                    GroupLayout.PREFERRED_SIZE))
            .addPreferredGap(ComponentPlacement.RELATED, 18, Short.MAX_VALUE).addGroup(gl_panel_1
                    .createParallelGroup(Alignment.BASELINE).addComponent(btnModify).addComponent(btnCancel))));
    panel_1.setLayout(gl_panel_1);
    panel.setLayout(gl_panel);

    setModifyControlEnable(false);
    loadDistribution();
}

From source file:op.care.nursingprocess.DlgNursingProcess.java

/**
 * This method is called from within the constructor to
 * initialize the form./*from   w w w  . j a  v a  2  s . co  m*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jPanel5 = new JPanel();
    lblTopic = new JLabel();
    txtStichwort = new JTextField();
    lblCat = new JLabel();
    cmbKategorie = new JComboBox<>();
    panel4 = new JPanel();
    lblSituation = new JLabel();
    btnPopoutSituation = new JButton();
    jScrollPane3 = new JScrollPane();
    txtSituation = new JTextArea();
    panel5 = new JPanel();
    lblGoal = new JLabel();
    btnPopoutGoal = new JButton();
    jScrollPane1 = new JScrollPane();
    txtZiele = new JTextArea();
    lblFirstRevision = new JLabel();
    jdcKontrolle = new JDateChooser();
    panel2 = new JPanel();
    jspPlanung = new JScrollPane();
    tblPlanung = new JTable();
    panel3 = new JPanel();
    btnAddIntervention = new JButton();
    panel1 = new JPanel();
    btnCancel = new JButton();
    btnSave = new JButton();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("14dlu, $lcgap, 280dlu:grow, $ugap, pref, $lcgap, 14dlu",
            "fill:14dlu, $lgap, fill:default:grow, $rgap, pref, $lgap, 14dlu"));

    //======== jPanel5 ========
    {
        jPanel5.setLayout(new FormLayout("default, $lcgap, default:grow",
                "fill:default, $rgap, default, 2*($lgap, fill:default:grow), $lgap, 70dlu, $lgap, pref"));

        //---- lblTopic ----
        lblTopic.setFont(new Font("Arial", Font.PLAIN, 14));
        lblTopic.setText("Stichwort");
        jPanel5.add(lblTopic, CC.xy(1, 1, CC.DEFAULT, CC.TOP));

        //---- txtStichwort ----
        txtStichwort.setFont(new Font("Arial", Font.BOLD, 20));
        txtStichwort.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                txtStichwortFocusGained(e);
            }
        });
        jPanel5.add(txtStichwort, CC.xy(3, 1));

        //---- lblCat ----
        lblCat.setFont(new Font("Arial", Font.PLAIN, 14));
        lblCat.setText("Kategorie");
        jPanel5.add(lblCat, CC.xy(1, 3));

        //---- cmbKategorie ----
        cmbKategorie
                .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbKategorie.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel5.add(cmbKategorie, CC.xy(3, 3));

        //======== panel4 ========
        {
            panel4.setLayout(new BorderLayout());

            //---- lblSituation ----
            lblSituation.setFont(new Font("Arial", Font.PLAIN, 14));
            lblSituation.setText("Situation");
            panel4.add(lblSituation, BorderLayout.CENTER);

            //---- btnPopoutSituation ----
            btnPopoutSituation.setText(null);
            btnPopoutSituation.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/popup.png")));
            btnPopoutSituation.setBorderPainted(false);
            btnPopoutSituation.setContentAreaFilled(false);
            btnPopoutSituation
                    .setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png")));
            btnPopoutSituation.setBorder(null);
            btnPopoutSituation.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnPopoutSituation.addActionListener(e -> btnPopoutSituationActionPerformed(e));
            panel4.add(btnPopoutSituation, BorderLayout.EAST);
        }
        jPanel5.add(panel4, CC.xy(1, 5, CC.DEFAULT, CC.TOP));

        //======== jScrollPane3 ========
        {

            //---- txtSituation ----
            txtSituation.setColumns(20);
            txtSituation.setLineWrap(true);
            txtSituation.setRows(5);
            txtSituation.setWrapStyleWord(true);
            txtSituation.setFont(new Font("Arial", Font.PLAIN, 14));
            txtSituation.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtSituationFocusGained(e);
                }
            });
            jScrollPane3.setViewportView(txtSituation);
        }
        jPanel5.add(jScrollPane3, CC.xy(3, 5));

        //======== panel5 ========
        {
            panel5.setLayout(new BorderLayout());

            //---- lblGoal ----
            lblGoal.setFont(new Font("Arial", Font.PLAIN, 14));
            lblGoal.setText("Ziele");
            panel5.add(lblGoal, BorderLayout.CENTER);

            //---- btnPopoutGoal ----
            btnPopoutGoal.setText(null);
            btnPopoutGoal.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/popup.png")));
            btnPopoutGoal.setBorderPainted(false);
            btnPopoutGoal.setContentAreaFilled(false);
            btnPopoutGoal
                    .setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/pressed.png")));
            btnPopoutGoal.setBorder(null);
            btnPopoutGoal.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnPopoutGoal.addActionListener(e -> btnPopoutGoalActionPerformed(e));
            panel5.add(btnPopoutGoal, BorderLayout.EAST);
        }
        jPanel5.add(panel5, CC.xy(1, 7, CC.DEFAULT, CC.TOP));

        //======== jScrollPane1 ========
        {

            //---- txtZiele ----
            txtZiele.setColumns(20);
            txtZiele.setLineWrap(true);
            txtZiele.setRows(5);
            txtZiele.setWrapStyleWord(true);
            txtZiele.setFont(new Font("Arial", Font.PLAIN, 14));
            txtZiele.addFocusListener(new FocusAdapter() {
                @Override
                public void focusGained(FocusEvent e) {
                    txtZieleFocusGained(e);
                }
            });
            jScrollPane1.setViewportView(txtZiele);
        }
        jPanel5.add(jScrollPane1, CC.xy(3, 7));

        //---- lblFirstRevision ----
        lblFirstRevision.setFont(new Font("Arial", Font.PLAIN, 14));
        lblFirstRevision.setText("Erste Kontrolle am");
        jPanel5.add(lblFirstRevision, CC.xy(1, 11));

        //---- jdcKontrolle ----
        jdcKontrolle.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel5.add(jdcKontrolle, CC.xy(3, 11));
    }
    contentPane.add(jPanel5, CC.xy(3, 3, CC.DEFAULT, CC.FILL));

    //======== panel2 ========
    {
        panel2.setLayout(new FormLayout("default:grow", "default, $lgap, default"));

        //======== jspPlanung ========
        {
            jspPlanung.addComponentListener(new ComponentAdapter() {
                @Override
                public void componentResized(ComponentEvent e) {
                    jspPlanungComponentResized(e);
                }
            });

            //---- tblPlanung ----
            tblPlanung.setModel(new DefaultTableModel(
                    new Object[][] { { null, null, null, null }, { null, null, null, null },
                            { null, null, null, null }, { null, null, null, null }, },
                    new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
            tblPlanung.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS);
            tblPlanung.addMouseListener(new MouseAdapter() {
                @Override
                public void mousePressed(MouseEvent e) {
                    tblPlanungMousePressed(e);
                }
            });
            jspPlanung.setViewportView(tblPlanung);
        }
        panel2.add(jspPlanung, CC.xy(1, 1));

        //======== panel3 ========
        {
            panel3.setLayout(new BoxLayout(panel3, BoxLayout.X_AXIS));

            //---- btnAddIntervention ----
            btnAddIntervention.setText(null);
            btnAddIntervention.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAddIntervention.setContentAreaFilled(false);
            btnAddIntervention.setBorderPainted(false);
            btnAddIntervention.setBorder(null);
            btnAddIntervention
                    .setPressedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnAddIntervention.addActionListener(e -> btnAddInterventionActionPerformed(e));
            panel3.add(btnAddIntervention);
        }
        panel2.add(panel3, CC.xy(1, 3));
    }
    contentPane.add(panel2, CC.xy(5, 3));

    //======== panel1 ========
    {
        panel1.setLayout(new HorizontalLayout(5));

        //---- btnCancel ----
        btnCancel.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png")));
        btnCancel.setText(null);
        btnCancel.addActionListener(e -> btnCancelActionPerformed(e));
        panel1.add(btnCancel);

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.setText(null);
        btnSave.addActionListener(e -> btnSaveActionPerformed(e));
        panel1.add(btnSave);
    }
    contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT));
    setSize(1145, 695);
    setLocationRelativeTo(getOwner());
}

From source file:dmh.kuebiko.view.NoteStackFrame.java

/**
 * Perform additional setup to the frame. This is separate from the
 * initialize() method so that the GUI builder doesn't mess with it.
 *///from   w  w  w .j av a  2 s  . c  o m
private void additionalSetup() {
    mode = Mode.SEARCH;

    setFocusTraversalPolicy(new CustomFocusTraversalPolicy(searchText, notePanel));

    // Search Text Field.
    AutoCompleteDecorator.decorate(searchText, noteMngr.getNoteTitles(), false);
    searchText.getInputMap().put(KeyStroke.getKeyStroke("ESCAPE"), "clear");
    searchText.getDocument().addDocumentListener(new DocumentListener() {
        @Override
        public void changedUpdate(DocumentEvent e) {
            onSearchTextChanged();
        }

        @Override
        public void insertUpdate(DocumentEvent e) {
            onSearchTextChanged();
        }

        @Override
        public void removeUpdate(DocumentEvent e) {
            onSearchTextChanged();
        }
    });
    searchText.getActionMap().put("clear", new AbstractAction() {
        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent e) {
            searchText.setText(null);
        }
    });

    searchText.addFocusListener(new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            setModeToSearch();
            searchText.selectAll();
        }

        @Override
        public void focusLost(FocusEvent e) {
            noteTable.selectNote(searchText.getText());
        }
    });
    searchText.addActionListener(actionMngr.getAction(NewNoteAction.class));

    // Note Table.
    noteTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
        @Override
        public void valueChanged(ListSelectionEvent event) {
            if (event.getValueIsAdjusting()) {
                return;
            }
            final Note selectedNote = noteTable.getSelectedNote();

            if (selectedNote == null) {
                setModeToSearch();
            } else {
                setModeToEdit();
                notePanel.setNote(selectedNote);
                searchText.setText(selectedNote.getTitle());
            }
        }
    });
}

From source file:com.lynk.hrm.ui.dialog.InfoEmployee.java

private void initComponents() {
    addWindowListener(new WindowAdapter() {
        @Override//from  w  w w .jav  a 2s  .c  o m
        public void windowClosing(WindowEvent e) {
            thisWindowClosing(e);
        }
    });
    setSize(836, 674);
    setTitle("");
    setIconImage(
            Toolkit.getDefaultToolkit().getImage(InfoEmployee.class.getResource("/resource/image/icon.png")));
    setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);
    getContentPane().setLayout(new BorderLayout(0, 0));
    {
        JToolBar toolBar = new JToolBar();
        toolBar.setFloatable(false);
        getContentPane().add(toolBar, BorderLayout.NORTH);
        {
            JButton uiSave = new JButton("?");
            uiSave.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiSaveActionPerformed(true);
                }
            });
            uiSave.setFocusable(false);
            uiSave.setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/emp_save.png")));
            uiSave.setFont(APP_FONT);
            toolBar.add(uiSave);
        }
        toolBar.addSeparator();
        {
            JButton uiReadIdCard = new JButton("??");
            uiReadIdCard.setFont(APP_FONT);
            uiReadIdCard.setIcon(
                    new ImageIcon(InfoEmployee.class.getResource("/resource/image/manager_teacher.png")));
            uiReadIdCard.setFocusable(false);
            uiReadIdCard.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiReadIdCardActionPerformed(e);
                }
            });
            toolBar.add(uiReadIdCard);
        }
        toolBar.addSeparator();
        {
            JButton uiInputFinger = new JButton("");
            uiInputFinger.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiInputFingerActionPerformed(e);
                }
            });
            uiInputFinger.setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/finger.png")));
            uiInputFinger.setFont(APP_FONT);
            uiInputFinger.setFocusable(false);
            toolBar.add(uiInputFinger);
        }
        toolBar.addSeparator();
        {
            JButton uiSetSuspend = new JButton("??");
            uiSetSuspend.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiSetSuspendActionPerformed(e);
                }
            });
            uiSetSuspend
                    .setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/emp_retire.png")));
            uiSetSuspend.setFont(APP_FONT);
            uiSetSuspend.setFocusable(false);
            toolBar.add(uiSetSuspend);
        }
    }

    {
        JPanel panel = new JPanel();
        getContentPane().add(panel);
        panel.setLayout(new MigLayout("", "[]5[grow]25[]5[grow]25[]5[grow]5[102]", "[][][][]"));
        {
            JLabel label = new JLabel("?");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 0 0");
        }
        {
            uiId = new LynkTextField();
            uiId.setEditable(false);
            uiId.setForeground(Color.BLUE);
            panel.add(uiId, "cell 1 0,growx");
        }
        {
            JLabel label = new JLabel("??");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 2 0");
        }
        {
            uiName = new LynkTextField();
            uiName.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    uiNameFocusLost(e);
                }
            });
            panel.add(uiName, "cell 3 0,growx");
        }
        {
            JLabel label = new JLabel("?");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 4 0");
        }
        {
            uiNamePy = new LynkTextField();
            panel.add(uiNamePy, "cell 5 0,growx");
        }
        {
            JLabel label = new JLabel("?");
            label.setHorizontalAlignment(SwingConstants.RIGHT);
            label.setFont(APP_FONT);
            panel.add(label, "cell 0 1");
        }
        {
            uiState = new JComboBox<String>();
            uiState.setForeground(Color.BLUE);
            uiState.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    uiStateActionPerformed(e);
                }
            });
            uiState.setModel(new DefaultComboBoxModel<String>(new String[] { "", Employee.STATE_PROBATION,
                    Employee.STATE_CONTRACT, Employee.STATE_SUSPEND, Employee.STATE_LEAVE,
                    Employee.STATE_RETIRE, Employee.STATE_DELETE }));
            uiState.setFont(APP_FONT);
            panel.add(uiState, "cell 1 1,growx");
        }
        {
            uiInfoTab = new JideTabbedPane(JTabbedPane.TOP);
            uiInfoTab.addChangeListener(new ChangeListener() {
                public void stateChanged(ChangeEvent e) {
                    uiInfoTabStateChanged(e);
                }
            });
            uiInfoTab.setColorTheme(JideTabbedPane.COLOR_THEME_DEFAULT);
            uiInfoTab.setFont(APP_FONT);
            panel.add(uiInfoTab, "cell 0 3 7 1");
            {
                JPanel uiInfoBasic = new JPanel();
                uiInfoBasic.setLayout(new MigLayout("", "[473px,grow][307px,grow]", "[grow][289px][149px]"));
                uiInfoTab.addTab("?", uiInfoBasic);
                {
                    JPanel uiIdCardPane = new JPanel();
                    uiIdCardPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    uiIdCardPane.setLayout(new MigLayout("", "[]5[grow]10[]", "[][][][][40px:40px:40px,grow]"));
                    uiInfoBasic.add(uiIdCardPane, "cell 0 0,grow");
                    {
                        JLabel label = new JLabel("??");
                        uiIdCardPane.add(label, "cell 0 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiIdCard = new LynkTextField();
                        uiIdCardPane.add(uiIdCard, "cell 1 0,growx");
                    }
                    {
                        JPanel pane = new JPanel();
                        uiIdCardPane.add(pane, "cell 2 0 1 5,grow");
                        pane.setLayout(new MigLayout("insets 0", "[102px:102px:102px]", "[126px:126px:126px]"));
                        {
                            uiPhoto = new ImagePane();
                            pane.add(uiPhoto, "cell 0 0,grow");
                        }
                    }
                    //                  {
                    //                     JPanel photoPane = new JPanel();
                    //                     photoPane.setLayout(new MigLayout("insets 0", "[grow]", "[grow][]"));
                    //                     uiIdCardPane.add(photoPane, "cell 2 0 2 4,grow");
                    //                     {
                    //                        uiPhoto = new ImagePane();
                    //                        photoPane.add(uiPhoto, "cell 0 0,grow");
                    //                     }
                    //                     {
                    //                        JButton uiReadIdCardDirect = new JButton("??");
                    //                        uiReadIdCardDirect.addActionListener(new ActionListener() {
                    //                           public void actionPerformed(ActionEvent e) {
                    //                              uiReadIdCardDirectActionPerformed(e);
                    //                           }
                    //                        });
                    //                        uiReadIdCardDirect.setFont(APP_FONT);
                    //                        uiReadIdCardDirect.setFocusable(false);
                    //                        photoPane.add(uiReadIdCardDirect, "cell 0 1,grow");
                    //                     }
                    //                  }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiBirthday = new LynkTextField();
                        uiIdCardPane.add(uiBirthday, "cell 1 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiAge = new LynkTextField();
                        uiIdCardPane.add(uiAge, "cell 1 2,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 3,aligny top");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiGender = new LynkTextField();
                        uiIdCardPane.add(uiGender, "cell 1 3,growx,aligny top");
                    }
                    {
                        JLabel label = new JLabel("??");
                        label.setFont(APP_FONT);
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        uiIdCardPane.add(label, "cell 0 4");
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        uiIdCardPane.add(scrollPane, "cell 1 4,grow");
                        {
                            uiCensusAddress = new JTextArea();
                            uiCensusAddress.setWrapStyleWord(true);
                            uiCensusAddress.setLineWrap(true);
                            scrollPane.setViewportView(uiCensusAddress);
                            uiCensusAddress.setFont(APP_FONT);
                        }
                    }
                }
                {
                    JPanel uiIdCardPane = new JPanel();
                    uiIdCardPane.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    uiIdCardPane
                            .setLayout(new MigLayout("", "[]5[grow]25[]5[grow]", "[][][40px:40px:40px,grow]"));
                    uiInfoBasic.add(uiIdCardPane, "cell 0 1,grow");
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiMarital = new JComboBox<String>();
                        uiIdCardPane.add(uiMarital, "cell 1 0,growx");
                        uiMarital.setModel(new DefaultComboBoxModel<String>(
                                new String[] { Employee.MARITAL_YES, Employee.MARITAL_NO }));
                        uiMarital.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiIdCardPane.add(label, "cell 2 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiContact = new LynkTextField();
                        uiIdCardPane.add(uiContact, "cell 3 0,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiIdCardPane.add(label, "cell 0 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiCensus = new JComboBox<String>();
                        uiIdCardPane.add(uiCensus, "cell 1 1,growx");
                        uiCensus.setModel(new DefaultComboBoxModel<String>(
                                new String[] { Employee.CENSUS_A, Employee.CENSUS_B, Employee.CENSUS_C,
                                        Employee.CENSUS_D, Employee.CENSUS_E, Employee.CENSUS_F }));
                        uiCensus.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("??");
                        uiIdCardPane.add(label, "cell 2 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiResidencePermit = new JComboBox<String>();
                        uiIdCardPane.add(uiResidencePermit, "cell 3 1,growx");
                        uiResidencePermit
                                .setModel(new DefaultComboBoxModel<String>(new String[] { "", "", "" }));
                        uiResidencePermit.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("");
                        uiIdCardPane.add(label, "cell 0 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        uiIdCardPane.add(scrollPane, "cell 1 2 3 1,grow");
                        {
                            uiAddress = new JTextArea();
                            uiAddress.setWrapStyleWord(true);
                            uiAddress.setLineWrap(true);
                            scrollPane.setViewportView(uiAddress);
                            uiAddress.setFont(APP_FONT);
                        }
                    }
                }
                {
                    JPanel uiCompanyPanel = new JPanel();
                    uiCompanyPanel.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    uiCompanyPanel.setLayout(new MigLayout("", "[]5[grow][]25[]5[grow][]", "[][][][][][][][]"));
                    uiInfoBasic.add(uiCompanyPanel, "cell 0 2,growx,aligny top");
                    {
                        JLabel label = new JLabel(Employee.SUSPEND_NOTE);
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 0 0");
                    }
                    {
                        uiFactory = new JComboBox<String>(new DefaultComboBoxModel<String>(
                                new String[] { Employee.FACROTY_TC, Employee.FACTORY_SX }));
                        uiFactory.setFont(APP_FONT);
                        uiCompanyPanel.add(uiFactory, "cell 1 0 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 3 0");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiDept = new LynkTextField();
                        uiDept.setEditable(false);
                        uiCompanyPanel.add(uiDept, "cell 4 0,growx");
                    }
                    {
                        JButton uiChooseDept = new JButton();
                        uiChooseDept.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiChooseDeptActionPerformed(e);
                            }
                        });
                        uiChooseDept.setIcon(new ImageIcon(
                                InfoEmployee.class.getResource("/resource/image/choose_more.png")));
                        uiChooseDept.setMargin(new Insets(1, 1, 1, 1));
                        uiCompanyPanel.add(uiChooseDept, "cell 5 0,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiCompanyPanel.add(label, "cell 0 1");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiJob = new LynkTextField();
                        uiJob.setEditable(false);
                        uiCompanyPanel.add(uiJob, "cell 1 1,growx");
                    }
                    {
                        JButton uiChooseJob = new JButton();
                        uiChooseJob.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiChooseJobActionPerformed(e);
                            }
                        });
                        uiChooseJob.setIcon(new ImageIcon(
                                InfoEmployee.class.getResource("/resource/image/choose_more.png")));
                        uiChooseJob.setMargin(new Insets(1, 1, 1, 1));
                        uiCompanyPanel.add(uiChooseJob, "cell 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel(Employee.SUSPEND_START);
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 3 1");
                    }
                    {
                        uiDdg = new JComboBox<String>(
                                new DefaultComboBoxModel<>(new String[] { Employee.DDG_N, Employee.DDG_Y }));
                        uiDdg.setFont(APP_FONT);
                        uiCompanyPanel.add(uiDdg, "cell 4 1 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 0 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiEntryDate = new JDateChooser();
                        uiCompanyPanel.add(uiEntryDate, "cell 1 2 2 1,growx");
                        uiEntryDate.setDateFormatString("yyyy-MM-dd");
                        uiEntryDate.setFont(APP_FONT);
                        uiEntryDate.getJCalendar().setTodayButtonVisible(true);
                        uiEntryDate.addPropertyChangeListener(new PropertyChangeListener() {

                            @Override
                            public void propertyChange(PropertyChangeEvent evt) {
                                if ("date".equals(evt.getPropertyName())) {
                                    setWorkAge();
                                }
                            }
                        });
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 3 2");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiWorkAge = new LynkTextField("0");
                        uiCompanyPanel.add(uiWorkAge, "cell 4 2 2 1,growx");
                        uiWorkAge.setEditable(false);
                    }
                    {
                        JLabel label = new JLabel("?");
                        uiCompanyPanel.add(label, "cell 0 3");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiProbation = new JDateChooser();
                        uiCompanyPanel.add(uiProbation, "cell 1 3 2 1,growx");
                        uiProbation.setDateFormatString("yyyy-MM-dd");
                        uiProbation.setFont(APP_FONT);
                        uiProbation.getJCalendar().setTodayButtonVisible(true);
                    }
                    {
                        JLabel label = new JLabel("??");
                        uiCompanyPanel.add(label, "cell 3 3");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiExpiration = new JDateChooser();
                        uiCompanyPanel.add(uiExpiration, "cell 4 3 2 1,growx");
                        uiExpiration.setDateFormatString("yyyy-MM-dd");
                        uiExpiration.setFont(APP_FONT);
                        uiExpiration.getJCalendar().setLeftButtonText(Employee.EXPIRATION_NO);
                        uiExpiration.getJCalendar().setLeftButtonVisible(true);
                        uiExpiration.getJCalendar().setRightButtonText(Employee.EXPIRATION_LONG);
                        uiExpiration.getJCalendar().setRightButtonVisible(true);
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 0 4");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiSchool = new LynkTextField();
                        uiCompanyPanel.add(uiSchool, "cell 1 4 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 3 4");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiDegree = new JComboBox<String>();
                        uiCompanyPanel.add(uiDegree, "cell 4 4 2 1,growx");
                        uiDegree.setMaximumRowCount(12);
                        uiDegree.setModel(new DefaultComboBoxModel<String>(new String[] { "", Employee.DEGREE_A,
                                Employee.DEGREE_B, Employee.DEGREE_C, Employee.DEGREE_D, Employee.DEGREE_E,
                                Employee.DEGREE_F, Employee.DEGREE_G, Employee.DEGREE_H, Employee.DEGREE_I,
                                Employee.DEGREE_J }));
                        uiDegree.setFont(APP_FONT);
                    }
                    {
                        JLabel label = new JLabel("");
                        uiCompanyPanel.add(label, "cell 0 5");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                    }
                    {
                        uiMajor = new LynkTextField();
                        uiCompanyPanel.add(uiMajor, "cell 1 5 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 3 5");
                    }
                    {
                        uiGuide = new LynkTextField();
                        uiCompanyPanel.add(uiGuide, "cell 4 5 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT_BLOD);
                        uiCompanyPanel.add(label, "cell 0 6");
                    }
                    {
                        uiPhoneShort = new LynkTextField();
                        uiPhoneShort.setFont(APP_FONT_BLOD);
                        uiCompanyPanel.add(uiPhoneShort, "cell 1 6 2 1,growx");
                    }
                    {
                        JLabel label = new JLabel("?");
                        label.setHorizontalAlignment(SwingConstants.RIGHT);
                        label.setFont(APP_FONT);
                        uiCompanyPanel.add(label, "cell 3 6");
                    }
                    {
                        uiPerformance = new LynkTextField();
                        uiCompanyPanel.add(uiPerformance, "cell 4 6 2 1,growx");
                    }
                    //                  {
                    //                     JLabel label = new JLabel("??");
                    //                     label.setHorizontalAlignment(SwingConstants.RIGHT);
                    //                     label.setFont(APP_FONT);
                    //                     uiCompanyPanel.add(label, "cell 0 7");
                    //                  }
                    //                  {
                    //                     uiSuspendEnd = new LynkTextField();
                    //                     uiCompanyPanel.add(uiSuspendEnd, "cell 1 7 5 1,growx");
                    //                  }
                }
                {
                    JPanel panel4 = new JPanel();
                    panel4.setBorder(new EtchedBorder(EtchedBorder.LOWERED, null, null));
                    panel4.setLayout(new MigLayout("", "[]5[grow]", "[][][][grow][grow]"));
                    uiInfoBasic.add(panel4, "cell 1 0 1 3,grow");
                    {
                        JLabel label = new JLabel("???");
                        panel4.add(label, "cell 0 0,grow");
                        label.setFont(APP_FONT);
                    }
                    {
                        uiSocialCard = new LynkTextField();
                        panel4.add(uiSocialCard, "cell 1 0,grow");
                    }
                    {
                        JLabel label = new JLabel("?");
                        panel4.add(label, "cell 0 1,grow");
                        label.setFont(APP_FONT);
                    }
                    {
                        uiHousingCard = new LynkTextField();
                        panel4.add(uiHousingCard, "cell 1 1,grow");
                    }
                    {
                        JLabel label = new JLabel("??");
                        panel4.add(label, "cell 0 2,grow");
                        label.setFont(APP_FONT);
                    }
                    {
                        uiBankCard = new LynkTextField();
                        panel4.add(uiBankCard, "cell 1 2,grow");
                    }
                    {
                        JLabel label = new JLabel("?");
                        panel4.add(label, "cell 0 3,growx,aligny top");
                        label.setFont(APP_FONT);
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        panel4.add(scrollPane, "cell 1 3,grow");
                        uiWorkExperience = new JTextArea();
                        uiWorkExperience.setFont(APP_FONT);
                        scrollPane.setViewportView(uiWorkExperience);
                    }
                    {
                        JLabel label = new JLabel("");
                        panel4.add(label, "cell 0 4,growx,aligny top");
                        label.setFont(APP_FONT);
                    }
                    {
                        JScrollPane scrollPane = new JScrollPane();
                        panel4.add(scrollPane, "cell 1 4,grow");
                        {
                            uiNote = new JTextArea();
                            uiNote.setFont(APP_FONT);
                            scrollPane.setViewportView(uiNote);
                        }
                    }
                }
            }
            {
                JPanel uiInfoLeave = new JPanel();
                uiInfoLeave.setLayout(new MigLayout("", "[]5[150px]25[]5[150px]", "[][][][grow][]"));
                uiInfoTab.addTab("??", uiInfoLeave);
                {
                    uiLabelLeaveDate = new JLabel("?");
                    uiLabelLeaveDate.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelLeaveDate, "cell 0 0,grow");
                }
                {
                    uiLeaveDate = new JDateChooser();
                    uiLeaveDate.setDateFormatString("yyyy-MM-dd");
                    uiLeaveDate.setFont(APP_FONT);
                    uiLeaveDate.getJCalendar().setTodayButtonVisible(true);
                    uiLeaveDate.getJCalendar().setNullDateButtonVisible(true);
                    uiInfoLeave.add(uiLeaveDate, "cell 1 0,growx,aligny top");
                }
                {
                    uiLabelSocialEnd = new JLabel("??");
                    uiLabelSocialEnd.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelSocialEnd, "cell 0 1,grow");
                }
                {
                    uiLabelHousingEnd = new JLabel("?");
                    uiLabelHousingEnd.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelHousingEnd, "cell 2 1,grow");
                }
                {
                    uiHousingEndDate = new JDateChooser();
                    uiHousingEndDate.setDateFormatString("yyyy-MM-dd");
                    uiHousingEndDate.setFont(APP_FONT);
                    uiHousingEndDate.getJCalendar().setLeftButtonText("");
                    uiHousingEndDate.getJCalendar().setLeftButtonVisible(true);
                    uiHousingEndDate.getJCalendar().setTodayButtonVisible(true);
                    uiHousingEndDate.getJCalendar().setNullDateButtonVisible(true);
                    uiInfoLeave.add(uiHousingEndDate, "cell 3 1,growx,aligny top");
                }
                {
                    uiLabelLeaveType = new JLabel("?");
                    uiLabelLeaveType.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelLeaveType, "cell 0 2,grow");
                }
                {
                    uiSocialEndDate = new JDateChooser();
                    uiSocialEndDate.setDateFormatString("yyyy-MM-dd");
                    uiSocialEndDate.setFont(APP_FONT);
                    uiSocialEndDate.getJCalendar().setLeftButtonText("");
                    uiSocialEndDate.getJCalendar().setLeftButtonVisible(true);
                    uiSocialEndDate.getJCalendar().setTodayButtonVisible(true);
                    uiSocialEndDate.getJCalendar().setNullDateButtonVisible(true);
                    uiInfoLeave.add(uiSocialEndDate, "cell 1 1,growx,aligny top");
                }
                {
                    uiLeaveType = new JComboBox<String>(new DefaultComboBoxModel<String>(
                            new String[] { "", Employee.LEAVE_TYPE_A, Employee.LEAVE_TYPE_B,
                                    Employee.LEAVE_TYPE_C, Employee.LEAVE_TYPE_D, Employee.LEAVE_TYPE_E,
                                    Employee.LEAVE_TYPE_F, Employee.LEAVE_TYPE_G, Employee.LEAVE_TYPE_H }));
                    uiLeaveType.setMaximumRowCount(10);
                    uiLeaveType.setFont(APP_FONT);
                    uiInfoLeave.add(uiLeaveType, "cell 1 2 3 1,grow");
                }
                {
                    uiLabelLeaveReason = new JLabel("?");
                    uiLabelLeaveReason.setFont(APP_FONT);
                    uiInfoLeave.add(uiLabelLeaveReason, "cell 0 3,growx,aligny top");
                }
                {
                    JScrollPane scrollPane_2 = new JScrollPane();
                    uiInfoLeave.add(scrollPane_2, "cell 1 3 3 1,grow");
                    {
                        uiLeaveReason = new JTextArea();
                        scrollPane_2.setViewportView(uiLeaveReason);
                        uiLeaveReason.setFont(APP_FONT);
                    }
                }
                {
                    JLabel label = new JLabel("??");
                    label.setHorizontalAlignment(SwingConstants.RIGHT);
                    label.setFont(APP_FONT);
                    uiInfoLeave.add(label, "cell 0 4");
                }
                {
                    uiTimeCardLeaveCertify = new LynkTextField();
                    uiTimeCardLeaveCertify.setEditable(false);
                    uiInfoLeave.add(uiTimeCardLeaveCertify, "cell 1 4 2 1,growx");
                }
                {
                    JButton uiPrintLeaveCertify = new JButton("???");
                    uiPrintLeaveCertify.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            uiPrintLeaveCertifyActionPerformed(e);
                        }
                    });
                    uiPrintLeaveCertify.setToolTipText("???!");
                    uiPrintLeaveCertify.setFont(APP_FONT);
                    uiPrintLeaveCertify.setFocusable(false);
                    uiInfoLeave.add(uiPrintLeaveCertify, "cell 3 4,alignx right");
                }
            }
            {
                JPanel uiInfoSuspendHistory = new JPanel();
                uiInfoSuspendHistory.setLayout(new BorderLayout(0, 0));
                uiInfoTab.addTab("???", uiInfoSuspendHistory);
                {
                    JScrollPane scrollPane = new JScrollPane();
                    uiInfoSuspendHistory.add(scrollPane, BorderLayout.CENTER);
                    {
                        suspendModel = new EmployeeSuspendModel();
                        uiEmpSuspend = new LynkTable(suspendModel);
                        uiEmpSuspend.addHighlighter(UtilsClient.createAlignHighlighter());
                        uiEmpSuspend.setAutoResizeMode(LynkTable.AUTO_RESIZE_ALL_COLUMNS);
                        scrollPane.setRowHeaderView(new TableRowHead(uiEmpSuspend));
                        scrollPane.setViewportView(uiEmpSuspend);
                    }
                }
            }
            {
                JPanel uiInfoEmpHistory = new JPanel();
                uiInfoEmpHistory.setLayout(new BorderLayout(0, 0));
                uiInfoTab.addTab("?", uiInfoEmpHistory);
                {
                    JPanel pane = new JPanel();
                    pane.setLayout(new MigLayout("", "[][][][100px:100px:100px][]", "[]"));
                    uiInfoEmpHistory.add(pane, BorderLayout.NORTH);
                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        pane.add(label, "cell 0 0");
                    }
                    {
                        uiHistoryType = new JComboBox<String>(new DefaultComboBoxModel<>(
                                new String[] { "", PraisePunish.TYPE_A, PraisePunish.TYPE_B,
                                        PraisePunish.TYPE_C, PraisePunish.TYPE_D, PraisePunish.TYPE_E,
                                        PraisePunish.TYPE_F, PraisePunish.TYPE_G, PraisePunish.TYPE_H }));
                        uiHistoryType.setFont(APP_FONT);
                        pane.add(uiHistoryType, "cell 1 0");
                    }
                    {
                        JLabel label = new JLabel("?");
                        label.setFont(APP_FONT);
                        pane.add(label, "cell 2 0");
                    }
                    {
                        uiHistoryOperator = new LynkTextField();
                        pane.add(uiHistoryOperator, "cell 3 0,growx");
                    }
                    {
                        JButton uiRefresh = new JButton("");
                        uiRefresh.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiRefreshActionPerformed(e);
                            }
                        });
                        uiRefresh.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/refresh.png")));
                        uiRefresh.setFont(APP_FONT);
                        uiRefresh.setFocusable(false);
                        pane.add(uiRefresh, "cell 4 0");
                    }
                }
                {
                    JScrollPane scrollPane = new JScrollPane();
                    uiInfoEmpHistory.add(scrollPane, BorderLayout.CENTER);
                    {
                        historyModel = new EmployeeHistoryModel();
                        uiEmployeeHistory = new LynkTable(historyModel);
                        uiEmployeeHistory.setColumnSize(70, 540, 50, 130, 90);
                        scrollPane.setViewportView(uiEmployeeHistory);
                        scrollPane.setRowHeaderView(new TableRowHead(uiEmployeeHistory));

                    }
                }
            }
            {
                JPanel uiInfoJobAdjustment = new JPanel();
                uiInfoJobAdjustment.setLayout(new BorderLayout(0, 0));
                uiInfoTab.addTab("?", uiInfoJobAdjustment);
                {
                    JToolBar toolBar = new JToolBar();
                    toolBar.setFloatable(false);
                    uiInfoJobAdjustment.add(toolBar, BorderLayout.NORTH);
                    {
                        {
                            JButton uiAddJobAdjust = new JButton("?");
                            uiAddJobAdjust.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent e) {
                                    uiAddJobAdjustActionPerformed(e);
                                }
                            });
                            uiAddJobAdjust.setIcon(
                                    new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                            uiAddJobAdjust.setFont(APP_FONT);
                            toolBar.add(uiAddJobAdjust);
                        }
                    }
                }
                {
                    JScrollPane scrollPane = new JScrollPane();
                    uiInfoJobAdjustment.add(scrollPane, BorderLayout.CENTER);
                    {
                        jobAdjustmentModel = new JobAdjustmentModel();
                        uiJobAdjustment = new LynkTable(jobAdjustmentModel);
                        uiJobAdjustment.setColumnSize(50, 100, 100, 100, 100, 100, 80, 100, 150);
                        scrollPane.setRowHeaderView(new TableRowHead(uiJobAdjustment));
                        scrollPane.setViewportView(uiJobAdjustment);
                    }
                }
            }
            {
                JPanel uiInfoPraisePunish = new JPanel();
                uiInfoTab.addTab("", uiInfoPraisePunish);
                uiInfoPraisePunish.setLayout(
                        new MigLayout("", "[]10[grow]30[]10[120]5[]5[120]20[]20[][grow]", "[][grow]"));
                {
                    uiPraisePunishDateStart = new JDateChooser();
                    uiPraisePunishDateStart.setFont(APP_FONT);
                    uiPraisePunishDateStart.setDateFormatString("yyyy-MM-dd");
                    uiInfoPraisePunish.add(uiPraisePunishDateStart, "cell 3 0,growx");
                }
                {
                    uiPraisePunishDateEnd = new JDateChooser();
                    uiPraisePunishDateEnd.setFont(APP_FONT);
                    uiPraisePunishDateEnd.setDateFormatString("yyyy-MM-dd");
                    uiInfoPraisePunish.add(uiPraisePunishDateEnd, "cell 5 0,growx");

                }

                JButton uiAddPraisePunish = new JButton("");
                uiAddPraisePunish.addActionListener(new ActionListener() {
                    public void actionPerformed(ActionEvent e) {
                        uiAddPraisePunishActionPerformed(e);
                    }
                });
                {
                    JButton uiFindPraisePunish = new JButton("");
                    uiFindPraisePunish.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                            uiFindPraisePunishActionPerformed(e);
                        }
                    });
                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        uiInfoPraisePunish.add(label, "cell 0 0,alignx trailing");
                    }
                    {
                        uiPraisePunishType = new JComboBox<String>(
                                new DefaultComboBoxModel<String>(new String[] { "", PraisePunish.TYPE_A,
                                        PraisePunish.TYPE_B, PraisePunish.TYPE_C, PraisePunish.TYPE_D,
                                        PraisePunish.TYPE_E, PraisePunish.TYPE_F, PraisePunish.TYPE_G }));
                        uiPraisePunishType.setEditable(true);
                        uiPraisePunishType.setFont(APP_FONT);
                        uiInfoPraisePunish.add(uiPraisePunishType, "cell 1 0,growx");
                    }

                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        uiInfoPraisePunish.add(label, "cell 2 0");
                    }
                    {
                        JLabel label = new JLabel("");
                        label.setFont(APP_FONT);
                        uiInfoPraisePunish.add(label, "cell 4 0");
                    }
                    uiFindPraisePunish.setFocusable(false);
                    uiFindPraisePunish.setIcon(
                            new ImageIcon(InfoEmployee.class.getResource("/resource/image/refresh.png")));
                    uiFindPraisePunish.setFont(APP_FONT);
                    uiInfoPraisePunish.add(uiFindPraisePunish, "cell 6 0");
                }
                uiAddPraisePunish
                        .setIcon(new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                uiAddPraisePunish.setFont(APP_FONT);
                uiAddPraisePunish.setFocusable(false);
                uiInfoPraisePunish.add(uiAddPraisePunish, "cell 7 0");

                JScrollPane scrollPane = new JScrollPane();
                uiInfoPraisePunish.add(scrollPane, "cell 0 1 9 1,grow");
                {
                    praisePunishModel = new PraisePunishModel(
                            new String[] { PraisePunish.COLUMN_TYPE, PraisePunish.COLUMN_ACTION,
                                    PraisePunish.COLUMN_ACTION_DATE, PraisePunish.COLUMN_DEAL,
                                    PraisePunish.COLUMN_DEAL_DATE, PraisePunish.COLUMN_NOTE });
                    uiPraisePunish = new LynkTable(praisePunishModel);
                    uiPraisePunish.setColumnVisible(
                            new String[] { PraisePunish.COLUMN_TYPE, PraisePunish.COLUMN_ACTION,
                                    PraisePunish.COLUMN_ACTION_DATE, PraisePunish.COLUMN_DEAL,
                                    PraisePunish.COLUMN_DEAL_DATE, PraisePunish.COLUMN_NOTE });
                    uiPraisePunish.setDefaultRenderer(Object.class, new PraisePunishColorRenderer());
                    uiPraisePunish.setMouseDoubleClick(new MouseDoubleClick() {

                        @Override
                        public void doubleClick(int index) {
                            if (index != -1) {
                                index = uiPraisePunish.convertRowIndexToModel(index);
                                PraisePunish pp = praisePunishModel.getPp(index);
                                pp = InfoPraisePunish.showdialog(InfoEmployee.this, pp, null);
                                if (pp != null) {
                                    praisePunishModel.updatePp(pp);
                                }
                            }
                        }
                    });
                    scrollPane.setViewportView(uiPraisePunish);
                    scrollPane.setRowHeaderView(new TableRowHead(uiPraisePunish));
                }
            }
            {
                JPanel uiPanelVacation = new JPanel();
                uiPanelVacation.setLayout(new BorderLayout());
                uiInfoTab.addTab("?", uiPanelVacation);
                {
                    JToolBar uiVacationToolBar = new JToolBar();
                    uiVacationToolBar.setFloatable(false);
                    uiPanelVacation.add(uiVacationToolBar, BorderLayout.NORTH);
                    {
                        JButton uiVacationRefresh = new JButton("");
                        uiVacationRefresh.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiVacationRefreshActionPerformed(e);
                            }
                        });
                        uiVacationRefresh.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/refresh.png")));
                        uiVacationRefresh.setFocusable(false);
                        uiVacationRefresh.setFont(APP_FONT);
                        uiVacationToolBar.add(uiVacationRefresh);
                    }
                    uiVacationToolBar.addSeparator();
                    {
                        uiVacationHistoryAdd = new JButton("");
                        uiVacationHistoryAdd.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiVacationAddActionPerformed(e);
                            }
                        });
                        uiVacationHistoryAdd.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                        uiVacationHistoryAdd.setFocusable(false);
                        uiVacationHistoryAdd.setFont(APP_FONT);
                        uiVacationToolBar.add(uiVacationHistoryAdd);
                    }
                    uiVacationToolBar.addSeparator();
                    {
                        JButton uiEndLastLeft = new JButton("");
                        uiEndLastLeft.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {
                                uiEndLastLeftActionPerformed(e);
                            }
                        });
                        uiEndLastLeft.setIcon(
                                new ImageIcon(InfoEmployee.class.getResource("/resource/image/add.png")));
                        uiEndLastLeft.setFocusable(false);
                        uiEndLastLeft.setFont(APP_FONT);
                        uiVacationToolBar.add(uiEndLastLeft);
                    }
                }
                {
                    JPanel uiPanelVacationInfo = new JPanel();
                    uiPanelVacation.add(uiPanelVacationInfo, BorderLayout.CENTER);
                    uiPanelVacationInfo.setLayout(new MigLayout("", "[grow]", "[][grow]"));

                    JPanel paneAv = new JPanel();
                    uiPanelVacationInfo.add(paneAv, "cell 0 0,grow");
                    paneAv.setLayout(new MigLayout("", "[][grow]50[][grow]", "[][][]"));
                    {
                        uiVacationStartEnd = new JLabel("Time");
                        uiVacationStartEnd.setHorizontalAlignment(SwingConstants.CENTER);
                        paneAv.add(uiVacationStartEnd, "cell 0 0 4 1,growx");
                        uiVacationStartEnd.setForeground(Color.BLUE);
                        uiVacationStartEnd.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel(":");
                        paneAv.add(labe, "cell 0 1");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiLastTotal = new JLabel("");
                        paneAv.add(uiLastTotal, "cell 1 1,alignx left");
                        uiLastTotal.setForeground(Color.BLUE);
                        uiLastTotal.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel(":");
                        paneAv.add(labe, "cell 2 1");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiLastLeft = new JLabel("");
                        paneAv.add(uiLastLeft, "cell 3 1,alignx left");
                        uiLastLeft.setForeground(Color.BLUE);
                        uiLastLeft.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel(":");
                        paneAv.add(labe, "cell 0 2");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiCurrentTotal = new JLabel("");
                        paneAv.add(uiCurrentTotal, "cell 1 2,alignx left");
                        uiCurrentTotal.setForeground(Color.BLUE);
                        uiCurrentTotal.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        JLabel labe = new JLabel("?:");
                        paneAv.add(labe, "cell 2 2");
                        labe.setFont(APP_FONT.deriveFont(16f));
                    }
                    {
                        uiLeftHours = new JLabel("");
                        paneAv.add(uiLeftHours, "cell 3 2,alignx left");
                        uiLeftHours.setForeground(Color.BLUE);
                        uiLeftHours.setFont(APP_FONT.deriveFont(16f));
                    }

                    JScrollPane scrollPane = new JScrollPane();
                    uiPanelVacationInfo.add(scrollPane, "cell 0 1,grow");
                    {
                        attendanceVacationModel = new AttendanceVacationHistoryModel();
                        uiAttendanceVacationHistory = new LynkTable(attendanceVacationModel);
                        uiAttendanceVacationHistory.setAutoResizeMode(LynkTable.AUTO_RESIZE_ALL_COLUMNS);
                        scrollPane.setViewportView(uiAttendanceVacationHistory);
                        scrollPane.setRowHeaderView(new TableRowHead(uiAttendanceVacationHistory));
                    }
                }
            }
        }
    }

}

From source file:op.care.prescription.DlgRegular.java

/**
 * This method is called from within the constructor to
 * initialize the form./*  www .ja  v a  2 s  . c  om*/
 * WARNING: Do NOT modify this code. The content of this method is
 * always regenerated by the PrinterForm Editor.
 */
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
    jPanel1 = new JPanel();
    txtMed = new JXSearchField();
    cmbMed = new JComboBox<>();
    panel4 = new JPanel();
    btnMed = new JButton();
    cmbIntervention = new JComboBox<>();
    txtIntervention = new JXSearchField();
    jPanel8 = new JPanel();
    jspDosis = new JScrollPane();
    tblDosis = new JTable();
    panel2 = new JPanel();
    btnAddDosis = new JButton();
    jPanel3 = new JPanel();
    pnlOFF = new JPanel();
    rbActive = new JRadioButton();
    rbDate = new JRadioButton();
    txtTo = new JTextField();
    rbEndOfPackage = new JRadioButton();
    jScrollPane3 = new JScrollPane();
    txtBemerkung = new JTextPane();
    lblText = new JLabel();
    pnlON = new JPanel();
    cmbDocON = new JComboBox<>();
    btnAddGP = new JButton();
    cmbHospitalON = new JComboBox<>();
    btnAddHospital = new JButton();
    panel1 = new JPanel();
    btnClose = new JButton();
    btnSave = new JButton();
    lblTX = new JLabel();

    //======== this ========
    setModalityType(Dialog.ModalityType.APPLICATION_MODAL);
    setResizable(false);
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("$rgap, $lcgap, default, $lcgap, pref, $lcgap, $rgap",
            "$rgap, $lgap, fill:default:grow, $lgap, fill:default, $lgap, $rgap"));

    //======== jPanel1 ========
    {
        jPanel1.setBorder(null);
        jPanel1.setLayout(new FormLayout("68dlu, $lcgap, 284dlu, $lcgap, pref",
                "2*(16dlu, $lgap), default, $lgap, fill:default:grow"));

        //---- txtMed ----
        txtMed.setFont(new Font("Arial", Font.PLAIN, 14));
        txtMed.setPrompt("Medikamente");
        txtMed.setFocusBehavior(PromptSupport.FocusBehavior.HIGHLIGHT_PROMPT);
        txtMed.addActionListener(e -> txtMedActionPerformed(e));
        txtMed.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                txtMedFocusGained(e);
            }
        });
        jPanel1.add(txtMed, CC.xy(1, 1));

        //---- cmbMed ----
        cmbMed.setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbMed.setFont(new Font("Arial", Font.PLAIN, 14));
        cmbMed.addItemListener(e -> cmbMedItemStateChanged(e));
        jPanel1.add(cmbMed, CC.xy(3, 1));

        //======== panel4 ========
        {
            panel4.setLayout(new BoxLayout(panel4, BoxLayout.LINE_AXIS));

            //---- btnMed ----
            btnMed.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnMed.setBorderPainted(false);
            btnMed.setBorder(null);
            btnMed.setContentAreaFilled(false);
            btnMed.setToolTipText("Neues Medikament eintragen");
            btnMed.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnMed.setSelectedIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnMed.addActionListener(e -> btnMedActionPerformed(e));
            panel4.add(btnMed);
        }
        jPanel1.add(panel4, CC.xy(5, 1));

        //---- cmbIntervention ----
        cmbIntervention
                .setModel(new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
        cmbIntervention.setFont(new Font("Arial", Font.PLAIN, 14));
        jPanel1.add(cmbIntervention, CC.xywh(3, 3, 3, 1));

        //---- txtIntervention ----
        txtIntervention.setFont(new Font("Arial", Font.PLAIN, 14));
        txtIntervention.setPrompt("Massnahmen");
        txtIntervention.addActionListener(e -> txtMassActionPerformed(e));
        jPanel1.add(txtIntervention, CC.xy(1, 3));

        //======== jPanel8 ========
        {
            jPanel8.setBorder(new TitledBorder(null, "Dosis / H\u00e4ufigkeit", TitledBorder.LEADING,
                    TitledBorder.DEFAULT_POSITION, new Font("Arial", Font.PLAIN, 14)));
            jPanel8.setFont(new Font("Arial", Font.PLAIN, 14));
            jPanel8.setLayout(new FormLayout("370dlu", "fill:default:grow, $lgap, pref"));

            //======== jspDosis ========
            {
                jspDosis.setToolTipText(null);

                //---- tblDosis ----
                tblDosis.setModel(new DefaultTableModel(
                        new Object[][] { { null, null, null, null }, { null, null, null, null },
                                { null, null, null, null }, { null, null, null, null }, },
                        new String[] { "Title 1", "Title 2", "Title 3", "Title 4" }));
                tblDosis.setSurrendersFocusOnKeystroke(true);
                tblDosis.setToolTipText(null);
                tblDosis.addMouseListener(new MouseAdapter() {
                    @Override
                    public void mousePressed(MouseEvent e) {
                        tblDosisMousePressed(e);
                    }
                });
                jspDosis.setViewportView(tblDosis);
            }
            jPanel8.add(jspDosis, CC.xy(1, 1));

            //======== panel2 ========
            {
                panel2.setLayout(new BoxLayout(panel2, BoxLayout.LINE_AXIS));

                //---- btnAddDosis ----
                btnAddDosis.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
                btnAddDosis.setBorderPainted(false);
                btnAddDosis.setBorder(null);
                btnAddDosis.setContentAreaFilled(false);
                btnAddDosis.setToolTipText("Neue Dosierung eintragen");
                btnAddDosis.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
                btnAddDosis.setSelectedIcon(
                        new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
                btnAddDosis.addActionListener(e -> btnAddDosisActionPerformed(e));
                panel2.add(btnAddDosis);
            }
            jPanel8.add(panel2, CC.xy(1, 3, CC.LEFT, CC.DEFAULT));
        }
        jPanel1.add(jPanel8, CC.xywh(1, 7, 5, 1));
    }
    contentPane.add(jPanel1, CC.xy(5, 3));

    //======== jPanel3 ========
    {
        jPanel3.setBorder(null);
        jPanel3.setLayout(new FormLayout("149dlu", "3*(fill:default, $lgap), fill:108dlu:grow, $lgap, 60dlu"));

        //======== pnlOFF ========
        {
            pnlOFF.setBorder(new TitledBorder("Absetzung"));
            pnlOFF.setLayout(new FormLayout("pref, 86dlu:grow", "2*(fill:17dlu, $lgap), fill:17dlu"));

            //---- rbActive ----
            rbActive.setText("text");
            rbActive.setSelected(true);
            rbActive.addItemListener(e -> rbActiveItemStateChanged(e));
            pnlOFF.add(rbActive, CC.xywh(1, 1, 2, 1));

            //---- rbDate ----
            rbDate.setText(null);
            rbDate.addItemListener(e -> rbDateItemStateChanged(e));
            pnlOFF.add(rbDate, CC.xy(1, 3));

            //---- txtTo ----
            txtTo.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    txtToFocusLost(e);
                }
            });
            pnlOFF.add(txtTo, CC.xy(2, 3));

            //---- rbEndOfPackage ----
            rbEndOfPackage.setText("text");
            rbEndOfPackage.addItemListener(e -> rbEndOfPackageItemStateChanged(e));
            pnlOFF.add(rbEndOfPackage, CC.xywh(1, 5, 2, 1));
        }
        jPanel3.add(pnlOFF, CC.xy(1, 3));

        //======== jScrollPane3 ========
        {

            //---- txtBemerkung ----
            txtBemerkung.addCaretListener(e -> txtBemerkungCaretUpdate(e));
            jScrollPane3.setViewportView(txtBemerkung);
        }
        jPanel3.add(jScrollPane3, CC.xy(1, 7));

        //---- lblText ----
        lblText.setText("Bemerkung:");
        jPanel3.add(lblText, CC.xy(1, 5));

        //======== pnlON ========
        {
            pnlON.setBorder(new TitledBorder("Ansetzung"));
            pnlON.setLayout(new FormLayout("119dlu:grow, $lcgap, default", "default, $lgap, default"));

            //---- cmbDocON ----
            cmbDocON.setModel(
                    new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            cmbDocON.addKeyListener(new KeyAdapter() {
                @Override
                public void keyPressed(KeyEvent e) {
                    cmbDocONKeyPressed(e);
                }
            });
            pnlON.add(cmbDocON, CC.xy(1, 1));

            //---- btnAddGP ----
            btnAddGP.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAddGP.setBorderPainted(false);
            btnAddGP.setBorder(null);
            btnAddGP.setContentAreaFilled(false);
            btnAddGP.setToolTipText("Neues Medikament eintragen");
            btnAddGP.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnAddGP.setSelectedIcon(
                    new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnAddGP.addActionListener(e -> btnAddGPActionPerformed(e));
            pnlON.add(btnAddGP, CC.xy(3, 1));

            //---- cmbHospitalON ----
            cmbHospitalON.setModel(
                    new DefaultComboBoxModel<>(new String[] { "Item 1", "Item 2", "Item 3", "Item 4" }));
            pnlON.add(cmbHospitalON, CC.xy(1, 3));

            //---- btnAddHospital ----
            btnAddHospital.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/add.png")));
            btnAddHospital.setBorderPainted(false);
            btnAddHospital.setBorder(null);
            btnAddHospital.setContentAreaFilled(false);
            btnAddHospital.setToolTipText("Neues Medikament eintragen");
            btnAddHospital.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
            btnAddHospital.setSelectedIcon(
                    new ImageIcon(getClass().getResource("/artwork/22x22/bw/add-pressed.png")));
            btnAddHospital.addActionListener(e -> btnAddHospitalActionPerformed(e));
            pnlON.add(btnAddHospital, CC.xy(3, 3));
        }
        jPanel3.add(pnlON, CC.xy(1, 1));
    }
    contentPane.add(jPanel3, CC.xy(3, 3));

    //======== panel1 ========
    {
        panel1.setLayout(new BoxLayout(panel1, BoxLayout.LINE_AXIS));

        //---- btnClose ----
        btnClose.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/cancel.png")));
        btnClose.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnClose.addActionListener(e -> btnCloseActionPerformed(e));
        panel1.add(btnClose);

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
        btnSave.addActionListener(e -> btnSaveActionPerformed(e));
        panel1.add(btnSave);
    }
    contentPane.add(panel1, CC.xy(5, 5, CC.RIGHT, CC.DEFAULT));

    //---- lblTX ----
    lblTX.setText(null);
    lblTX.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/ambulance2.png")));
    contentPane.add(lblTX, CC.xy(3, 5));
    setSize(1015, 640);
    setLocationRelativeTo(getOwner());

    //---- bgMedikament ----
    ButtonGroup bgMedikament = new ButtonGroup();
    bgMedikament.add(rbActive);
    bgMedikament.add(rbDate);
    bgMedikament.add(rbEndOfPackage);
}

From source file:edu.ku.brc.specify.plugins.ipadexporter.ManageDataSetsDlg.java

/**
 * /*from   w  w w.  j  a va 2  s  . c o  m*/
 */
private void addUserToDS() {
    final Vector<String> wsList = new Vector<String>();
    final Vector<String> instItems = new Vector<String>();

    String addStr = getResourceString("ADD");
    instItems.add(addStr);
    wsList.add(addStr);
    for (String fullName : cloudHelper.getInstList()) {
        String[] toks = StringUtils.split(fullName, '\t');
        instItems.add(toks[0]);
        wsList.add(toks[1]);
    }

    final JTextField userNameTF = createTextField(20);
    final JTextField passwordTF = createTextField(20);
    final JLabel pwdLbl = createI18NFormLabel("Password");
    final JLabel statusLbl = createLabel("");
    final JCheckBox isNewUser = UIHelper.createCheckBox("Is New User");
    final JLabel instLbl = createI18NFormLabel("Insitution");
    final JComboBox instCmbx = UIHelper.createComboBox(instItems.toArray());

    if (instItems.size() == 2) {
        instCmbx.setSelectedIndex(1);
    }

    CellConstraints cc = new CellConstraints();
    PanelBuilder pb = new PanelBuilder(new FormLayout("p,2px,f:p:g", "p,4px,p,4px,p,4px,p,4px,p,8px,p"));

    pb.add(createI18NLabel("Add New or Existing User to DataSet"), cc.xyw(1, 1, 3));
    pb.add(createI18NFormLabel("Username"), cc.xy(1, 3));
    pb.add(userNameTF, cc.xy(3, 3));
    pb.add(pwdLbl, cc.xy(1, 5));
    pb.add(passwordTF, cc.xy(3, 5));
    pb.add(instLbl, cc.xy(1, 7));
    pb.add(instCmbx, cc.xy(3, 7));

    pb.add(isNewUser, cc.xy(3, 9));

    pb.add(statusLbl, cc.xyw(1, 11, 3));
    pb.setDefaultDialogBorder();

    pwdLbl.setVisible(false);
    passwordTF.setVisible(false);
    instLbl.setVisible(false);
    instCmbx.setVisible(false);

    final CustomDialog dlg = new CustomDialog(this, "Add User", true, OKCANCEL, pb.getPanel()) {
        @Override
        protected void okButtonPressed() {
            String usrName = userNameTF.getText();
            if (cloudHelper.isUserNameOK(usrName)) {
                String collGuid = datasetGUIDList.get(dataSetList.getSelectedIndex());
                if (cloudHelper.addUserAccessToDataSet(usrName, collGuid)) {
                    super.okButtonPressed();
                } else {
                    iPadDBExporterPlugin.setErrorMsg(statusLbl,
                            String.format("Unable to add usr: %s to the DataSet guid: %s", usrName, collGuid));
                }
            } else if (isNewUser.isSelected()) {
                String pwdStr = passwordTF.getText();
                String guid = null;
                if (instCmbx.getSelectedIndex() == 0) {
                    //                        InstDlg instDlg = new InstDlg(cloudHelper);
                    //                        if (!instDlg.isInstOK())
                    //                        {
                    //                            instDlg.createUI();
                    //                            instDlg.pack();
                    //                            centerAndShow(instDlg, 600, null);
                    //                            if (instDlg.isCancelled())
                    //                            {
                    //                                return;
                    //                            }
                    //                            //guid = instDlg.getGuid()();
                    //                        }
                } else {
                    //webSite = wsList.get(instCmbx.getSelectedIndex());

                }

                if (guid != null) {
                    String collGuid = datasetGUIDList.get(dataSetList.getSelectedIndex());
                    if (cloudHelper.addNewUser(usrName, pwdStr, guid)) {
                        if (cloudHelper.addUserAccessToDataSet(usrName, collGuid)) {
                            ManageDataSetsDlg.this.loadUsersForDataSetsIntoJList();
                            super.okButtonPressed();
                        } else {
                            iPadDBExporterPlugin.setErrorMsg(statusLbl,
                                    String.format("Unable to add%s to the DataSet %s", usrName, collGuid));
                        }
                    } else {
                        iPadDBExporterPlugin.setErrorMsg(statusLbl,
                                String.format("Unable to add%s to the DataSet %s", usrName, collGuid));
                    }
                } else {
                    // error
                }
            } else {
                iPadDBExporterPlugin.setErrorMsg(statusLbl, String.format("'%s' doesn't exist.", usrName));
            }
        }
    };

    KeyAdapter ka = new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            statusLbl.setText("");
            String usrNmStr = userNameTF.getText();
            boolean hasData = StringUtils.isNotEmpty(usrNmStr)
                    && (!isNewUser.isSelected() || StringUtils.isNotEmpty(passwordTF.getText()))
                    && UIHelper.isValidEmailAddress(usrNmStr);
            dlg.getOkBtn().setEnabled(hasData);
        }

    };
    userNameTF.addKeyListener(ka);
    passwordTF.addKeyListener(ka);

    final Color textColor = userNameTF.getForeground();

    FocusAdapter fa = new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            JTextField tf = (JTextField) e.getSource();
            if (!tf.getForeground().equals(textColor)) {
                tf.setText("");
                tf.setForeground(textColor);
            }
        }

        @Override
        public void focusLost(FocusEvent e) {
            JTextField tf = (JTextField) e.getSource();
            if (tf.getText().length() == 0) {
                tf.setText("Enter email address");
                tf.setForeground(Color.LIGHT_GRAY);
            }
        }
    };
    userNameTF.addFocusListener(fa);

    userNameTF.setText("Enter email address");
    userNameTF.setForeground(Color.LIGHT_GRAY);

    isNewUser.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            boolean isSel = isNewUser.isSelected();
            pwdLbl.setVisible(isSel);
            passwordTF.setVisible(isSel);
            instLbl.setVisible(isSel);
            instCmbx.setVisible(isSel);

            Dimension s = dlg.getSize();
            int hgt = isNewUser.getSize().height + 4 + instCmbx.getSize().height;
            s.height += isSel ? hgt : -hgt;
            dlg.setSize(s);
        }
    });

    dlg.createUI();
    dlg.getOkBtn().setEnabled(false);

    centerAndShow(dlg);
    if (!dlg.isCancelled()) {
        loadUsersForDataSetsIntoJList();
    }
}

From source file:net.rptools.maptool.launcher.MapToolLauncher.java

private JPanel buildBasicPanel() {
    final JPanel p = new JPanel();
    p.setLayout(new BorderLayout());

    // BASIC:  Top panel
    final JPanel logoPanel = new JPanel();
    logoPanel.setLayout(new FlowLayout());
    logoPanel.setBorder(//from w w w. j a  v a  2  s .  c  om
            new TitledBorder(new LineBorder(Color.BLACK), CopiedFromOtherJars.getText("msg.logoPanel.border"))); //$NON-NLS-1$

    jlMTLogo.setIcon(icon);
    logoPanel.add(jlMTLogo);

    // BASIC:  Middle panel
    final JPanel memPanel = new JPanel();
    memPanel.setLayout(new GridLayout(3, 2));
    memPanel.setBorder(new LineBorder(Color.WHITE));

    jtfMaxMem.setHorizontalAlignment(SwingConstants.RIGHT);
    jtfMaxMem.setInfo(CopiedFromOtherJars.getText("msg.info.javaMaxMem", DEFAULT_MAXMEM)); //$NON-NLS-1$ 
    jtfMaxMem.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.javaMaxMem")); //$NON-NLS-1$
    jtfMaxMem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            jtfMaxMemActionPerformed(evt);
        }
    });
    jtfMaxMem.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent evt) {
            jtfMaxMemFocusLost(evt);
        }

        @Override
        public void focusGained(FocusEvent evt) {
            jtfMaxMemFocusLost(evt);
        }
    });
    jtfMaxMem.addKeyListener(new InputValidator());

    jtfMinMem.setHorizontalAlignment(SwingConstants.RIGHT);
    jtfMinMem.setInfo(CopiedFromOtherJars.getText("msg.info.javaMinMem", DEFAULT_MINMEM)); //$NON-NLS-1$ 
    jtfMinMem.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.javaMinMem")); //$NON-NLS-1$
    jtfMinMem.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            jtfMinMemActionPerformed(evt);
        }
    });
    jtfMinMem.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent evt) {
            jtfMinMemFocusLost(evt);
        }

        @Override
        public void focusGained(FocusEvent evt) {
            jtfMinMemFocusLost(evt);
        }
    });
    jtfMinMem.addKeyListener(new InputValidator());

    jtfStackSize.setHorizontalAlignment(SwingConstants.RIGHT);
    jtfStackSize.setInfo(CopiedFromOtherJars.getText("msg.info.javaStackSize", DEFAULT_STACKSIZE)); //$NON-NLS-1$ 
    jtfStackSize.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.javaStackSize")); //$NON-NLS-1$
    jtfStackSize.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent evt) {
            jtfStackSizeActionPerformed(evt);
        }
    });
    jtfStackSize.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent evt) {
            jtfStackSizeFocusLost(evt);
        }

        @Override
        public void focusGained(FocusEvent evt) {
            jtfStackSizeFocusLost(evt);
        }
    });
    jtfStackSize.addKeyListener(new InputValidator());

    memPanel.add(jtfMaxMem);
    memPanel.add(jtfMinMem);
    memPanel.add(jtfStackSize);

    // BASIC:  Bottom panel
    final JPanel southPanel = new JPanel();
    southPanel.setLayout(new BorderLayout());

    final JPanel cbPanel = new JPanel();
    cbPanel.setLayout(new GridLayout(2, 1));
    cbPanel.setBorder(new LineBorder(Color.GRAY));

    jcbPromptUser.setSelected(true);
    jcbPromptUser.setText(CopiedFromOtherJars.getText("msg.info.promptAtNextLaunch")); //$NON-NLS-1$
    jcbPromptUser.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.promptAtNextLaunch")); //$NON-NLS-1$
    jcbPromptUser.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            promptUser = jcbPromptUser.isSelected();
        }
    });

    jbMTJar.setText(jbMTJarText);
    jbMTJar.setToolTipText(CopiedFromOtherJars.getText("msg.tooltip.registerMapToolJar")); //$NON-NLS-1$
    jbMTJar.addActionListener(new ActionListener() {
        @Override
        public void actionPerformed(ActionEvent e) {
            final JFileChooser jfc = new JFileChooser();
            jfc.setFileSelectionMode(JFileChooser.FILES_ONLY);
            FileFilter filter = new FileNameExtensionFilter(
                    CopiedFromOtherJars.getText("msg.chooser.javaExecutable"), "jar"); //$NON-NLS-1$ //$NON-NLS-2$
            jfc.addChoosableFileFilter(filter);
            jfc.setFileFilter(filter);
            if (IS_MAC) {
                filter = new FileNameExtensionFilter(
                        CopiedFromOtherJars.getText("msg.chooser.appleApplicationBundle"), "app"); //$NON-NLS-1$ //$NON-NLS-2$
                jfc.addChoosableFileFilter(filter);
            }
            jfc.setCurrentDirectory(mapToolJarDir);

            final int returnVal = jfc.showOpenDialog(jbMTJar);
            if (returnVal == JFileChooser.APPROVE_OPTION) {
                final File f = jfc.getSelectedFile();
                final String fileName = f.getName();
                if (IS_MAC && fileName.endsWith(".app")) { //$NON-NLS-1$
                    File jarDir = new File(f.getParentFile(), fileName);
                    if (jarDir.isDirectory()) {
                        jarDir = new File(jarDir, "Contents/Resources/Java"); //$NON-NLS-1$
                        if (jarDir.isDirectory()) {
                            mapToolJarDir = jarDir;
                            mapToolJarName = fileName.replace(".app", ".jar"); //$NON-NLS-1$ //$NON-NLS-2$
                        } else {
                            logMsg(Level.SEVERE,
                                    "{0} does not contain 'Contents/Resources/Java' like it should!", //$NON-NLS-1$
                                    "msg.chooser.badAppLocation", jarDir); //$NON-NLS-1$
                            return;
                        }
                    } else {
                        logMsg(Level.SEVERE, "{0} is not a directory and it should be!", //$NON-NLS-1$
                                "msg.chooser.badAppLocation", jarDir); //$NON-NLS-1$
                        return;
                    }
                } else {
                    mapToolJarName = fileName;
                    mapToolJarDir = f.getParentFile();
                }
                logMsg(Level.INFO, f.toString(), null);
                jbMTJar.setText(fileName.replace(".jar", EMPTY)); //$NON-NLS-1$
                if (fileName.toLowerCase().startsWith("maptool-")) {
                    // We expect the name matches 'maptool-1.3.b89.jar'
                    mapToolVersion = " " + fileName.substring(8, 11);
                } else {
                    logMsg(Level.SEVERE, "Cannot determine MapTool version number from JAR filename: {0}", //$NON-NLS-1$
                            "msg.info.noMapToolVersion", fileName);
                    mapToolVersion = EMPTY;
                }
                jbLaunch.setEnabled(true);
                updateCommand();
                jbLaunch.requestFocusInWindow();
            }
        }
    });

    cbPanel.add(jcbPromptUser);
    cbPanel.add(jbMTJar);

    southPanel.add(cbPanel, BorderLayout.CENTER);

    p.add(memPanel, BorderLayout.CENTER);
    p.add(logoPanel, BorderLayout.NORTH);
    p.add(southPanel, BorderLayout.SOUTH);
    p.setBorder(new LineBorder(Color.BLACK));
    return p;
}

From source file:org.forester.archaeopteryx.TreePanel.java

TreePanel(final Phylogeny t, final Configuration configuration, final MainPanel tjp) {
    requestFocusInWindow();//from   w  w  w  .  ja  v  a 2s . co m
    addKeyListener(new KeyAdapter() {

        @Override
        public void keyPressed(final KeyEvent key_event) {
            keyPressedCalls(key_event);
            requestFocusInWindow();
        }
    });
    addFocusListener(new FocusAdapter() {

        @Override
        public void focusGained(final FocusEvent e) {
            requestFocusInWindow();
        }
    });
    if ((t == null) || t.isEmpty()) {
        throw new IllegalArgumentException("ill advised attempt to draw phylogeny which is null or empty");
    }
    _graphics_type = tjp.getOptions().getPhylogenyGraphicsType();
    _main_panel = tjp;
    _configuration = configuration;
    _phylogeny = t;
    _phy_has_branch_lengths = ForesterUtil.isHasAtLeastOneBranchLengthLargerThanZero(_phylogeny);
    init();
    if (!_phylogeny.isEmpty()) {
        _phylogeny.recalculateNumberOfExternalDescendants(true);
    }
    setBackground(getTreeColorSet().getBackgroundColor());
    final MouseListener mouse_listener = new MouseListener(this);
    addMouseListener(mouse_listener);
    addMouseMotionListener(mouse_listener);
    addMouseWheelListener(this);
    calculateScaleDistance();
    FORMATTER_CONFIDENCE
            .setMaximumFractionDigits(configuration.getNumberOfDigitsAfterCommaForConfidenceValues());
    FORMATTER_BRANCH_LENGTH
            .setMaximumFractionDigits(configuration.getNumberOfDigitsAfterCommaForBranchLengthValues());
}