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:visolate.Visolate.java

private JPanel getInitialYPanel() {
    if (myInitialYPanel == null) {
        myInitialYPanel = new JPanel();
        myInitialYPanel.setLayout(new BorderLayout());
        myInitialYPanel.add(new JLabel("Y"), BorderLayout.WEST);
        myInitialYPanel.setToolTipText("Upper side is at this coordinates (mm or inch)");
        myInitialYPanel.setEnabled(gCodeWriter.getIsAbsolute());
        final JTextField field = new JTextField(NumberFormat.getInstance().format(gCodeWriter.getYOffset()));
        myInitialYPanel.add(field, BorderLayout.CENTER);
        myInitialYPanel.addPropertyChangeListener("enabled", new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                field.setEnabled(myInitialYPanel.isEnabled());
            }//from w w  w. j a v  a2s  .co  m
        });
        field.setEnabled(myInitialYPanel.isEnabled());
        field.addFocusListener(new FocusAdapter() {
            public void focusLost(FocusEvent evt) {
                try {
                    gCodeWriter.setYOffset(NumberFormat.getInstance().parse(field.getText()).doubleValue());
                } catch (ParseException e) {
                }
                field.setText(NumberFormat.getInstance().format(gCodeWriter.getYOffset()));
            }
        });
    }
    return myInitialYPanel;
}

From source file:ru.goodfil.catalog.ui.forms.FilterWindow.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - Sasha aaa
    contentPanel = new JPanel();
    label16 = new JLabel();
    label17 = new JLabel();
    label18 = new JLabel();
    label1 = new JLabel();
    cbFilterType = new JComboBox();
    label5 = new JLabel();
    tbAParam = new JTextField();
    label2 = new JLabel();
    cbFilterForm = new JComboBox();
    label6 = new JLabel();
    tbBParam = new JTextField();
    label3 = new JLabel();
    tbName = new JTextField();
    label7 = new JLabel();
    tbCParam = new JTextField();
    label4 = new JLabel();
    panel2 = new JPanel();
    tbImage = new JTextField();
    btnUploadImage = new JButton();
    label8 = new JLabel();
    tbDParam = new JTextField();
    label19 = new JLabel();
    cbFilterStatus = new JComboBox();
    label9 = new JLabel();
    tbEParam = new JTextField();
    label15 = new JLabel();
    scrollPane1 = new JScrollPane();
    tbAdditionalInfo = new JTextArea();
    label10 = new JLabel();
    tbFParam = new JTextField();
    label11 = new JLabel();
    tbGParam = new JTextField();
    label12 = new JLabel();
    tbHParam = new JTextField();
    label13 = new JLabel();
    tbPbParam = new JTextField();
    label14 = new JLabel();
    tbNrParam = new JTextField();
    panel1 = new JPanel();
    okButton = new JButton();
    cancelButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setModal(true);// w  w w.j  a v a  2  s . c  om
    setTitle("\u0424\u0438\u043b\u044c\u0442\u0440");
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("default:grow", "fill:default:grow"));

    //======== contentPanel ========
    {

        // JFormDesigner evaluation mark
        contentPanel.setBorder(new javax.swing.border.CompoundBorder(
                new javax.swing.border.TitledBorder(new javax.swing.border.EmptyBorder(0, 0, 0, 0),
                        "JFormDesigner Evaluation", javax.swing.border.TitledBorder.CENTER,
                        javax.swing.border.TitledBorder.BOTTOM,
                        new java.awt.Font("Dialog", java.awt.Font.BOLD, 12), java.awt.Color.red),
                contentPanel.getBorder()));
        contentPanel.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent e) {
                if ("border".equals(e.getPropertyName()))
                    throw new RuntimeException();
            }
        });

        contentPanel.setLayout(new FormLayout(
                "$rgap, default, $lcgap, default:grow, $lcgap, right:20dlu, $lcgap, default:grow, $rgap",
                "13*(default, $lgap), fill:default:grow, $lgap, default"));

        //---- label16 ----
        label16.setText(
                "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0444\u0438\u043b\u044c\u0442\u0440\u0435. ");
        contentPanel.add(label16, cc.xywh(2, 1, 7, 1));

        //---- label17 ----
        label17.setText(
                "\u041f\u043e\u043b\u044f, \u043f\u043e\u043c\u0435\u0447\u0435\u043d\u043d\u044b\u0435 \u0437\u0432\u0435\u0437\u0434\u043e\u0447\u043a\u0430\u043c\u0438, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c\u0438 \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f.");
        contentPanel.add(label17, cc.xywh(2, 3, 7, 1));

        //---- label18 ----
        label18.setText(
                "\u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0442\u0438\u043f \u0438\u043b\u0438 \u0444\u043e\u0440\u043c\u0443 \u043f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \"\u0418\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b\"->\"\u0422\u0438\u043f\u044b \u0438 \u0444\u043e\u0440\u043c\u044b \u0444\u0438\u043b\u044c\u0442\u0440\u043e\u0432\"");
        label18.setForeground(Color.blue);
        contentPanel.add(label18, cc.xywh(2, 5, 7, 1));

        //---- label1 ----
        label1.setText("\u0422\u0438\u043f*");
        contentPanel.add(label1, cc.xy(2, 7));
        contentPanel.add(cbFilterType, cc.xy(4, 7));

        //---- label5 ----
        label5.setText("A");
        contentPanel.add(label5, cc.xy(6, 7));
        contentPanel.add(tbAParam, cc.xy(8, 7));

        //---- label2 ----
        label2.setText("\u0424\u043e\u0440\u043c\u0430*");
        contentPanel.add(label2, cc.xy(2, 9));
        contentPanel.add(cbFilterForm, cc.xy(4, 9));

        //---- label6 ----
        label6.setText("B");
        contentPanel.add(label6, cc.xy(6, 9));
        contentPanel.add(tbBParam, cc.xy(8, 9));

        //---- label3 ----
        label3.setText("\u041d\u0430\u0438\u043c\u0435\u043d\u043e\u0432\u0430\u043d\u0438\u0435*");
        contentPanel.add(label3, cc.xy(2, 11));

        //---- tbName ----
        tbName.addKeyListener(new KeyAdapter() {
            @Override
            public void keyTyped(KeyEvent e) {
                tbNameKeyTyped(e);
            }
        });
        tbName.addFocusListener(new FocusAdapter() {
            @Override
            public void focusGained(FocusEvent e) {
                tbNameFocusGained(e);
            }

            @Override
            public void focusLost(FocusEvent e) {
                tbNameFocusGained(e);
            }
        });
        contentPanel.add(tbName, cc.xy(4, 11));

        //---- label7 ----
        label7.setText("C");
        contentPanel.add(label7, cc.xy(6, 11));
        contentPanel.add(tbCParam, cc.xy(8, 11));

        //---- label4 ----
        label4.setText("\u0418\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u0435");
        contentPanel.add(label4, cc.xy(2, 13));

        //======== panel2 ========
        {
            panel2.setLayout(new FormLayout("default:grow, $lcgap, default", "default"));
            panel2.add(tbImage, cc.xy(1, 1));

            //---- btnUploadImage ----
            btnUploadImage.setText("...");
            btnUploadImage.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    btnUploadImageActionPerformed();
                }
            });
            panel2.add(btnUploadImage, cc.xy(3, 1));
        }
        contentPanel.add(panel2, cc.xy(4, 13));

        //---- label8 ----
        label8.setText("D");
        contentPanel.add(label8, cc.xy(6, 13));
        contentPanel.add(tbDParam, cc.xy(8, 13));

        //---- label19 ----
        label19.setText("\u0421\u0442\u0430\u0442\u0443\u0441");
        contentPanel.add(label19, cc.xy(2, 15));

        //---- cbFilterStatus ----
        cbFilterStatus.setModel(new DefaultComboBoxModel(new String[] {
                "\u0412 \u041f\u0420\u041e\u0418\u0417\u0412\u041e\u0414\u0421\u0422\u0412\u0415",
                "\u041f\u041e\u0421\u0422\u0410\u0412\u041b\u042f\u0415\u0422\u0421\u042f",
                "\u041d\u0415 \u041f\u041e\u0421\u0422\u0410\u0412\u041b\u042f\u0415\u0422\u0421\u042f" }));
        contentPanel.add(cbFilterStatus, cc.xy(4, 15));

        //---- label9 ----
        label9.setText("E");
        contentPanel.add(label9, cc.xy(6, 15));
        contentPanel.add(tbEParam, cc.xy(8, 15));

        //---- label15 ----
        label15.setText("\u0414\u043e\u043f. \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f");
        contentPanel.add(label15, cc.xy(2, 17));

        //======== scrollPane1 ========
        {
            scrollPane1.setViewportView(tbAdditionalInfo);
        }
        contentPanel.add(scrollPane1, cc.xywh(4, 17, 1, 11));

        //---- label10 ----
        label10.setText("F");
        contentPanel.add(label10, cc.xy(6, 17));
        contentPanel.add(tbFParam, cc.xy(8, 17));

        //---- label11 ----
        label11.setText("G");
        contentPanel.add(label11, cc.xy(6, 19));
        contentPanel.add(tbGParam, cc.xy(8, 19));

        //---- label12 ----
        label12.setText("H");
        contentPanel.add(label12, cc.xy(6, 21));
        contentPanel.add(tbHParam, cc.xy(8, 21));

        //---- label13 ----
        label13.setText("PB");
        contentPanel.add(label13, cc.xy(6, 23));
        contentPanel.add(tbPbParam, cc.xy(8, 23));

        //---- label14 ----
        label14.setText("NR");
        contentPanel.add(label14, cc.xy(6, 25));
        contentPanel.add(tbNrParam, cc.xy(8, 25));

        //======== panel1 ========
        {
            panel1.setLayout(new FormLayout("default:grow, 2*($lcgap, $button)", "default"));

            //---- okButton ----
            okButton.setText("OK");
            okButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    okButtonActionPerformed(e);
                }
            });
            panel1.add(okButton, cc.xy(3, 1));

            //---- cancelButton ----
            cancelButton.setText("\u041e\u0442\u043c\u0435\u043d\u0430");
            cancelButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    cancelButtonActionPerformed(e);
                }
            });
            panel1.add(cancelButton, cc.xy(5, 1));
        }
        contentPanel.add(panel1, cc.xywh(2, 29, 7, 1));
    }
    contentPane.add(contentPanel, cc.xy(1, 1));
    pack();
    setLocationRelativeTo(getOwner());
    // JFormDesigner - End of component initialization  //GEN-END:initComponents

    cbFilterType.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                SelectItem selectItem = (SelectItem) e.getItem();
                FilterType ft = carsService.getFilterTypeByCode(selectItem.getId());
                reReadFilterForms(ft.getCode());

            }
        }
    });

    cbFilterForm.addItemListener(new ItemListener() {
        @Override
        public void itemStateChanged(ItemEvent e) {
            if (e.getStateChange() == ItemEvent.SELECTED) {
                adjustParameters();
                adjustButtonsEnabled();
            }
        }
    });
}

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

/**
 * This method is called from within the constructor to
 * initialize the form./*from   w  w w.j a 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() {
    panelMain = new JPanel();
    splitRegular = new JSplitPane();
    pnlTageszeit = new JPanel();
    jLabel6 = new JideLabel();
    jLabel1 = new JideLabel();
    jLabel2 = new JideLabel();
    jLabel11 = new JideLabel();
    jLabel3 = new JideLabel();
    jLabel4 = new JideLabel();
    txtNachtMo = new JTextField();
    txtMorgens = new JTextField();
    txtMittags = new JTextField();
    txtNachmittags = new JTextField();
    txtAbends = new JTextField();
    txtNachtAb = new JTextField();
    btnToTime = new JButton();
    pnlUhrzeit = new JPanel();
    lblUhrzeit = new JideLabel();
    btnToTimeOfDay = new JButton();
    txtUhrzeit = new JTextField();
    cmbUhrzeit = new JComboBox();
    tabWdh = new JideTabbedPane();
    pnlDaily = new JPanel();
    label3 = new JLabel();
    spinTaeglich = new JSpinner();
    jLabel7 = new JLabel();
    btnJedenTag = new JButton();
    pnlWeekly = new JPanel();
    panel3 = new JPanel();
    btnJedeWoche = new JButton();
    label2 = new JLabel();
    spinWoche = new JSpinner();
    jLabel8 = new JLabel();
    lblUhrzeit2 = new JideLabel();
    lblUhrzeit3 = new JideLabel();
    lblUhrzeit4 = new JideLabel();
    lblUhrzeit5 = new JideLabel();
    lblUhrzeit6 = new JideLabel();
    lblUhrzeit7 = new JideLabel();
    lblUhrzeit8 = new JideLabel();
    cbMon = new JCheckBox();
    cbDie = new JCheckBox();
    cbMit = new JCheckBox();
    cbDon = new JCheckBox();
    cbFre = new JCheckBox();
    cbSam = new JCheckBox();
    cbSon = new JCheckBox();
    pnlMonthly = new JPanel();
    label4 = new JLabel();
    spinMonat = new JSpinner();
    label6 = new JLabel();
    btnJedenMonat = new JButton();
    label5 = new JLabel();
    spinMonatTag = new JSpinner();
    cmbTag = new JComboBox<>();
    panel2 = new JPanel();
    jLabel13 = new JLabel();
    txtLDate = new JTextField();
    lblMinutes = new JLabel();
    txtMinutes = new JTextField();
    pnlBemerkung = new JPanel();
    jScrollPane1 = new JScrollPane();
    txtBemerkung = new JTextArea();
    btnSave = new JButton();

    //======== this ========
    setLayout(new BorderLayout());

    //======== panelMain ========
    {
        panelMain.setBorder(new LineBorder(Color.black, 2, true));
        panelMain.addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                panelMainComponentResized(e);
            }
        });
        panelMain.setLayout(new FormLayout("$rgap, $lcgap, 223dlu:grow, $lcgap, $rgap",
                "$rgap, $lgap, pref, $lgap, default, $lgap, pref, $lgap, default, $lgap, 72dlu:grow, 2*($lgap, default)"));

        //======== splitRegular ========
        {
            splitRegular.setDividerSize(0);
            splitRegular.setEnabled(false);
            splitRegular.setDividerLocation(150);
            splitRegular.setDoubleBuffered(true);

            //======== pnlTageszeit ========
            {
                pnlTageszeit.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlTageszeit.setBorder(new EtchedBorder());
                pnlTageszeit.setLayout(
                        new FormLayout("6*(28dlu, $lcgap), default", "fill:default, $lgap, fill:default"));

                //---- jLabel6 ----
                jLabel6.setText("Nachts, fr\u00fch morgens");
                jLabel6.setOrientation(1);
                jLabel6.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel6.setClockwise(false);
                jLabel6.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel6, CC.xy(1, 1));

                //---- jLabel1 ----
                jLabel1.setForeground(new Color(0, 0, 204));
                jLabel1.setText("Morgens");
                jLabel1.setOrientation(1);
                jLabel1.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel1.setClockwise(false);
                jLabel1.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel1, CC.xy(3, 1));

                //---- jLabel2 ----
                jLabel2.setForeground(new Color(255, 102, 0));
                jLabel2.setText("Mittags");
                jLabel2.setOrientation(1);
                jLabel2.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel2.setClockwise(false);
                jLabel2.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel2, CC.xy(5, 1));

                //---- jLabel11 ----
                jLabel11.setForeground(new Color(0, 153, 51));
                jLabel11.setText("Nachmittag");
                jLabel11.setOrientation(1);
                jLabel11.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel11.setClockwise(false);
                jLabel11.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel11, CC.xy(7, 1));

                //---- jLabel3 ----
                jLabel3.setForeground(new Color(255, 0, 51));
                jLabel3.setText("Abends");
                jLabel3.setOrientation(1);
                jLabel3.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel3.setClockwise(false);
                jLabel3.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel3, CC.xy(9, 1));

                //---- jLabel4 ----
                jLabel4.setText("Nacht, sp\u00e4t abends");
                jLabel4.setOrientation(1);
                jLabel4.setFont(new Font("Arial", Font.PLAIN, 14));
                jLabel4.setClockwise(false);
                jLabel4.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(jLabel4, CC.xy(11, 1));

                //---- txtNachtMo ----
                txtNachtMo.setHorizontalAlignment(SwingConstants.RIGHT);
                txtNachtMo.setText("0.0");
                txtNachtMo.setFont(new Font("Arial", Font.PLAIN, 14));
                txtNachtMo.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtNachtMoActionPerformed(e);
                    }
                });
                txtNachtMo.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtNachtMo, CC.xy(1, 3));

                //---- txtMorgens ----
                txtMorgens.setHorizontalAlignment(SwingConstants.RIGHT);
                txtMorgens.setText("1.0");
                txtMorgens.setFont(new Font("Arial", Font.PLAIN, 14));
                txtMorgens.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtMorgensActionPerformed(e);
                    }
                });
                txtMorgens.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtMorgens, CC.xy(3, 3));

                //---- txtMittags ----
                txtMittags.setHorizontalAlignment(SwingConstants.RIGHT);
                txtMittags.setText("0.0");
                txtMittags.setFont(new Font("Arial", Font.PLAIN, 14));
                txtMittags.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtMittagsActionPerformed(e);
                    }
                });
                txtMittags.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtMittags, CC.xy(5, 3));

                //---- txtNachmittags ----
                txtNachmittags.setHorizontalAlignment(SwingConstants.RIGHT);
                txtNachmittags.setText("0.0");
                txtNachmittags.setFont(new Font("Arial", Font.PLAIN, 14));
                txtNachmittags.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtNachmittagsActionPerformed(e);
                    }
                });
                txtNachmittags.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtNachmittags, CC.xy(7, 3));

                //---- txtAbends ----
                txtAbends.setHorizontalAlignment(SwingConstants.RIGHT);
                txtAbends.setText("0.0");
                txtAbends.setFont(new Font("Arial", Font.PLAIN, 14));
                txtAbends.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtAbendsActionPerformed(e);
                    }
                });
                txtAbends.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtAbends, CC.xy(9, 3));

                //---- txtNachtAb ----
                txtNachtAb.setHorizontalAlignment(SwingConstants.RIGHT);
                txtNachtAb.setText("0.0");
                txtNachtAb.setFont(new Font("Arial", Font.PLAIN, 14));
                txtNachtAb.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtNachtAbActionPerformed(e);
                    }
                });
                txtNachtAb.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlTageszeit.add(txtNachtAb, CC.xy(11, 3));

                //---- btnToTime ----
                btnToTime.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/1rightarrow.png")));
                btnToTime.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnToTimeActionPerformed(e);
                    }
                });
                pnlTageszeit.add(btnToTime, CC.xy(13, 3));
            }
            splitRegular.setLeftComponent(pnlTageszeit);

            //======== pnlUhrzeit ========
            {
                pnlUhrzeit.setBorder(new EtchedBorder());
                pnlUhrzeit.setLayout(
                        new FormLayout("default, $ugap, 75dlu, $ugap, pref", "default:grow, $rgap, default"));

                //---- lblUhrzeit ----
                lblUhrzeit.setText("Anzahl Massnahmen");
                lblUhrzeit.setOrientation(2);
                lblUhrzeit.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit.setClockwise(false);
                lblUhrzeit.setHorizontalTextPosition(SwingConstants.LEFT);
                lblUhrzeit.setVerticalAlignment(SwingConstants.BOTTOM);
                pnlUhrzeit.add(lblUhrzeit, CC.xy(3, 1, CC.DEFAULT, CC.BOTTOM));

                //---- btnToTimeOfDay ----
                btnToTimeOfDay
                        .setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/1leftarrow.png")));
                btnToTimeOfDay.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnToTimeOfDayActionPerformed(e);
                    }
                });
                pnlUhrzeit.add(btnToTimeOfDay, CC.xy(1, 3));

                //---- txtUhrzeit ----
                txtUhrzeit.setHorizontalAlignment(SwingConstants.RIGHT);
                txtUhrzeit.setText("0.0");
                txtUhrzeit.setFont(new Font("Arial", Font.PLAIN, 14));
                txtUhrzeit.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtUhrzeitActionPerformed(e);
                    }
                });
                txtUhrzeit.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtIntegerFocusLost(e);
                    }
                });
                pnlUhrzeit.add(txtUhrzeit, CC.xy(3, 3));

                //---- cmbUhrzeit ----
                cmbUhrzeit.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent e) {
                        cmbUhrzeitItemStateChanged(e);
                    }
                });
                pnlUhrzeit.add(cmbUhrzeit, CC.xy(5, 3));
            }
            splitRegular.setRightComponent(pnlUhrzeit);
        }
        panelMain.add(splitRegular, CC.xy(3, 3));

        //======== tabWdh ========
        {

            //======== pnlDaily ========
            {
                pnlDaily.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.setLayout(new FormLayout("2*(default), $rgap, $lcgap, 40dlu, $rgap, default",
                        "default, $lgap, pref, $lgap, default"));

                //---- label3 ----
                label3.setText("alle");
                label3.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.add(label3, CC.xy(2, 3));

                //---- spinTaeglich ----
                spinTaeglich.setFont(new Font("Arial", Font.PLAIN, 14));
                spinTaeglich.setModel(new SpinnerNumberModel(1, null, null, 1));
                pnlDaily.add(spinTaeglich, CC.xy(5, 3));

                //---- jLabel7 ----
                jLabel7.setText("Tage");
                jLabel7.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.add(jLabel7, CC.xy(7, 3));

                //---- btnJedenTag ----
                btnJedenTag.setText("Jeden Tag");
                btnJedenTag.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnJedenTagActionPerformed(e);
                    }
                });
                pnlDaily.add(btnJedenTag, CC.xywh(2, 5, 6, 1));
            }
            tabWdh.addTab("T\u00e4glich", pnlDaily);

            //======== pnlWeekly ========
            {
                pnlWeekly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlWeekly.setLayout(new FormLayout("default, 7*(13dlu), $lcgap, default:grow",
                        "$ugap, $lgap, default, $lgap, pref, default:grow, $lgap, $rgap"));

                //======== panel3 ========
                {
                    panel3.setLayout(
                            new FormLayout("default, $rgap, 40dlu, $rgap, 2*(default), $lcgap, default, $lcgap",
                                    "default:grow, $lgap, default"));

                    //---- btnJedeWoche ----
                    btnJedeWoche.setText("Jede Woche");
                    btnJedeWoche.setFont(new Font("Arial", Font.PLAIN, 14));
                    btnJedeWoche.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            btnJedeWocheActionPerformed(e);
                        }
                    });
                    panel3.add(btnJedeWoche, CC.xywh(3, 3, 3, 1));

                    //---- label2 ----
                    label2.setText("alle");
                    label2.setFont(new Font("Arial", Font.PLAIN, 14));
                    panel3.add(label2, CC.xy(1, 1));
                    panel3.add(spinWoche, CC.xy(3, 1));

                    //---- jLabel8 ----
                    jLabel8.setText("Wochen am");
                    jLabel8.setFont(new Font("Arial", Font.PLAIN, 14));
                    panel3.add(jLabel8, CC.xy(5, 1));
                }
                pnlWeekly.add(panel3, CC.xywh(2, 3, 9, 1));

                //---- lblUhrzeit2 ----
                lblUhrzeit2.setText("montags");
                lblUhrzeit2.setOrientation(1);
                lblUhrzeit2.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit2.setClockwise(false);
                lblUhrzeit2.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit2, CC.xy(2, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit3 ----
                lblUhrzeit3.setText("dienstags");
                lblUhrzeit3.setOrientation(1);
                lblUhrzeit3.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit3.setClockwise(false);
                lblUhrzeit3.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit3, CC.xy(3, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit4 ----
                lblUhrzeit4.setText("mittwochs");
                lblUhrzeit4.setOrientation(1);
                lblUhrzeit4.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit4.setClockwise(false);
                lblUhrzeit4.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit4, CC.xy(4, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit5 ----
                lblUhrzeit5.setText("donnerstags");
                lblUhrzeit5.setOrientation(1);
                lblUhrzeit5.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit5.setClockwise(false);
                lblUhrzeit5.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit5, CC.xy(5, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit6 ----
                lblUhrzeit6.setText("freitags");
                lblUhrzeit6.setOrientation(1);
                lblUhrzeit6.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit6.setClockwise(false);
                lblUhrzeit6.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit6, CC.xy(6, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit7 ----
                lblUhrzeit7.setText("samstags");
                lblUhrzeit7.setOrientation(1);
                lblUhrzeit7.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit7.setClockwise(false);
                lblUhrzeit7.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit7, CC.xy(7, 5, CC.CENTER, CC.BOTTOM));

                //---- lblUhrzeit8 ----
                lblUhrzeit8.setText("sonntags");
                lblUhrzeit8.setOrientation(1);
                lblUhrzeit8.setFont(new Font("Arial", Font.PLAIN, 14));
                lblUhrzeit8.setClockwise(false);
                lblUhrzeit8.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblUhrzeit8, CC.xy(8, 5, CC.CENTER, CC.BOTTOM));

                //---- cbMon ----
                cbMon.setBorder(BorderFactory.createEmptyBorder());
                cbMon.setMargin(new Insets(0, 0, 0, 0));
                cbMon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbMonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbMon, CC.xy(2, 6, CC.CENTER, CC.DEFAULT));

                //---- cbDie ----
                cbDie.setBorder(BorderFactory.createEmptyBorder());
                cbDie.setMargin(new Insets(0, 0, 0, 0));
                cbDie.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbDieActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbDie, CC.xy(3, 6, CC.CENTER, CC.DEFAULT));

                //---- cbMit ----
                cbMit.setBorder(BorderFactory.createEmptyBorder());
                cbMit.setMargin(new Insets(0, 0, 0, 0));
                cbMit.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbMitActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbMit, CC.xy(4, 6, CC.CENTER, CC.DEFAULT));

                //---- cbDon ----
                cbDon.setBorder(BorderFactory.createEmptyBorder());
                cbDon.setMargin(new Insets(0, 0, 0, 0));
                cbDon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbDonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbDon, CC.xy(5, 6, CC.CENTER, CC.DEFAULT));

                //---- cbFre ----
                cbFre.setBorder(BorderFactory.createEmptyBorder());
                cbFre.setMargin(new Insets(0, 0, 0, 0));
                cbFre.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbFreActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbFre, CC.xy(6, 6, CC.CENTER, CC.DEFAULT));

                //---- cbSam ----
                cbSam.setBorder(BorderFactory.createEmptyBorder());
                cbSam.setMargin(new Insets(0, 0, 0, 0));
                cbSam.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbSamActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbSam, CC.xy(7, 6, CC.CENTER, CC.DEFAULT));

                //---- cbSon ----
                cbSon.setBorder(BorderFactory.createEmptyBorder());
                cbSon.setMargin(new Insets(0, 0, 0, 0));
                cbSon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbSonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbSon, CC.xy(8, 6, CC.CENTER, CC.DEFAULT));
            }
            tabWdh.addTab("W\u00f6chentlich", pnlWeekly);

            //======== pnlMonthly ========
            {
                pnlMonthly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.setLayout(
                        new FormLayout("default, $lcgap, pref, $lcgap, 40dlu, $lcgap, pref, $lcgap, 61dlu",
                                "3*(default, $lgap), default"));

                //---- label4 ----
                label4.setText("jeden");
                label4.setFont(new Font("Arial", Font.PLAIN, 14));
                label4.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlMonthly.add(label4, CC.xy(3, 3));

                //---- spinMonat ----
                spinMonat.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(spinMonat, CC.xy(5, 3));

                //---- label6 ----
                label6.setText("Monat");
                label6.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(label6, CC.xy(7, 3));

                //---- btnJedenMonat ----
                btnJedenMonat.setText("Jeden Monat");
                btnJedenMonat.setFont(new Font("Arial", Font.PLAIN, 14));
                btnJedenMonat.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnJedenMonatActionPerformed(e);
                    }
                });
                pnlMonthly.add(btnJedenMonat, CC.xywh(3, 5, 5, 1));

                //---- label5 ----
                label5.setText("jeweils am");
                label5.setFont(new Font("Arial", Font.PLAIN, 14));
                label5.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlMonthly.add(label5, CC.xy(3, 7));

                //---- spinMonatTag ----
                spinMonatTag.setFont(new Font("Arial", Font.PLAIN, 14));
                spinMonatTag.addChangeListener(new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent e) {
                        spinMonatTagStateChanged(e);
                    }
                });
                pnlMonthly.add(spinMonatTag, CC.xy(5, 7));

                //---- cmbTag ----
                cmbTag.setModel(new DefaultComboBoxModel<>(new String[] { "Tag des Monats", "Montag",
                        "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag", "Sonntag" }));
                cmbTag.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(cmbTag, CC.xywh(7, 7, 3, 1));
            }
            tabWdh.addTab("Monatlich", pnlMonthly);
        }
        panelMain.add(tabWdh, CC.xy(3, 7, CC.FILL, CC.FILL));

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

            //---- jLabel13 ----
            jLabel13.setText("Erst einplanen ab dem");
            jLabel13.setFont(new Font("Arial", Font.PLAIN, 14));
            panel2.add(jLabel13, CC.xy(1, 1));

            //---- txtLDate ----
            txtLDate.setFont(new Font("Arial", Font.PLAIN, 14));
            txtLDate.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    txtLDateFocusLost(e);
                }
            });
            panel2.add(txtLDate, CC.xy(3, 1));

            //---- lblMinutes ----
            lblMinutes.setText("text");
            lblMinutes.setFont(new Font("Arial", Font.PLAIN, 14));
            panel2.add(lblMinutes, CC.xy(5, 1));

            //---- txtMinutes ----
            txtMinutes.setFont(new Font("Arial", Font.PLAIN, 14));
            txtMinutes.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    txtMinutesFocusLost(e);
                }
            });
            panel2.add(txtMinutes, CC.xy(7, 1));
        }
        panelMain.add(panel2, CC.xy(3, 9));

        //======== pnlBemerkung ========
        {
            pnlBemerkung.setBorder(new TitledBorder(null, "Kommentar zur Anwendung (Erscheint im DFN)",
                    TitledBorder.LEADING, TitledBorder.DEFAULT_POSITION, new Font("Arial", Font.PLAIN, 14)));
            pnlBemerkung.setLayout(new BoxLayout(pnlBemerkung, BoxLayout.X_AXIS));

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

                //---- txtBemerkung ----
                txtBemerkung.setColumns(20);
                txtBemerkung.setRows(5);
                jScrollPane1.setViewportView(txtBemerkung);
            }
            pnlBemerkung.add(jScrollPane1);
        }
        panelMain.add(pnlBemerkung, CC.xy(3, 11, CC.FILL, CC.FILL));

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSaveActionPerformed(e);
            }
        });
        panelMain.add(btnSave, CC.xy(3, 13, CC.RIGHT, CC.DEFAULT));
    }
    add(panelMain, BorderLayout.CENTER);
}

From source file:visolate.Visolate.java

private Component getZDownMovementPanel() {
    if (myZDownMovementPanel == null) {
        myZDownMovementPanel = new JPanel();
        myZDownMovementPanel.setLayout(new BorderLayout());
        myZDownMovementPanel.add(new JLabel("travel clearance"), BorderLayout.WEST);
        myZDownMovementPanel.setToolTipText(
                "When not cutting, lift the cutter to this above origin, in mm or inch. Decimals in native language (point or comma).");
        final JTextField field = new JTextField(NumberFormat.getInstance().format(gCodeWriter.getZClearance()));
        myZDownMovementPanel.add(field, BorderLayout.CENTER);
        field.addFocusListener(new FocusAdapter() {
            public void focusLost(FocusEvent evt) {
                try {
                    gCodeWriter.setZClearance(NumberFormat.getInstance().parse(field.getText()).doubleValue());
                } catch (ParseException e) {
                }/*www .  j  av  a  2 s  .c  om*/
                field.setText(NumberFormat.getInstance().format(gCodeWriter.getZClearance()));
            }
        });
    }
    return myZDownMovementPanel;
}

From source file:edu.ku.brc.af.ui.db.DatabaseLoginPanel.java

/**
 * Creates the UI for the login and hooks up any listeners.
 * @param isDlg  whether the parent is a dialog (false mean JFrame)
 * @param iconName the icon that will be shown in the panel
 * @param engageUPPrefs whether it should load and save the username password into the prefs
 * @param helpContext the help context to use.
 *///from  w w w  .  j  a v  a2  s  .  co  m
protected void createUI(final boolean isDlg, final String iconName, final String helpContext) {
    final boolean isNotEmbedded = !DBConnection.getInstance().isEmbedded() && !UIRegistry.isMobile();
    final AppPreferences localPrefs = AppPreferences.getLocalPrefs();

    //Font cachedFont = UIManager.getFont("JLabel.font");
    SkinItem skinItem = SkinsMgr.getSkinItem("LoginPanel");
    if (skinItem != null) {
        skinItem.pushFG("Label.foreground");
    }

    if (isNotEmbedded) {
        SpinnerModel portModel = new SpinnerNumberModel(3306, //initial value
                0, //min
                Integer.MAX_VALUE, //max
                1); //step
        portSpinner = new JSpinner(portModel);
        JSpinner.NumberEditor editor = new JSpinner.NumberEditor(portSpinner, "#");
        portSpinner.setEditor(editor);

        portSpinner.addChangeListener(new ChangeListener() {
            @Override
            public void stateChanged(ChangeEvent e) {
                DatabaseDriverInfo drvInfo = dbDrivers.get(dbDriverCBX.getSelectedIndex());
                if (drvInfo != null && isNotEmbedded && portSpinner != null) {
                    drvInfo.setPort((Integer) portSpinner.getValue());
                }
            }
        });
        setControlSize(portSpinner);
    }

    // First create the controls and hook up listeners
    dbPickList = new PropertiesPickListAdapter("login.databases"); //$NON-NLS-1$
    svPickList = new PropertiesPickListAdapter("login.servers"); //$NON-NLS-1$

    username = createTextField(15);
    password = createPasswordField(15);

    FocusAdapter focusAdp = new FocusAdapter() {
        @Override
        public void focusGained(FocusEvent e) {
            super.focusGained(e);

            JTextField tf = (JTextField) e.getSource();
            tf.selectAll();
        }
    };
    username.addFocusListener(focusAdp);
    password.addFocusListener(focusAdp);

    databases = new ValComboBox(dbPickList);
    if (databases.getComboBox() instanceof Java2sAutoComboBox) {
        ((Java2sAutoComboBox) databases.getComboBox()).setCaseSensitive(true);
    }
    servers = new ValComboBox(svPickList);

    dbPickList.setComboBox(databases);
    svPickList.setComboBox(servers);

    setControlSize(password);
    setControlSize(databases);
    setControlSize(servers);

    if (masterUsrPwdProvider != null) {
        editKeyInfoBtn = UIHelper.createI18NButton("CONFIG_MSTR_KEY");
        editKeyInfoBtn.setIcon(IconManager.getIcon("Key", IconManager.IconSize.Std20));
        editKeyInfoBtn.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                if (masterUsrPwdProvider != null && databases != null) {
                    String itemName = null;
                    if (databases.getComboBox().getSelectedItem() instanceof String) {
                        itemName = (String) databases.getComboBox().getSelectedItem();
                    } else {
                        PickListItemIFace pli = (PickListItemIFace) databases.getComboBox().getSelectedItem();
                        if (pli != null && pli.getValue() != null) {
                            itemName = pli.getValue();
                        }
                    }

                    if (itemName != null) {
                        masterUsrPwdProvider.editMasterInfo(username.getText(), itemName, false);
                    }
                }
            }
        });
    }

    rememberUsernameCBX = createCheckBox(getResourceString("rememberuser")); //$NON-NLS-1$
    rememberUsernameCBX.setEnabled(engageUPPrefs);

    statusBar = new JStatusBar();
    statusBar.setErrorIcon(IconManager.getIcon("Error", IconManager.IconSize.Std16)); //$NON-NLS-1$

    cancelBtn = createButton(getResourceString("CANCEL")); //$NON-NLS-1$
    loginBtn = createButton(getResourceString("Login")); //$NON-NLS-1$
    helpBtn = createButton(getResourceString("HELP")); //$NON-NLS-1$

    forwardImgIcon = IconManager.getIcon("Forward"); //$NON-NLS-1$
    downImgIcon = IconManager.getIcon("Down"); //$NON-NLS-1$
    moreBtn = new JCheckBox(getResourceString("LOGIN_DLG_MORE"), forwardImgIcon); // XXX I18N //$NON-NLS-1$
    setControlSize(moreBtn);

    // Extra
    dbDrivers = DatabaseDriverInfo.getDriversList();
    dbDriverCBX = createComboBox(dbDrivers);

    dbDriverCBX.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            updateUIControls();

            DatabaseDriverInfo drvInfo = dbDrivers.get(dbDriverCBX.getSelectedIndex());
            if (drvInfo != null && isNotEmbedded && portSpinner != null) {
                Integer defPort = drvInfo.getPortAsInt();
                int portFromPref = localPrefs.getInt(LOGIN_PORT, defPort);

                portSpinner.setValue(portFromPref);
                drvInfo.setPort(portFromPref);
            }
        }
    });

    if (dbDrivers.size() > 0) {
        if (dbDrivers.size() == 1) {
            dbDriverCBX.setSelectedIndex(0);
            dbDriverCBX.setEnabled(false);

        } else {
            String selectedStr = localPrefs.get("login.dbdriver_selected", "MySQL"); //$NON-NLS-1$ //$NON-NLS-2$
            int inx = Collections.binarySearch(dbDrivers,
                    new DatabaseDriverInfo(selectedStr, null, null, false, null));
            dbDriverCBX.setSelectedIndex(inx > -1 ? inx : -1);
        }

    } else {
        JOptionPane.showConfirmDialog(null, getResourceString("NO_DBDRIVERS"), //$NON-NLS-1$
                getResourceString("NO_DBDRIVERS_TITLE"), JOptionPane.CLOSED_OPTION); //$NON-NLS-1$
        System.exit(1);
    }

    addFocusListenerForTextComp(username);
    addFocusListenerForTextComp(password);

    addKeyListenerFor(username, !isDlg);
    addKeyListenerFor(password, !isDlg);

    addKeyListenerFor(databases.getTextField(), !isDlg);
    addKeyListenerFor(servers.getTextField(), !isDlg);

    if (!isDlg) {
        addKeyListenerFor(loginBtn, true);
    }

    rememberUsernameCBX.setSelected(engageUPPrefs ? localPrefs.getBoolean("login.rememberuser", false) : false); //$NON-NLS-1$

    cancelBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (dbListener != null) {
                dbListener.cancelled();
            }
        }
    });

    loginBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            doLogin();
        }
    });

    HelpMgr.registerComponent(helpBtn, helpContext); //$NON-NLS-1$

    moreBtn.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            if (extraPanel.isVisible()) {
                if (dbDriverCBX.getSelectedIndex() != -1) {
                    extraPanel.setVisible(false);
                    moreBtn.setIcon(forwardImgIcon);
                }

            } else {
                extraPanel.setVisible(true);
                moreBtn.setIcon(downImgIcon);
            }
            if (window != null) {
                window.pack();
            }
        }
    });

    // Ask the PropertiesPickListAdapter to set the index from the prefs
    dbPickList.setSelectedIndex();
    svPickList.setSelectedIndex();

    servers.getTextField().addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            updateUIControls();
        }
    });

    databases.getTextField().addKeyListener(new KeyAdapter() {
        @Override
        public void keyReleased(KeyEvent e) {
            updateUIControls();
        }
    });

    databases.getTextField().addFocusListener(new FocusAdapter() {
        String server = null;

        private String getServerStr() {
            String serverStr = null;
            Object serverObj = servers.getValue();
            if (serverObj != null) {
                serverStr = serverObj.toString();
            }
            return serverStr;
        }

        @Override
        public void focusGained(FocusEvent e) {
            server = getServerStr();
        }

        @Override
        public void focusLost(FocusEvent e) {
            if (server != null) {
                String newVal = getServerStr();
                if (newVal != null && !newVal.equals(server)) {
                    setUsrPwdControlsFromPrefs();
                }
            }
        }
    });

    setUsrPwdControlsFromPrefs();

    // Layout the form

    PanelBuilder formBuilder = new PanelBuilder(new FormLayout("p,3dlu,p:g", "p,2dlu,p,2dlu,p,2dlu,p,2dlu,p")); //$NON-NLS-1$ //$NON-NLS-2$
    CellConstraints cc = new CellConstraints();
    formBuilder.addSeparator(getResourceString("LOGINLABEL"), cc.xywh(1, 1, 3, 1)); //$NON-NLS-1$

    addLine("username", username, formBuilder, cc, 3); //$NON-NLS-1$
    addLine("password", password, formBuilder, cc, 5); //$NON-NLS-1$
    formBuilder.add(moreBtn, cc.xy(3, 7));

    PanelBuilder extraPanelBlder = new PanelBuilder(new FormLayout("p,3dlu,p:g", //$NON-NLS-1$ 
            UIHelper.createDuplicateJGoodiesDef("p", "2dlu", isNotEmbedded ? 9 : 11))); //$NON-NLS-1$ //$NON-NLS-2$

    extraPanel = extraPanelBlder.getPanel();
    extraPanel.setBorder(BorderFactory.createEmptyBorder(2, 2, 4, 2));

    //extraPanelBlder.addSeparator("", cc.xywh(1, 1, 3, 1)); //$NON-NLS-1$
    int y = 1;
    y = addLine(null, rememberUsernameCBX, extraPanelBlder, cc, y);
    y = addLine("databases", databases, extraPanelBlder, cc, y); //$NON-NLS-1$
    y = addLine("servers", servers, extraPanelBlder, cc, y); //$NON-NLS-1$

    y = addLine("driver", dbDriverCBX, extraPanelBlder, cc, y); //$NON-NLS-1$
    if (isNotEmbedded) {
        y = addLine("port", portSpinner, extraPanelBlder, cc, y); //$NON-NLS-1$
    }
    if (editKeyInfoBtn != null) {
        PanelBuilder pb = new PanelBuilder(new FormLayout("p,f:p:g", "p"));
        pb.add(editKeyInfoBtn, cc.xy(1, 1));
        y = addLine(null, pb.getPanel(), extraPanelBlder, cc, y);
        pb.getPanel().setOpaque(false);
    }
    extraPanel.setVisible(false);

    formBuilder.add(extraPanelBlder.getPanel(), cc.xywh(3, 9, 1, 1));

    PanelBuilder outerPanel = new PanelBuilder(new FormLayout("p,3dlu,p:g", "t:p,2dlu,p,2dlu,p"), this); //$NON-NLS-1$ //$NON-NLS-2$
    JLabel icon = StringUtils.isNotEmpty(iconName) ? new JLabel(IconManager.getIcon(iconName)) : null;

    if (icon != null) {
        icon.setBorder(BorderFactory.createEmptyBorder(10, 10, 2, 2));
    }

    formBuilder.getPanel().setBorder(BorderFactory.createEmptyBorder(10, 5, 0, 5));

    if (icon != null) {
        outerPanel.add(icon, cc.xy(1, 1));
    }
    JPanel btnPanel = ButtonBarFactory.buildOKCancelHelpBar(loginBtn, cancelBtn, helpBtn);
    outerPanel.add(formBuilder.getPanel(), cc.xy(3, 1));
    outerPanel.add(btnPanel, cc.xywh(1, 3, 3, 1));
    outerPanel.add(statusBar, cc.xywh(1, 5, 3, 1));

    formBuilder.getPanel().setOpaque(false);
    outerPanel.getPanel().setOpaque(false);
    btnPanel.setOpaque(false);

    updateUIControls();

    if (skinItem != null) {
        skinItem.popFG("Label.foreground");
    }

    if (AppPreferences.getLocalPrefs().getBoolean(expandExtraPanelName, false)) {
        extraPanel.setVisible(true);
        moreBtn.setIcon(downImgIcon);
    }
}

From source file:visolate.Visolate.java

private JPanel getMillingSpeedPanel() {
    if (myMillingSpeedPanel == null) {
        myMillingSpeedPanel = new JPanel();
        myMillingSpeedPanel.setLayout(new BorderLayout());
        myMillingSpeedPanel.add(new JLabel("cutting feedrate"), BorderLayout.WEST);
        myMillingSpeedPanel.setToolTipText("Feedrate during cutting in mm or inch per minute.");
        final JTextField field = new JTextField(
                NumberFormat.getInstance().format(gCodeWriter.getMillingFeedrate()));
        myMillingSpeedPanel.add(field, BorderLayout.CENTER);
        field.addFocusListener(new FocusAdapter() {
            public void focusLost(FocusEvent evt) {
                try {
                    gCodeWriter.setMillingFeedrate(
                            NumberFormat.getInstance().parse(field.getText()).doubleValue());
                } catch (ParseException e) {
                }/*from  w  w  w .  java2  s. c  o m*/
                field.setText(NumberFormat.getInstance().format(gCodeWriter.getMillingFeedrate()));
            }
        });
    }
    return myMillingSpeedPanel;
}

From source file:org.simbrain.plot.projection.ProjectionGui.java

/**
 * Add listeners. The chart listener mainly concerns workspace and gui level
 * stuff. The projector listener concerns the underlying projection model.
 *///from w  ww  .  j  a  va2 s.c  om
private void addListeners() {
    getWorkspaceComponent().getProjectionModel().addListener(new ChartListener() {

        /**
         * Update bottom stats when a data source is added.
         */
        public void dataSourceAdded(int index) {
            update();
            updateCoordinateProjectionComboBoxes();
        }

        /**
         * Update bottom stats when a data source is removed
         */
        public void dataSourceRemoved(int index) {
            update();
            updateCoordinateProjectionComboBoxes();
        }

        /**
         * {@inheritDoc}
         */
        public void chartInitialized(int numSources) {
            update();
        }

    });

    // Listen to events from the underlying projector model.
    // Currently the main action is to just update the labels at the bottom.
    getWorkspaceComponent().getProjectionModel().getProjector().addListener(new ProjectorListener() {

        @Override
        public void projectionMethodChanged() {
            // System.out.println("ProjectionGui: In method changed");
            update();
        }

        @Override
        public void projectorDataChanged() {
            // System.out.println("ProjectionGui: In data changed");
            update();
        }

        @Override
        public void datapointAdded() {
            // System.out.println("ProjectionGui: In data added");
        }

        @Override
        public void projectorColorsChanged() {
            // System.out.println("ProjectionGui: In colors changed");
            getWorkspaceComponent().getProjectionModel().getProjector().resetColors();
            update();
        }

    });

    // Epsilon field should update the model whenever a user clicks out of
    // it.
    sammonStepSize.addFocusListener(new FocusAdapter() {
        @Override
        public void focusLost(FocusEvent e) {
            ProjectionMethod proj = getWorkspaceComponent().getProjector().getProjectionMethod();
            if (proj != null) {
                if (proj instanceof ProjectSammon) {
                    ((ProjectSammon) proj).setEpsilon(Double.parseDouble(sammonStepSize.getText()));
                }
            }
        }
    });

}

From source file:visolate.Visolate.java

private JPanel getPlungeSpeedPanel() {
    if (myPlungeSpeedPanel == null) {
        myPlungeSpeedPanel = new JPanel();
        myPlungeSpeedPanel.setLayout(new BorderLayout());
        myPlungeSpeedPanel.add(new JLabel("plunge feedrate"), BorderLayout.WEST);
        myPlungeSpeedPanel/*from  w ww . jav a  2s  . c o  m*/
                .setToolTipText("Feedrate when moving vertically into the workpiece in mm or inch per minute.");
        final JTextField field = new JTextField(
                NumberFormat.getInstance().format(gCodeWriter.getPlungeFeedrate()));
        myPlungeSpeedPanel.add(field, BorderLayout.CENTER);
        field.addFocusListener(new FocusAdapter() {
            public void focusLost(FocusEvent evt) {
                try {
                    gCodeWriter
                            .setPlungeFeedrate(NumberFormat.getInstance().parse(field.getText()).doubleValue());
                } catch (ParseException e) {
                }
                field.setText(NumberFormat.getInstance().format(gCodeWriter.getPlungeFeedrate()));
            }
        });
    }
    return myPlungeSpeedPanel;
}

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

/**
 * This method is called from within the constructor to
 * initialize the form.//from   w w w .  j av a 2 s. com
 * 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() {
    panelMain = new JPanel();
    splitRegular = new JSplitPane();
    pnlTageszeit = new JPanel();
    lblVeryEarly = new JideLabel();
    lblMorning = new JideLabel();
    lblNoon = new JideLabel();
    lblAfternoon = new JideLabel();
    lblEvening = new JideLabel();
    lblVeryLate = new JideLabel();
    txtVeryEarly = new JTextField();
    txtMorning = new JTextField();
    txtNoon = new JTextField();
    txtAfternoon = new JTextField();
    txtEvening = new JTextField();
    txtVeryLate = new JTextField();
    btnToTime = new JButton();
    pnlUhrzeit = new JPanel();
    lblTimeDose = new JideLabel();
    btnToTimeOfDay = new JButton();
    txtTimeDose = new JTextField();
    cmbUhrzeit = new JComboBox();
    tabWdh = new JideTabbedPane();
    pnlDaily = new JPanel();
    lblEvery1 = new JLabel();
    txtEveryDay = new JTextField();
    lblDays = new JLabel();
    btnEveryDay = new JideButton();
    pnlWeekly = new JPanel();
    panel3 = new JPanel();
    lblEvery2 = new JLabel();
    txtEveryWeek = new JTextField();
    lblWeeksAt = new JLabel();
    btnEveryWeek = new JideButton();
    lblMon = new JideLabel();
    lblTue = new JideLabel();
    lblWed = new JideLabel();
    lblThu = new JideLabel();
    lblFri = new JideLabel();
    lblSat = new JideLabel();
    lblSun = new JideLabel();
    cbMon = new JCheckBox();
    cbTue = new JCheckBox();
    cbWed = new JCheckBox();
    cbThu = new JCheckBox();
    cbFri = new JCheckBox();
    cbSat = new JCheckBox();
    cbSun = new JCheckBox();
    pnlMonthly = new JPanel();
    lblEach = new JLabel();
    txtEveryMonth = new JTextField();
    lblMonth = new JLabel();
    btnEveryMonth = new JideButton();
    lblOnThe = new JLabel();
    txtEveryWDayOfMonth = new JTextField();
    cmbWDay = new JComboBox();
    panel2 = new JPanel();
    lblLDate = new JLabel();
    txtLDate = new JTextField();
    btnSave = new JButton();

    //======== this ========
    setLayout(new BorderLayout());

    //======== panelMain ========
    {
        panelMain.setBorder(new LineBorder(Color.black, 2, true));
        panelMain.addComponentListener(new ComponentAdapter() {
            @Override
            public void componentResized(ComponentEvent e) {
                panelMainComponentResized(e);
            }
        });
        panelMain.setLayout(new FormLayout("$rgap, $lcgap, 223dlu, $lcgap, $rgap",
                "$rgap, 2*($lgap, pref), 2*($lgap, default), $lgap, $rgap"));

        //======== splitRegular ========
        {
            splitRegular.setDividerSize(0);
            splitRegular.setEnabled(false);
            splitRegular.setDividerLocation(300);
            splitRegular.setDoubleBuffered(true);

            //======== pnlTageszeit ========
            {
                pnlTageszeit.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlTageszeit.setBorder(new EtchedBorder());
                pnlTageszeit.setLayout(
                        new FormLayout("6*(28dlu, $lcgap), default", "fill:default, $lgap, fill:default"));

                //---- lblVeryEarly ----
                lblVeryEarly.setText("Nachts, fr\u00fch morgens");
                lblVeryEarly.setOrientation(1);
                lblVeryEarly.setFont(new Font("Arial", Font.PLAIN, 14));
                lblVeryEarly.setClockwise(false);
                lblVeryEarly.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(lblVeryEarly, CC.xy(1, 1));

                //---- lblMorning ----
                lblMorning.setForeground(new Color(0, 0, 204));
                lblMorning.setText("Morgens");
                lblMorning.setOrientation(1);
                lblMorning.setFont(new Font("Arial", Font.PLAIN, 14));
                lblMorning.setClockwise(false);
                lblMorning.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(lblMorning, CC.xy(3, 1));

                //---- lblNoon ----
                lblNoon.setForeground(new Color(255, 102, 0));
                lblNoon.setText("Mittags");
                lblNoon.setOrientation(1);
                lblNoon.setFont(new Font("Arial", Font.PLAIN, 14));
                lblNoon.setClockwise(false);
                lblNoon.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(lblNoon, CC.xy(5, 1));

                //---- lblAfternoon ----
                lblAfternoon.setForeground(new Color(0, 153, 51));
                lblAfternoon.setText("Nachmittag");
                lblAfternoon.setOrientation(1);
                lblAfternoon.setFont(new Font("Arial", Font.PLAIN, 14));
                lblAfternoon.setClockwise(false);
                lblAfternoon.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(lblAfternoon, CC.xy(7, 1));

                //---- lblEvening ----
                lblEvening.setForeground(new Color(255, 0, 51));
                lblEvening.setText("Abends");
                lblEvening.setOrientation(1);
                lblEvening.setFont(new Font("Arial", Font.PLAIN, 14));
                lblEvening.setClockwise(false);
                lblEvening.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(lblEvening, CC.xy(9, 1));

                //---- lblVeryLate ----
                lblVeryLate.setText("Nacht, sp\u00e4t abends");
                lblVeryLate.setOrientation(1);
                lblVeryLate.setFont(new Font("Arial", Font.PLAIN, 14));
                lblVeryLate.setClockwise(false);
                lblVeryLate.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlTageszeit.add(lblVeryLate, CC.xy(11, 1));

                //---- txtVeryEarly ----
                txtVeryEarly.setHorizontalAlignment(SwingConstants.RIGHT);
                txtVeryEarly.setText("0.0");
                txtVeryEarly.setFont(new Font("Arial", Font.PLAIN, 14));
                txtVeryEarly.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtDoubleFocusLost(e);
                    }
                });
                txtVeryEarly.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtActionPerformed(e);
                    }
                });
                pnlTageszeit.add(txtVeryEarly, CC.xy(1, 3));

                //---- txtMorning ----
                txtMorning.setHorizontalAlignment(SwingConstants.RIGHT);
                txtMorning.setText("1.0");
                txtMorning.setFont(new Font("Arial", Font.PLAIN, 14));
                txtMorning.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtDoubleFocusLost(e);
                    }
                });
                txtMorning.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtActionPerformed(e);
                    }
                });
                pnlTageszeit.add(txtMorning, CC.xy(3, 3));

                //---- txtNoon ----
                txtNoon.setHorizontalAlignment(SwingConstants.RIGHT);
                txtNoon.setText("0.0");
                txtNoon.setFont(new Font("Arial", Font.PLAIN, 14));
                txtNoon.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtDoubleFocusLost(e);
                    }
                });
                txtNoon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtActionPerformed(e);
                    }
                });
                pnlTageszeit.add(txtNoon, CC.xy(5, 3));

                //---- txtAfternoon ----
                txtAfternoon.setHorizontalAlignment(SwingConstants.RIGHT);
                txtAfternoon.setText("0.0");
                txtAfternoon.setFont(new Font("Arial", Font.PLAIN, 14));
                txtAfternoon.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtDoubleFocusLost(e);
                    }
                });
                txtAfternoon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtActionPerformed(e);
                    }
                });
                pnlTageszeit.add(txtAfternoon, CC.xy(7, 3));

                //---- txtEvening ----
                txtEvening.setHorizontalAlignment(SwingConstants.RIGHT);
                txtEvening.setText("0.0");
                txtEvening.setFont(new Font("Arial", Font.PLAIN, 14));
                txtEvening.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtDoubleFocusLost(e);
                    }
                });
                txtEvening.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtActionPerformed(e);
                    }
                });
                pnlTageszeit.add(txtEvening, CC.xy(9, 3));

                //---- txtVeryLate ----
                txtVeryLate.setHorizontalAlignment(SwingConstants.RIGHT);
                txtVeryLate.setText("0.0");
                txtVeryLate.setFont(new Font("Arial", Font.PLAIN, 14));
                txtVeryLate.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtDoubleFocusLost(e);
                    }
                });
                txtVeryLate.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        txtActionPerformed(e);
                    }
                });
                pnlTageszeit.add(txtVeryLate, CC.xy(11, 3));

                //---- btnToTime ----
                btnToTime.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/clock.png")));
                btnToTime.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnToTimeActionPerformed(e);
                    }
                });
                pnlTageszeit.add(btnToTime, CC.xy(13, 3));
            }
            splitRegular.setLeftComponent(pnlTageszeit);

            //======== pnlUhrzeit ========
            {
                pnlUhrzeit.setBorder(new EtchedBorder());
                pnlUhrzeit.setLayout(
                        new FormLayout("default, $ugap, 28dlu, $ugap, pref", "default:grow, $rgap, default"));

                //---- lblTimeDose ----
                lblTimeDose.setText("Dosis zur Uhrzeit");
                lblTimeDose.setOrientation(1);
                lblTimeDose.setFont(new Font("Arial", Font.PLAIN, 14));
                lblTimeDose.setClockwise(false);
                lblTimeDose.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlUhrzeit.add(lblTimeDose, CC.xy(3, 1, CC.DEFAULT, CC.BOTTOM));

                //---- btnToTimeOfDay ----
                btnToTimeOfDay
                        .setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/bw/1rightarrow.png")));
                btnToTimeOfDay.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnToTimeOfDayActionPerformed(e);
                    }
                });
                pnlUhrzeit.add(btnToTimeOfDay, CC.xy(1, 3));

                //---- txtTimeDose ----
                txtTimeDose.setHorizontalAlignment(SwingConstants.RIGHT);
                txtTimeDose.setText("0.0");
                txtTimeDose.setFont(new Font("Arial", Font.PLAIN, 14));
                txtTimeDose.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusGained(FocusEvent e) {
                        txtFocusGained(e);
                    }

                    @Override
                    public void focusLost(FocusEvent e) {
                        txtDoubleFocusLost(e);
                    }
                });
                pnlUhrzeit.add(txtTimeDose, CC.xy(3, 3));

                //---- cmbUhrzeit ----
                cmbUhrzeit.addItemListener(new ItemListener() {
                    @Override
                    public void itemStateChanged(ItemEvent e) {
                        cmbUhrzeitItemStateChanged(e);
                    }
                });
                pnlUhrzeit.add(cmbUhrzeit, CC.xy(5, 3));
            }
            splitRegular.setRightComponent(pnlUhrzeit);
        }
        panelMain.add(splitRegular, CC.xy(3, 3));

        //======== tabWdh ========
        {

            //======== pnlDaily ========
            {
                pnlDaily.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.setLayout(new FormLayout("2*(default), $rgap, $lcgap, 40dlu, $rgap, default",
                        "default, $lgap, pref, $lgap, default"));

                //---- lblEvery1 ----
                lblEvery1.setText("alle");
                lblEvery1.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.add(lblEvery1, CC.xy(2, 3));

                //---- txtEveryDay ----
                txtEveryDay.setFont(new Font("Arial", Font.PLAIN, 14));
                txtEveryDay.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusLost(FocusEvent e) {
                        txtEveryDayFocusLost(e);
                    }
                });
                pnlDaily.add(txtEveryDay, CC.xy(5, 3));

                //---- lblDays ----
                lblDays.setText("Tage");
                lblDays.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlDaily.add(lblDays, CC.xy(7, 3));

                //---- btnEveryDay ----
                btnEveryDay.setText("Jeden Tag");
                btnEveryDay.setButtonStyle(3);
                btnEveryDay.setFont(new Font("Arial", Font.BOLD, 14));
                btnEveryDay.setForeground(Color.blue);
                btnEveryDay.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnJedenTagActionPerformed(e);
                    }
                });
                pnlDaily.add(btnEveryDay, CC.xywh(2, 5, 6, 1));
            }
            tabWdh.addTab("T\u00e4glich", pnlDaily);

            //======== pnlWeekly ========
            {
                pnlWeekly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlWeekly.setLayout(new FormLayout("default, 7*(13dlu), $lcgap, default:grow",
                        "$ugap, $lgap, default, $lgap, pref, $lgap, default:grow, $lgap, $rgap"));

                //======== panel3 ========
                {
                    panel3.setLayout(new FormLayout("default, $rgap, 40dlu, $rgap, 2*(default)",
                            "default:grow, $lgap, default"));

                    //---- lblEvery2 ----
                    lblEvery2.setText("alle");
                    lblEvery2.setFont(new Font("Arial", Font.PLAIN, 14));
                    panel3.add(lblEvery2, CC.xy(1, 1));

                    //---- txtEveryWeek ----
                    txtEveryWeek.addFocusListener(new FocusAdapter() {
                        @Override
                        public void focusLost(FocusEvent e) {
                            txtEveryWeekFocusLost(e);
                        }
                    });
                    panel3.add(txtEveryWeek, CC.xy(3, 1));

                    //---- lblWeeksAt ----
                    lblWeeksAt.setText("Wochen am");
                    lblWeeksAt.setFont(new Font("Arial", Font.PLAIN, 14));
                    panel3.add(lblWeeksAt, CC.xy(5, 1));

                    //---- btnEveryWeek ----
                    btnEveryWeek.setText("Jede Woche");
                    btnEveryWeek.setFont(new Font("Arial", Font.BOLD, 14));
                    btnEveryWeek.setButtonStyle(3);
                    btnEveryWeek.setForeground(Color.blue);
                    btnEveryWeek.addActionListener(new ActionListener() {
                        @Override
                        public void actionPerformed(ActionEvent e) {
                            btnJedeWocheActionPerformed(e);
                        }
                    });
                    panel3.add(btnEveryWeek, CC.xywh(1, 3, 5, 1));
                }
                pnlWeekly.add(panel3, CC.xywh(2, 3, 9, 1));

                //---- lblMon ----
                lblMon.setText("montags");
                lblMon.setOrientation(1);
                lblMon.setFont(new Font("Arial", Font.PLAIN, 14));
                lblMon.setClockwise(false);
                lblMon.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblMon, CC.xy(2, 5, CC.CENTER, CC.BOTTOM));

                //---- lblTue ----
                lblTue.setText("dienstags");
                lblTue.setOrientation(1);
                lblTue.setFont(new Font("Arial", Font.PLAIN, 14));
                lblTue.setClockwise(false);
                lblTue.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblTue, CC.xy(3, 5, CC.CENTER, CC.BOTTOM));

                //---- lblWed ----
                lblWed.setText("mittwochs");
                lblWed.setOrientation(1);
                lblWed.setFont(new Font("Arial", Font.PLAIN, 14));
                lblWed.setClockwise(false);
                lblWed.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblWed, CC.xy(4, 5, CC.CENTER, CC.BOTTOM));

                //---- lblThu ----
                lblThu.setText("donnerstags");
                lblThu.setOrientation(1);
                lblThu.setFont(new Font("Arial", Font.PLAIN, 14));
                lblThu.setClockwise(false);
                lblThu.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblThu, CC.xy(5, 5, CC.CENTER, CC.BOTTOM));

                //---- lblFri ----
                lblFri.setText("freitags");
                lblFri.setOrientation(1);
                lblFri.setFont(new Font("Arial", Font.PLAIN, 14));
                lblFri.setClockwise(false);
                lblFri.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblFri, CC.xy(6, 5, CC.CENTER, CC.BOTTOM));

                //---- lblSat ----
                lblSat.setText("samstags");
                lblSat.setOrientation(1);
                lblSat.setFont(new Font("Arial", Font.PLAIN, 14));
                lblSat.setClockwise(false);
                lblSat.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblSat, CC.xy(7, 5, CC.CENTER, CC.BOTTOM));

                //---- lblSun ----
                lblSun.setText("sonntags");
                lblSun.setOrientation(1);
                lblSun.setFont(new Font("Arial", Font.PLAIN, 14));
                lblSun.setClockwise(false);
                lblSun.setHorizontalTextPosition(SwingConstants.LEFT);
                pnlWeekly.add(lblSun, CC.xy(8, 5, CC.CENTER, CC.BOTTOM));

                //---- cbMon ----
                cbMon.setBorder(BorderFactory.createEmptyBorder());
                cbMon.setMargin(new Insets(0, 0, 0, 0));
                cbMon.setSelected(true);
                cbMon.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbMonActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbMon, CC.xy(2, 7, CC.CENTER, CC.DEFAULT));

                //---- cbTue ----
                cbTue.setBorder(BorderFactory.createEmptyBorder());
                cbTue.setMargin(new Insets(0, 0, 0, 0));
                cbTue.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbTueActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbTue, CC.xy(3, 7, CC.CENTER, CC.DEFAULT));

                //---- cbWed ----
                cbWed.setBorder(BorderFactory.createEmptyBorder());
                cbWed.setMargin(new Insets(0, 0, 0, 0));
                cbWed.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbWedActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbWed, CC.xy(4, 7, CC.CENTER, CC.DEFAULT));

                //---- cbThu ----
                cbThu.setBorder(BorderFactory.createEmptyBorder());
                cbThu.setMargin(new Insets(0, 0, 0, 0));
                cbThu.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbThuActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbThu, CC.xy(5, 7, CC.CENTER, CC.DEFAULT));

                //---- cbFri ----
                cbFri.setBorder(BorderFactory.createEmptyBorder());
                cbFri.setMargin(new Insets(0, 0, 0, 0));
                cbFri.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbFriActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbFri, CC.xy(6, 7, CC.CENTER, CC.DEFAULT));

                //---- cbSat ----
                cbSat.setBorder(BorderFactory.createEmptyBorder());
                cbSat.setMargin(new Insets(0, 0, 0, 0));
                cbSat.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbSatActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbSat, CC.xy(7, 7, CC.CENTER, CC.DEFAULT));

                //---- cbSun ----
                cbSun.setBorder(BorderFactory.createEmptyBorder());
                cbSun.setMargin(new Insets(0, 0, 0, 0));
                cbSun.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        cbSunActionPerformed(e);
                    }
                });
                pnlWeekly.add(cbSun, CC.xy(8, 7, CC.CENTER, CC.DEFAULT));
            }
            tabWdh.addTab("W\u00f6chentlich", pnlWeekly);

            //======== pnlMonthly ========
            {
                pnlMonthly.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.setLayout(new FormLayout(
                        "default, $lcgap, pref, $lcgap, 40dlu, $lcgap, pref, $lcgap, 61dlu, $lcgap, default",
                        "2*(default, $lgap), default"));

                //---- lblEach ----
                lblEach.setText("jeden");
                lblEach.setFont(new Font("Arial", Font.PLAIN, 14));
                lblEach.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlMonthly.add(lblEach, CC.xy(3, 3));

                //---- txtEveryMonth ----
                txtEveryMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                txtEveryMonth.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusLost(FocusEvent e) {
                        txtEveryMonthFocusLost(e);
                    }
                });
                pnlMonthly.add(txtEveryMonth, CC.xy(5, 3));

                //---- lblMonth ----
                lblMonth.setText("Monat");
                lblMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(lblMonth, CC.xy(7, 3));

                //---- btnEveryMonth ----
                btnEveryMonth.setText("Jeden Monat");
                btnEveryMonth.setFont(new Font("Arial", Font.BOLD, 14));
                btnEveryMonth.setButtonStyle(3);
                btnEveryMonth.setForeground(Color.blue);
                btnEveryMonth.addActionListener(new ActionListener() {
                    @Override
                    public void actionPerformed(ActionEvent e) {
                        btnJedenMonatActionPerformed(e);
                    }
                });
                pnlMonthly.add(btnEveryMonth, CC.xy(9, 3));

                //---- lblOnThe ----
                lblOnThe.setText("jeweils am");
                lblOnThe.setFont(new Font("Arial", Font.PLAIN, 14));
                lblOnThe.setHorizontalAlignment(SwingConstants.TRAILING);
                pnlMonthly.add(lblOnThe, CC.xy(3, 5));

                //---- txtEveryWDayOfMonth ----
                txtEveryWDayOfMonth.setFont(new Font("Arial", Font.PLAIN, 14));
                txtEveryWDayOfMonth.addFocusListener(new FocusAdapter() {
                    @Override
                    public void focusLost(FocusEvent e) {
                        txtEveryWDayOfMonthFocusLost(e);
                    }
                });
                pnlMonthly.add(txtEveryWDayOfMonth, CC.xy(5, 5));

                //---- cmbWDay ----
                cmbWDay.setFont(new Font("Arial", Font.PLAIN, 14));
                pnlMonthly.add(cmbWDay, CC.xywh(7, 5, 3, 1));
            }
            tabWdh.addTab("Monatlich", pnlMonthly);

        }
        panelMain.add(tabWdh, CC.xy(3, 5, CC.FILL, CC.FILL));

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

            //---- lblLDate ----
            lblLDate.setText("Erst einplanen ab dem ");
            lblLDate.setFont(new Font("Arial", Font.PLAIN, 14));
            panel2.add(lblLDate);

            //---- txtLDate ----
            txtLDate.setFont(new Font("Arial", Font.PLAIN, 14));
            txtLDate.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(FocusEvent e) {
                    txtLDateFocusLost(e);
                }
            });
            panel2.add(txtLDate);
        }
        panelMain.add(panel2, CC.xy(3, 7));

        //---- btnSave ----
        btnSave.setIcon(new ImageIcon(getClass().getResource("/artwork/22x22/apply.png")));
        btnSave.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                btnSaveActionPerformed(e);
            }
        });
        panelMain.add(btnSave, CC.xy(3, 9, CC.RIGHT, CC.DEFAULT));
    }
    add(panelMain, BorderLayout.CENTER);
}

From source file:visolate.Visolate.java

private JPanel getZCuttingHeightPanel() {
    if (myZCuttingHeightPanel == null) {
        myZCuttingHeightPanel = new JPanel();
        myZCuttingHeightPanel.setLayout(new BorderLayout());
        myZCuttingHeightPanel.add(new JLabel("cutting height"), BorderLayout.WEST);
        myZCuttingHeightPanel.setToolTipText(
                "When cutting, the head should have this z-coordinate, in mm or inch. Likely a negative value, decimals in native language (point or comma)");
        myZCuttingHeightPanel.setEnabled(gCodeWriter.getIsAbsolute());
        final JTextField field = new JTextField(
                NumberFormat.getInstance().format(gCodeWriter.getZCuttingHeight()));
        myZCuttingHeightPanel.add(field, BorderLayout.CENTER);
        myZCuttingHeightPanel.addPropertyChangeListener("enabled", new PropertyChangeListener() {
            public void propertyChange(PropertyChangeEvent evt) {
                field.setEnabled(myZCuttingHeightPanel.isEnabled());
            }// w ww .  jav  a2  s  . com
        });
        field.setEnabled(myZCuttingHeightPanel.isEnabled());
        field.addFocusListener(new FocusAdapter() {
            public void focusLost(FocusEvent evt) {
                try {
                    gCodeWriter
                            .setZCuttingHeight(NumberFormat.getInstance().parse(field.getText()).doubleValue());
                } catch (ParseException e) {
                }
                field.setText(NumberFormat.getInstance().format(gCodeWriter.getZCuttingHeight()));
            }
        });
    }
    return myZCuttingHeightPanel;
}