Example usage for javax.swing JCheckBox JCheckBox

List of usage examples for javax.swing JCheckBox JCheckBox

Introduction

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

Prototype

public JCheckBox() 

Source Link

Document

Creates an initially unselected check box button with no text, no icon.

Usage

From source file:net.sf.housekeeper.swing.FoodItemEditorView.java

/**
 * Creates the checkbox for enabling or disabling the setting of an expiry
 * date./*w w  w . ja  v a 2  s  .c o m*/
 * 
 * @return The created checkbox.
 */
private JCheckBox createExpiryEnabledCheckbox() {
    final JCheckBox checkBox = new JCheckBox();
    final String toolTip = LocalisationManager.INSTANCE.getText("gui.foodItemEditor.expiryCheckBoxToolTip");
    checkBox.setToolTipText(toolTip);

    return checkBox;
}

From source file:finale.year.stage.main.Authentification.java

/**
 * This method is called from within the constructor to initialize the form.
 * WARNING: Do NOT modify this code. The content of this method is always
 * regenerated by the Form Editor./*from ww  w. ja  v a 2s. c  o  m*/
 */
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
// Generated using JFormDesigner Evaluation license - unknown
private void initComponents() {
    innerPanel = new JPanel();
    emailField = new JTextField();
    rememberMe = new JCheckBox();
    logInBtn = new JButton();
    passWord = new JPasswordField();
    signUpBtn = new JButton();
    forgotBtn = new JButton();
    userIcon = new JLabel();
    passwordIcon = new JLabel();
    errorStatusBar = new JLabel();

    //======== this ========

    // JFormDesigner evaluation mark
    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),
                    getBorder()));
    addPropertyChangeListener(new java.beans.PropertyChangeListener() {
        public void propertyChange(java.beans.PropertyChangeEvent e) {
            if ("border".equals(e.getPropertyName()))
                throw new RuntimeException();
        }
    });

    setLayout(new GridBagLayout());

    //======== innerPanel ========
    {
        innerPanel.setBorder(new EtchedBorder());

        //---- emailField ----
        emailField.setText("Email");
        emailField.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                emailFieldActionPerformed(e);
            }
        });

        //---- rememberMe ----
        rememberMe.setText("Remember me");
        rememberMe.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                rememberMeActionPerformed(e);
            }
        });

        //---- logInBtn ----
        logInBtn.setText("Log In");
        logInBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                logInBtnActionPerformed(e);
            }
        });

        //---- passWord ----
        passWord.setText("password");

        //---- signUpBtn ----
        signUpBtn.setText("Sign Up");
        signUpBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                signUpBtnActionPerformed(e);
            }
        });

        //---- forgotBtn ----
        forgotBtn.setText("Forgot Password?");
        forgotBtn.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                forgotBtnActionPerformed(e);
            }
        });

        //---- userIcon ----
        userIcon.setIcon(new ImageIcon(getClass().getResource("/Resources/glyphicons_user.png")));

        //---- passwordIcon ----
        passwordIcon.setIcon(new ImageIcon(getClass().getResource("/Resources/glyphicons_lock.png")));

        GroupLayout innerPanelLayout = new GroupLayout(innerPanel);
        innerPanel.setLayout(innerPanelLayout);
        innerPanelLayout.setHorizontalGroup(innerPanelLayout.createParallelGroup().addGroup(innerPanelLayout
                .createSequentialGroup()
                .addGroup(innerPanelLayout.createParallelGroup()
                        .addGroup(innerPanelLayout.createSequentialGroup().addGap(106, 106, 106)
                                .addComponent(forgotBtn))
                        .addGroup(innerPanelLayout.createSequentialGroup().addGap(73, 73, 73)
                                .addGroup(innerPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING)
                                        .addComponent(userIcon, GroupLayout.PREFERRED_SIZE, 45,
                                                GroupLayout.PREFERRED_SIZE)
                                        .addComponent(passwordIcon, GroupLayout.PREFERRED_SIZE, 45,
                                                GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(innerPanelLayout
                                        .createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                                        .addComponent(passWord).addComponent(emailField,
                                                GroupLayout.DEFAULT_SIZE, 318, Short.MAX_VALUE)))
                        .addGroup(innerPanelLayout.createParallelGroup(GroupLayout.Alignment.TRAILING, false)
                                .addGroup(innerPanelLayout.createSequentialGroup().addGap(106, 106, 106)
                                        .addComponent(rememberMe)
                                        .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED,
                                                GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(logInBtn, GroupLayout.PREFERRED_SIZE, 79,
                                                GroupLayout.PREFERRED_SIZE))
                                .addGroup(innerPanelLayout.createSequentialGroup().addGap(375, 375, 375)
                                        .addComponent(signUpBtn, GroupLayout.PREFERRED_SIZE, 79,
                                                GroupLayout.PREFERRED_SIZE)))
                        .addGroup(innerPanelLayout.createSequentialGroup().addGap(218, 218, 218)
                                .addComponent(errorStatusBar)))
                .addContainerGap(100, Short.MAX_VALUE)));
        innerPanelLayout.setVerticalGroup(innerPanelLayout.createParallelGroup().addGroup(innerPanelLayout
                .createSequentialGroup().addContainerGap().addComponent(errorStatusBar).addGap(30, 30, 30)
                .addGroup(innerPanelLayout.createParallelGroup()
                        .addComponent(userIcon, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE)
                        .addComponent(emailField, GroupLayout.PREFERRED_SIZE, 42, GroupLayout.PREFERRED_SIZE))
                .addGap(30, 30, 30)
                .addGroup(innerPanelLayout.createParallelGroup()
                        .addComponent(passwordIcon, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE)
                        .addComponent(passWord, GroupLayout.PREFERRED_SIZE, 38, GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(
                        innerPanelLayout.createParallelGroup(GroupLayout.Alignment.BASELINE)
                                .addComponent(rememberMe, GroupLayout.PREFERRED_SIZE, 59,
                                        GroupLayout.PREFERRED_SIZE)
                                .addComponent(logInBtn))
                .addGap(6, 6, 6).addComponent(forgotBtn).addGap(6, 6, 6).addComponent(signUpBtn)
                .addContainerGap(69, Short.MAX_VALUE)));
    }
    add(innerPanel, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST,
            GridBagConstraints.NONE, new Insets(0, 0, 0, 0), -20, 4));
}

From source file:customize.swing.startMain.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    // Generated using JFormDesigner Evaluation license - unknown
    panel1 = new JPanel();
    JPanel panel2 = new JPanel();
    JScrollPane scrollPane1 = new JScrollPane();
    JPanel panel3 = new JPanel();
    JPanel panel4 = new JPanel();
    JPanel panel5 = new JPanel();
    textField6 = new JTextField();
    JPanel panel6 = new JPanel();
    JLabel label1 = new JLabel();
    JPanel panel7 = new JPanel();
    JLabel label2 = new JLabel();
    JPanel panel8 = new JPanel();
    JLabel label3 = new JLabel();
    JPanel panel9 = new JPanel();
    textField2 = new JTextField();
    ButtonView = new JButton();
    JPanel panel10 = new JPanel();
    textField7 = new JTextField();
    JPanel panel11 = new JPanel();
    textField1 = new JTextField();
    JPanel panel12 = new JPanel();
    JLabel label4 = new JLabel();
    JPanel panel13 = new JPanel();
    CheckBox1 = new JCheckBox();
    CheckBox2 = new JCheckBox();
    JPanel panel14 = new JPanel();
    genButton = new JButton();
    JScrollPane scrollPane2 = new JScrollPane();
    JPanel panel15 = new JPanel();
    JPanel panel16 = new JPanel();
    TextField = new JTextField();
    JPanel panel17 = new JPanel();
    textField3 = new JTextField();
    JPanel panel18 = new JPanel();
    rootTextField = new JTextField();
    JPanel panel19 = new JPanel();
    PasswordField = new JPasswordField();
    JPanel panel20 = new JPanel();
    textField8 = new JTextField();
    JPanel panel21 = new JPanel();
    JLabel label5 = new JLabel();
    JPanel panel22 = new JPanel();
    JLabel label6 = new JLabel();
    JPanel panel23 = new JPanel();
    JLabel label7 = new JLabel();
    JPanel panel24 = new JPanel();
    JLabel label8 = new JLabel();
    JPanel panel25 = new JPanel();
    JLabel label9 = new JLabel();
    JScrollPane scrollPane3 = new JScrollPane();
    jscrollPane1 = new JTextPane();

    //======== panel1 ========
    {//from w  ww . j av  a 2  s .  c  o m

        // JFormDesigner evaluation mark
        panel1.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),
                panel1.getBorder()));
        panel1.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            public void propertyChange(java.beans.PropertyChangeEvent e) {
                if ("border".equals(e.getPropertyName()))
                    throw new RuntimeException();
            }
        });

        panel1.setLayout(new GridLayoutManager(5, 1, new Insets(0, 0, 0, 0), -1, -1));

        //======== panel2 ========
        {
            panel2.setLayout(new GridLayoutManager(1, 3, new Insets(0, 0, 0, 0), -1, -1));

            //======== scrollPane1 ========
            {
                scrollPane1.setBorder(new TitledBorder("\u6587\u4ef6\u751f\u6210\u5730\u5740"));

                //======== panel3 ========
                {
                    panel3.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1));

                    //======== panel4 ========
                    {
                        panel4.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                        //======== panel5 ========
                        {
                            panel5.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                            //---- textField6 ----
                            textField6.setEditable(true);
                            textField6.setEnabled(true);
                            textField6.setText("");
                            textField6.putClientProperty("html.disable", false);
                            panel5.add(textField6,
                                    new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
                                            GridConstraints.FILL_HORIZONTAL,
                                            GridConstraints.SIZEPOLICY_CAN_GROW
                                                    | GridConstraints.SIZEPOLICY_WANT_GROW,
                                            GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                        }
                        panel4.add(panel5, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));
                    }
                    panel3.add(panel4,
                            new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_BOTH,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    null, null, null));

                    //======== panel6 ========
                    {
                        panel6.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                        //---- label1 ----
                        label1.setText("xml\u751f\u6210\u5728\u54ea\u4e2a\u5305\u540d\u4e0b");
                        panel6.add(label1,
                                new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                        GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
                                        GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                    }
                    panel3.add(panel6,
                            new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_BOTH,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    null, null, null));

                    //======== panel7 ========
                    {
                        panel7.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                        //---- label2 ----
                        label2.setText("model\u751f\u6210\u5728\u54ea\u4e2a\u5305\u540d\u4e0b");
                        panel7.add(label2,
                                new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                        GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
                                        GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                    }
                    panel3.add(panel7,
                            new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_BOTH,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    null, null, null));

                    //======== panel8 ========
                    {
                        panel8.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                        //---- label3 ----
                        label3.setText("\u6587\u4ef6\u7edf\u4e00\u751f\u6210\u8def\u5f84");
                        panel8.add(label3,
                                new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                        GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
                                        GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                    }
                    panel3.add(panel8,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_BOTH,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    null, null, null));

                    //======== panel9 ========
                    {
                        panel9.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));
                        panel9.add(textField2,
                                new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
                                        GridConstraints.FILL_HORIZONTAL,
                                        GridConstraints.SIZEPOLICY_CAN_GROW
                                                | GridConstraints.SIZEPOLICY_WANT_GROW,
                                        GridConstraints.SIZEPOLICY_FIXED, null, null, null));

                        //---- ButtonView ----
                        ButtonView.setText("\u6d4f\u89c8");
                        panel9.add(ButtonView,
                                new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
                                        GridConstraints.FILL_HORIZONTAL,
                                        GridConstraints.SIZEPOLICY_CAN_SHRINK
                                                | GridConstraints.SIZEPOLICY_CAN_GROW,
                                        GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                    }
                    panel3.add(panel9,
                            new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_BOTH,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    null, null, null));

                    //======== panel10 ========
                    {
                        panel10.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                        //---- textField7 ----
                        textField7.setEditable(true);
                        textField7.setEnabled(true);
                        textField7.setText("");
                        textField7.putClientProperty("html.disable", true);
                        panel10.add(textField7,
                                new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
                                        GridConstraints.FILL_HORIZONTAL,
                                        GridConstraints.SIZEPOLICY_CAN_GROW
                                                | GridConstraints.SIZEPOLICY_WANT_GROW,
                                        GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                    }
                    panel3.add(panel10,
                            new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_BOTH,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    null, null, null));

                    //======== panel11 ========
                    {
                        panel11.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                        //---- textField1 ----
                        textField1.setEditable(true);
                        textField1.setEnabled(true);
                        textField1.setText("");
                        textField1.putClientProperty("html.disable", true);
                        panel11.add(textField1,
                                new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
                                        GridConstraints.FILL_HORIZONTAL,
                                        GridConstraints.SIZEPOLICY_CAN_GROW
                                                | GridConstraints.SIZEPOLICY_WANT_GROW,
                                        GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                    }
                    panel3.add(panel11,
                            new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_BOTH,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    null, null, null));

                    //======== panel12 ========
                    {
                        panel12.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                        //---- label4 ----
                        label4.setText("dao\u5c42\u751f\u6210\u5728\u54ea\u4e2a\u5305\u540d\u4e0b");
                        panel12.add(label4,
                                new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                        GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
                                        GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                    }
                    panel3.add(panel12,
                            new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_BOTH,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                    null, null, null));
                }
                scrollPane1.setViewportView(panel3);
            }
            panel2.add(scrollPane1,
                    new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW
                                    | GridConstraints.SIZEPOLICY_WANT_GROW,
                            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW
                                    | GridConstraints.SIZEPOLICY_WANT_GROW,
                            null, null, null));
        }
        panel1.add(panel2,
                new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                        GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                        GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                        null));

        //======== panel13 ========
        {
            panel13.setBorder(new TitledBorder("\u53ef\u914d\u7f6e\u9879"));
            panel13.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1));

            //---- CheckBox1 ----
            CheckBox1.setSelected(true);
            CheckBox1.setText("\u662f\u5426\u4e3a\u9a7c\u5cf0\u547d\u540d\u89c4\u8303");
            panel13.add(CheckBox1,
                    new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE,
                            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                            GridConstraints.SIZEPOLICY_FIXED, null, null, null));

            //---- CheckBox2 ----
            CheckBox2.setSelected(true);
            CheckBox2.setText("\u662f\u5426\u751f\u6210\u6ce8\u91ca");
            panel13.add(CheckBox2,
                    new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE,
                            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                            GridConstraints.SIZEPOLICY_FIXED, null, null, null));
        }
        panel1.add(panel13,
                new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                        GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                        GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                        null));

        //======== panel14 ========
        {
            panel14.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

            //---- genButton ----
            genButton.setText("\u751f\u6210");
            panel14.add(genButton,
                    new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                            GridConstraints.FILL_HORIZONTAL,
                            GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                            GridConstraints.SIZEPOLICY_FIXED, null, null, null));
        }
        panel1.add(panel14,
                new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                        GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                        GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null,
                        null));

        //======== scrollPane2 ========
        {
            scrollPane2.setBorder(new TitledBorder("\u5fc5\u586b\u9879"));

            //======== panel15 ========
            {
                panel15.setLayout(new GridLayoutManager(5, 2, new Insets(0, 0, 0, 0), -1, -1));

                //======== panel16 ========
                {
                    panel16.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                    //---- TextField ----
                    TextField.setText("com.mysql.jdbc.Driver");
                    panel16.add(TextField,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
                                    GridConstraints.FILL_HORIZONTAL,
                                    GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
                                    GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                }
                panel15.add(panel16,
                        new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));

                //======== panel17 ========
                {
                    panel17.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                    //---- textField3 ----
                    textField3.setText("jdbc:mysql://192.168.0.13/mvp?characterEncoding=UTF-8");
                    panel17.add(textField3,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
                                    GridConstraints.FILL_HORIZONTAL,
                                    GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
                                    GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                }
                panel15.add(panel17,
                        new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));

                //======== panel18 ========
                {
                    panel18.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                    //---- rootTextField ----
                    rootTextField.setText("root");
                    panel18.add(rootTextField,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
                                    GridConstraints.FILL_HORIZONTAL,
                                    GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
                                    GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                }
                panel15.add(panel18,
                        new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));

                //======== panel19 ========
                {
                    panel19.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                    //---- PasswordField ----
                    PasswordField.setText("elab@123");
                    panel19.add(PasswordField,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
                                    GridConstraints.FILL_HORIZONTAL,
                                    GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
                                    GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                }
                panel15.add(panel19,
                        new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));

                //======== panel20 ========
                {
                    panel20.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                    //---- textField8 ----
                    textField8.setText("");
                    panel20.add(textField8,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST,
                                    GridConstraints.FILL_HORIZONTAL,
                                    GridConstraints.SIZEPOLICY_CAN_GROW | GridConstraints.SIZEPOLICY_WANT_GROW,
                                    GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                }
                panel15.add(panel20,
                        new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));

                //======== panel21 ========
                {
                    panel21.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                    //---- label5 ----
                    label5.setText("\u6570\u636e\u5e93\u9a71\u52a8:");
                    panel21.add(label5,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
                                    GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                }
                panel15.add(panel21,
                        new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));

                //======== panel22 ========
                {
                    panel22.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                    //---- label6 ----
                    label6.setText("\u6570\u636e\u5e93\u8fde\u63a5\u5730\u5740:");
                    panel22.add(label6,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
                                    GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                }
                panel15.add(panel22,
                        new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));

                //======== panel23 ========
                {
                    panel23.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                    //---- label7 ----
                    label7.setText("\u6570\u636e\u5e93\u7528\u6237\u540d:");
                    panel23.add(label7,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
                                    GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                }
                panel15.add(panel23,
                        new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));

                //======== panel24 ========
                {
                    panel24.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                    //---- label8 ----
                    label8.setText("\u6570\u636e\u5e93\u5bc6\u7801:");
                    panel24.add(label8,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
                                    GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                }
                panel15.add(panel24,
                        new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));

                //======== panel25 ========
                {
                    panel25.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1));

                    //---- label9 ----
                    label9.setText("\u8868\u540d(\u53ef\u6a21\u7cca%)");
                    panel25.add(label9,
                            new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                    GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED,
                                    GridConstraints.SIZEPOLICY_FIXED, null, null, null));
                }
                panel15.add(panel25,
                        new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_CENTER,
                                GridConstraints.FILL_BOTH,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW,
                                null, null, null));
            }
            scrollPane2.setViewportView(panel15);
        }
        panel1.add(scrollPane2,
                new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                        GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW
                                | GridConstraints.SIZEPOLICY_WANT_GROW,
                        GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW
                                | GridConstraints.SIZEPOLICY_WANT_GROW,
                        null, null, null));

        //======== scrollPane3 ========
        {
            scrollPane3.setBorder(new TitledBorder("\u6ce8\u610f\u4e8b\u9879"));

            //---- jscrollPane1 ----
            jscrollPane1.setEditable(true);
            jscrollPane1.setEnabled(true);
            jscrollPane1.setText(
                    "\t1.\u8bf7\u4e0d\u8981\u91cd\u590d\u751f\u6210\u540c\u6837\u7684\u6587\u4ef6\u5728\u540c\u4e00\u4e2a\u76ee\u5f55\u5939\u4e0b\u3002");
            scrollPane3.setViewportView(jscrollPane1);
        }
        panel1.add(scrollPane3,
                new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH,
                        GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW
                                | GridConstraints.SIZEPOLICY_WANT_GROW,
                        GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW
                                | GridConstraints.SIZEPOLICY_WANT_GROW,
                        null, null, null));
    }
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:MainProgram.MainProgram.java

private void initComponents() throws InterruptedException {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    welcomeMessage = new JLabel();
    welcomeMessage2 = new JLabel();
    pennIDLabel = new JLabel();
    pennIDTextField = new JTextField();
    pennPassLabel = new JLabel();
    pennPassField = new JPasswordField();
    emailLabel = new JLabel();
    emailTextField = new JTextField();
    emailDomainLabel = new JLabel();
    emailPassLabel = new JLabel();
    emailPassField = new JPasswordField();
    semesterLabel = new JLabel();
    semesterComboBox = new JComboBox(semestersString);
    credentials = new JLabel();
    dropLabel = new JLabel();
    dropCheckBox = new JCheckBox();
    button = new JButton();
    stopWatchLabel = new JLabel();
    checkMail = false;//  w ww  . j av a2s . com
    testConnection = false;

    mailCheckTimeInitializer();
    StopWatchInitializer();
    try {
        setUIFont(new javax.swing.plaf.FontUIResource("Segoe UI", Font.ROMAN_BASELINE, 12));
    } catch (Exception e) {
        e.printStackTrace(MainProgram.errorLog);
    }

    String lcOSName = System.getProperty("os.name").toLowerCase();
    boolean IS_MAC = lcOSName.startsWith("mac os x");
    //======== this ========
    setLayout(new GridBagLayout());
    ((GridBagLayout) getLayout()).columnWidths = new int[] { 81, 5, 119, 5, 0, 0 };
    if (!IS_MAC) {
        ((GridBagLayout) getLayout()).rowHeights = new int[] { 17, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 5, 0, 0, 0,
                0 };
    }
    ((GridBagLayout) getLayout()).rowWeights = new double[] { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
            0.0, 0.0, 0.0, 0.0, 0.0, 1.0E-4 };
    GridBagConstraints constraints = new GridBagConstraints();
    constraints.gridx = 0;
    constraints.gridy = 0;
    constraints.fill = GridBagConstraints.HORIZONTAL;

    //---- welcomeMessage ----
    welcomeMessage.setText("Course Registration");
    welcomeMessage.setHorizontalAlignment(SwingConstants.CENTER);
    add(welcomeMessage, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0, GridBagConstraints.EAST,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- welcomeMessage2 ----
    welcomeMessage2.setText("for Penn State (BETA)");
    welcomeMessage2.setHorizontalAlignment(SwingConstants.CENTER);
    add(welcomeMessage2, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- pennIDLabel ----
    pennIDLabel.setText("Penn State ID: ");
    pennIDLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    add(pennIDLabel, new GridBagConstraints(0, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- pennIDTextField ----
    pennIDTextField.setText("xxx123");
    add(pennIDTextField, new GridBagConstraints(1, 4, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- pennPassLabel ----
    pennPassLabel.setText("Penn State Password: ");
    pennPassLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    add(pennPassLabel, new GridBagConstraints(0, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    add(pennPassField, new GridBagConstraints(1, 6, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- emailLabel ----
    emailLabel.setText("Email: ");
    emailLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    add(emailLabel, new GridBagConstraints(0, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- emailTextField ----
    emailTextField.setText("myEmail");
    add(emailTextField, new GridBagConstraints(1, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- emailDomainLabel ----
    emailDomainLabel.setText("@mail.com");
    add(emailDomainLabel, new GridBagConstraints(2, 8, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));

    //---- emailPassLabel ----
    emailPassLabel.setText("Email Password: ");
    emailPassLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    add(emailPassLabel, new GridBagConstraints(0, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    add(emailPassField, new GridBagConstraints(1, 10, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 0), 0, 0));
    //---- Semester label ----
    semesterLabel.setText("Semester/Drop Option: ");
    semesterLabel.setHorizontalAlignment(SwingConstants.RIGHT);
    add(semesterLabel, new GridBagConstraints(0, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    //---- Semester ComboBox ----
    add(semesterComboBox, new GridBagConstraints(1, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    //---- Drop CheckBox ----
    add(dropCheckBox, new GridBagConstraints(2, 13, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
    //---- button ----
    button.setText("Start");
    add(button, new GridBagConstraints(1, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    //---- stopWatchLabel ----
    stopWatchLabel.setText("  " + stopWatchSplitting[0]);
    stopWatchLabel.setHorizontalAlignment(SwingConstants.LEFT);
    add(stopWatchLabel, new GridBagConstraints(2, 16, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    //---- label11 ----
    credentials.setText(" Created by Daniyar Yeralin");
    credentials.setForeground(Color.gray);
    credentials.setHorizontalAlignment(SwingConstants.RIGHT);
    credentials.setFont(new Font("Cambria", Font.ITALIC, 12));
    add(credentials, new GridBagConstraints(2, 17, 1, 1, 0.0, 0.0, GridBagConstraints.CENTER,
            GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));

    /*button.registerKeyboardAction(button.getActionForKeyStroke(
     KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, false)),
     KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, false),
     JComponent.WHEN_FOCUSED);
            
     button.registerKeyboardAction(button.getActionForKeyStroke(
     KeyStroke.getKeyStroke(KeyEvent.VK_SPACE, 0, true)),
     KeyStroke.getKeyStroke(KeyEvent.VK_ENTER, 0, true),
     JComponent.WHEN_FOCUSED);*/
    StartButtonHandler buttonListener = new StartButtonHandler();
    button.addActionListener(buttonListener);

}

From source file:cool.pandora.modeller.ui.jpanel.iiif.CreateDefaultContainersFrame.java

private JPanel createComponents() {
    final Border border = new EmptyBorder(5, 5, 5, 5);

    final TitlePane titlePane = new TitlePane();
    initStandardCommands();//from   ww  w.jav  a  2s  . c  o  m
    final JPanel pageControl = new JPanel(new BorderLayout());
    final JPanel titlePaneContainer = new JPanel(new BorderLayout());
    titlePane.setTitle(bagView.getPropertyMessage("CreateContainersFrame.title"));
    titlePane.setMessage(
            new DefaultMessage(bagView.getPropertyMessage("Create the default " + "IIIF Containers")));
    titlePaneContainer.add(titlePane.getControl());
    titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH);
    pageControl.add(titlePaneContainer, BorderLayout.NORTH);
    final JPanel contentPane = new JPanel();

    final DefaultBag bag = bagView.getBag();
    if (bag != null) {
        map = bag.getInfo().getFieldMap();
    }

    final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label"));
    urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description"));
    final JTextField urlField = new JTextField("");
    final URI uri = IIIFObjectURI.getObjektURI(map);
    try {
        urlField.setText(uri != null ? uri.toString() : null);
    } catch (Exception e) {
        log.error("Failed to set url label", e);
    }

    final JLabel tagLabel = new JLabel(getMessage("bag.label.hasText"));
    tagLabel.setToolTipText(getMessage("bag.label.hasText.help"));
    hasTextCheckbox = new JCheckBox();
    hasTextCheckbox.setBorder(border);
    hasTextCheckbox.setToolTipText(getMessage("bag.checkbox.hasText.help"));

    hasTextCheckbox.setSelected(bag != null && bag.hasText());
    final GridBagLayout layout = new GridBagLayout();
    final GridBagConstraints glbc = new GridBagConstraints();
    final JPanel panel = new JPanel(layout);
    panel.setBorder(new EmptyBorder(10, 10, 10, 10));

    int row = 0;

    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(urlLabel, glbc);
    panel.add(urlLabel);
    buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(urlField, glbc);
    panel.add(urlField);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    layout.setConstraints(tagLabel, glbc);
    panel.add(tagLabel);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);
    layout.setConstraints(hasTextCheckbox, glbc);
    panel.add(hasTextCheckbox);
    row++;
    buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST);
    buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER);

    GuiStandardUtils.attachDialogBorder(contentPane);
    pageControl.add(panel);
    final JComponent buttonBar = createButtonBar();
    pageControl.add(buttonBar, BorderLayout.SOUTH);

    this.pack();
    return pageControl;

}

From source file:gtu._work.etc._3DSMovieRenamer.java

private void initGUI() {
    try {//from ww w. j  ava  2  s  . c  o  m
        final SwingActionUtil swingUtil = (SwingActionUtil) SwingActionUtil.newInstance(this);

        BorderLayout thisLayout = new BorderLayout();
        getContentPane().setLayout(thisLayout);
        this.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
        this.setTitle("3DS Rename");
        {
            jTabbedPane1 = new JTabbedPane();
            getContentPane().add(jTabbedPane1, BorderLayout.CENTER);
            {
                jPanel1 = new JPanel();
                BorderLayout jPanel1Layout = new BorderLayout();
                jPanel1.setLayout(jPanel1Layout);
                jTabbedPane1.addTab("vid list", null, jPanel1, null);
                {
                    openDir = new JButton();
                    jPanel1.add(openDir, BorderLayout.NORTH);
                    openDir.setText("open dir");
                    openDir.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            swingUtil.invokeAction("openDir.actionPerformed", evt);
                        }
                    });
                }
                {
                    ListModel vidListModel = new DefaultListModel();
                    vidList = new JList();
                    jPanel1.add(vidList, BorderLayout.CENTER);
                    vidList.setModel(vidListModel);
                    vidList.addMouseListener(new MouseAdapter() {
                        public void mouseClicked(MouseEvent evt) {
                            swingUtil.invokeAction("vidList.mouseClicked", evt);
                        }
                    });
                    vidList.addKeyListener(new KeyAdapter() {
                        public void keyPressed(KeyEvent evt) {
                            swingUtil.invokeAction("vidList.keyPressed", evt);
                        }
                    });
                }
                {
                    jPanel3 = new JPanel();
                    jPanel1.add(jPanel3, BorderLayout.SOUTH);
                    jPanel3.setPreferredSize(new java.awt.Dimension(445, 34));
                    {
                        renameText = new JTextField();
                        jPanel3.add(renameText);
                        renameText.setPreferredSize(new java.awt.Dimension(187, 24));
                    }
                    {
                        renameBtn = new JButton();
                        jPanel3.add(renameBtn);
                        renameBtn.setText("rename");
                        renameBtn.setPreferredSize(new java.awt.Dimension(106, 24));
                        renameBtn.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                swingUtil.invokeAction("renameBtn.mouseClicked", evt);
                            }
                        });
                    }
                    {
                        forceChange = new JCheckBox();
                        jPanel3.add(forceChange);
                        forceChange.setText("force");
                        forceChange.setPreferredSize(new java.awt.Dimension(64, 21));
                    }
                }
            }
            {
                jPanel2 = new JPanel();
                BorderLayout jPanel2Layout = new BorderLayout();
                jPanel2.setLayout(jPanel2Layout);
                jTabbedPane1.addTab("copy", null, jPanel2, null);
                {
                    jScrollPane1 = new JScrollPane();
                    jPanel2.add(jScrollPane1, BorderLayout.CENTER);
                    {
                        ListModel copyToListModel = new DefaultListModel();
                        copyToList = new JList();
                        jScrollPane1.setViewportView(copyToList);
                        copyToList.setModel(copyToListModel);
                        copyToList.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                swingUtil.invokeAction("copyToList.mouseClicked", evt);
                            }
                        });
                    }
                }
            }
            {
                jPanel4 = new JPanel();
                BorderLayout jPanel4Layout = new BorderLayout();
                jPanel4.setLayout(jPanel4Layout);
                jTabbedPane1.addTab("BT Movie", null, jPanel4, null);
                {
                    jScrollPane2 = new JScrollPane();
                    jPanel4.add(jScrollPane2, BorderLayout.WEST);
                    jScrollPane2.setPreferredSize(new java.awt.Dimension(254, 355));
                    {
                        btDirTree = new JTree();
                        jScrollPane2.setViewportView(btDirTree);
                        btDirTree.addMouseListener(new MouseAdapter() {
                            public void mouseClicked(MouseEvent evt) {
                                swingUtil.invokeAction(evt);
                            }
                        });
                        btDirTree.addPropertyChangeListener(new PropertyChangeListener() {
                            public void propertyChange(PropertyChangeEvent evt) {
                                swingUtil.invokeAction(evt);
                            }
                        });
                        JTreeUtil.newInstance(btDirTree).fileSystem(DEFAULT_BT_DIR);
                    }
                }
                {
                    jPanel5 = new JPanel();
                    BorderLayout jPanel5Layout = new BorderLayout();
                    jPanel5.setLayout(jPanel5Layout);
                    jPanel4.add(jPanel5, BorderLayout.CENTER);
                    {
                        jScrollPane3 = new JScrollPane();
                        jPanel5.add(jScrollPane3, BorderLayout.CENTER);
                        jScrollPane3.setPreferredSize(new java.awt.Dimension(427, 355));
                        {
                            DefaultListModel btMovListModel = new DefaultListModel();
                            btMovList = new JList();
                            jScrollPane3.setViewportView(btMovList);
                            btMovList.setModel(btMovListModel);
                            btMovList.addMouseListener(new MouseAdapter() {
                                public void mouseClicked(MouseEvent evt) {
                                    swingUtil.invokeAction(evt);
                                }
                            });
                            btMovList.addKeyListener(new KeyAdapter() {
                                public void keyPressed(KeyEvent evt) {
                                    JListUtil.newInstance(btMovList).defaultJListKeyPressed(evt);
                                }
                            });
                        }
                    }
                }
            }
            {
                jPanel6 = new JPanel();
                FlowLayout jPanel6Layout = new FlowLayout();
                jTabbedPane1.addTab("common", null, jPanel6, null);
                jPanel6.setLayout(jPanel6Layout);
                {
                    execute3dsVidTransfer = new JButton();
                    jPanel6.add(execute3dsVidTransfer);
                    execute3dsVidTransfer.setText("execute 3ds video transfer");
                    execute3dsVidTransfer.setPreferredSize(new java.awt.Dimension(207, 42));
                    execute3dsVidTransfer.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            String bat = "C:/apps/_movie/3DSVideov1.00/3DS Video.exe";
                            try {
                                Runtime.getRuntime().exec(String.format("cmd /c call \"%s\"", bat));
                            } catch (IOException e) {
                                JCommonUtil.handleException(e);
                            }
                        }
                    });
                }
                {
                    openMovieAppDir = new JButton();
                    jPanel6.add(openMovieAppDir);
                    openMovieAppDir.setText("open movie app dir");
                    openMovieAppDir.setPreferredSize(new java.awt.Dimension(207, 42));
                    openMovieAppDir.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            try {
                                Desktop.getDesktop().open(new File("C:/apps/_movie"));
                            } catch (IOException e) {
                                JCommonUtil.handleException(e);
                            }
                        }
                    });
                }
            }
            {
                jPanel7 = new JPanel();
                BorderLayout jPanel7Layout = new BorderLayout();
                jTabbedPane1.addTab("fake rename", null, jPanel7, null);
                jPanel7.setLayout(jPanel7Layout);
                {
                    openFakeRenameDir = new JButton();
                    jPanel7.add(openFakeRenameDir, BorderLayout.NORTH);
                    openFakeRenameDir.setText("open dir");
                    openFakeRenameDir.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent evt) {
                            File file = JCommonUtil._jFileChooser_selectDirectoryOnly();
                            if (file != null) {
                                DefaultListModel model = new DefaultListModel();
                                for (File f : file.listFiles()) {
                                    model.addElement(f);
                                }
                                openFakeRenameDirList.setModel(model);
                            }
                        }
                    });
                }
                {
                    DefaultListModel openFakeRenameDirListModel = new DefaultListModel();
                    openFakeRenameDirList = new JList();
                    jPanel7.add(openFakeRenameDirList, BorderLayout.CENTER);
                    openFakeRenameDirList.setModel(openFakeRenameDirListModel);
                    openFakeRenameDirList.addMouseListener(new MouseAdapter() {
                        public void mouseClicked(MouseEvent evt) {
                            File file = (File) JListUtil.getLeadSelectionObject(openFakeRenameDirList);
                            try {
                                Process process = Runtime.getRuntime()
                                        .exec(String.format("cmd /c call \"%s\"", file));
                                InputStream ins = process.getInputStream();
                                while (ins.read() != -1) {
                                    //TODO
                                }
                                ins.close();
                                System.out.println("done...");
                            } catch (IOException e) {
                                e.printStackTrace();
                            }
                        }
                    });
                    openFakeRenameDirList.addKeyListener(new KeyAdapter() {
                        public void keyPressed(KeyEvent evt) {
                            JListUtil.newInstance(openFakeRenameDirList).defaultJListKeyPressed(evt);
                        }
                    });
                }
                {
                    jPanel8 = new JPanel();
                    jPanel7.add(jPanel8, BorderLayout.SOUTH);
                    jPanel8.setPreferredSize(new java.awt.Dimension(681, 43));
                    {
                        openFakeRenameDir_newName = new JTextField();
                        jPanel8.add(openFakeRenameDir_newName);
                        openFakeRenameDir_newName.setPreferredSize(new java.awt.Dimension(287, 27));
                    }
                    {
                        fakeRenameExecute = new JButton();
                        jPanel8.add(fakeRenameExecute);
                        fakeRenameExecute.setText("execute");
                        fakeRenameExecute.setPreferredSize(new java.awt.Dimension(95, 27));
                        fakeRenameExecute.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent evt) {
                                DefaultListModel model = (DefaultListModel) openFakeRenameDirList.getModel();
                                //TODO
                            }
                        });
                    }
                }
            }

            swingUtil.addAction("copyToList.mouseClicked", new Action() {
                public void action(EventObject evt) throws Exception {
                    try {
                        if (((MouseEvent) evt).getButton() == 3) {
                            JMenuItem reloadMenu = new JMenuItem();
                            reloadMenu.setText("reload SD card directory");
                            reloadMenu.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent e) {
                                    DefaultListModel copyToListModel = new DefaultListModel();
                                    for (final File f : load3DSDir.listFiles(new FilenameFilter() {
                                        public boolean accept(File paramFile, String paramString) {
                                            if (paramFile.isDirectory()
                                                    && paramString.matches(CUSTOM_3DS_DIR_PATTERN)) {
                                                return true;
                                            }
                                            return false;
                                        }
                                    })) {
                                        copyToListModel.addElement(f);
                                    }
                                    copyToList.setModel(copyToListModel);
                                }
                            });
                            JMenuItem copyAllToMenu = new JMenuItem();
                            {
                                copyAllToMenu.setText(
                                        String.format("move %d vids to...", vidList.getModel().getSize()));
                                final File toDir = (File) JListUtil.getLeadSelectionObject(copyToList);
                                if (toDir == null || !toDir.exists() || !toDir.isDirectory()) {
                                    copyAllToMenu.setEnabled(false);
                                }
                                if (vidList.getModel().getSize() == 0) {
                                    copyAllToMenu.setText("copy no file...");
                                    copyAllToMenu.setEnabled(false);
                                }
                                copyAllToMenu.addActionListener(new ActionListener() {
                                    public void actionPerformed(ActionEvent e) {
                                        DefaultListModel model = JListUtil.newInstance(vidList).getModel();
                                        if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION != JOptionPaneUtil
                                                .newInstance().iconWaringMessage().confirmButtonYesNo()
                                                .showConfirmDialog("are you sure copy files : "
                                                        + model.getSize() + "\n to dir : " + toDir,
                                                        "COPY VIDS")) {
                                            return;
                                        }
                                        for (int ii = 0; ii < model.getSize(); ii++) {
                                            File src = (File) model.getElementAt(ii);
                                            src.renameTo(new File(toDir, src.getName()));
                                        }
                                        JOptionPaneUtil.newInstance().iconInformationMessage()
                                                .showMessageDialog("copy completed!", "SUCCESS");
                                        loadDirVids();
                                    }
                                });
                            }

                            JPopupMenuUtil.newInstance(copyToList).applyEvent((MouseEvent) evt)
                                    .addJMenuItem(reloadMenu, copyAllToMenu).show();
                        }
                    } catch (Exception ex) {
                        JCommonUtil.handleException(ex);
                    }
                }
            });
            swingUtil.addAction("openDir.actionPerformed", new Action() {
                public void action(EventObject evt) throws Exception {
                    File file = JFileChooserUtil.newInstance().selectDirectoryOnly().showOpenDialog()
                            .getApproveSelectedFile();
                    if (file == null) {
                        JOptionPaneUtil.newInstance().iconErrorMessage()
                                .showMessageDialog("dir not corrent!, set desktop", getTitle());
                        loadDir = FileUtil.DESKTOP_DIR;
                    } else {
                        loadDir = file;
                    }
                    loadDirVids();
                }
            });
            swingUtil.addAction("vidList.mouseClicked", new Action() {
                //                    final String player = "C:/Program Files (x86)/GRETECH/GomPlayer/GOM.EXE";

                public void action(EventObject evt) throws Exception {
                    int pos = -1;
                    if ((pos = vidList.getLeadSelectionIndex()) == -1) {
                        return;
                    }
                    MouseEvent mevt = (MouseEvent) evt;

                    final File selectItem = (File) vidList.getModel().getElementAt(pos);

                    List<JMenuItem> menuList = new ArrayList<JMenuItem>();
                    JMenuItem simpleRenamer = new JMenuItem();
                    final String simpleRenamePrefix = RandomUtil.upperCase(3);
                    simpleRenamer.setText("Rename : " + simpleRenamePrefix);
                    simpleRenamer.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent paramActionEvent) {
                            String value = StringUtils.defaultString(JOptionPaneUtil.newInstance()
                                    .showInputDialog("3 char prefix?", "AVI PREFIX"), simpleRenamePrefix);
                            if (value != null && value.matches("[a-zA-Z]{3}")) {
                                selectItem.renameTo(getNewFile(selectItem.getParentFile(), value));
                                loadDirVids();
                            } else {
                                JOptionPaneUtil.newInstance().iconErrorMessage()
                                        .showMessageDialog("prefix is not correct!", "ERROR");
                            }
                        }
                    });
                    menuList.add(simpleRenamer);
                    if (load3DSDir == null) {
                        reload3DSDir();
                        if (load3DSDir == null) {
                            JMenuItem disable = new JMenuItem();
                            disable.setText("MOVE : SD card is not set!");
                            disable.setEnabled(false);
                            menuList.add(disable);
                        }
                    } else {
                        for (final File f : load3DSDir.listFiles(new FilenameFilter() {
                            public boolean accept(File paramFile, String paramString) {
                                if (paramFile.isDirectory() && paramString.matches(CUSTOM_3DS_DIR_PATTERN)) {
                                    return true;
                                }
                                return false;
                            }
                        })) {
                            JMenuItem copyTo = new JMenuItem();
                            copyTo.setText("MOVE : " + f.getName());
                            copyTo.addActionListener(new ActionListener() {
                                public void actionPerformed(ActionEvent paramActionEvent) {
                                    if (JOptionPaneUtil.ComfirmDialogResult.YES_OK_OPTION == JOptionPaneUtil
                                            .newInstance().iconQuestionMessage().confirmButtonYesNo()
                                            .showConfirmDialog(//
                                                    "are you sure move file\n" + //
                                    selectItem + "\n" + //
                                    "to\n" + //
                                    "dir : " + f + "  ??"//
                                    , "COPY FILE")) {

                                        File copyToNewDirFile = new File(f, selectItem.getName());
                                        if (copyToNewDirFile.exists()) {
                                            JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog(
                                                    "target dir file already exist!, need rename!",
                                                    "FILE ALREADY EXIST");
                                            return;
                                        }
                                        selectItem.renameTo(copyToNewDirFile);
                                        loadDirVids();

                                        JOptionPaneUtil.newInstance().iconErrorMessage()
                                                .showMessageDialog("move completed!", "MOVE FILE");
                                    }
                                }
                            });
                            menuList.add(copyTo);
                        }
                    }
                    JPopupMenuUtil.newInstance(vidList).applyEvent(mevt)
                            .addJMenuItem(menuList.toArray(new JMenuItem[menuList.size()])).show();

                    if (mevt.getClickCount() != 2) {
                        return;
                    }
                    String clkItemPath = selectItem.getAbsolutePath();
                    String command = "cmd /c call \"" + clkItemPath + "\"";
                    System.out.println(command);
                    Runtime.getRuntime().exec(command);
                }
            });
            swingUtil.addAction("vidList.keyPressed", new Action() {
                public void action(EventObject evt) throws Exception {
                    JListUtil.newInstance(vidList).defaultJListKeyPressed(evt);
                }
            });
            swingUtil.addAction("renameBtn.mouseClicked", new Action() {

                Pattern aviNamePattern = Pattern.compile("^([a-zA-Z]{3})_\\d{4}\\.[aA][vV][iI]$");

                public void action(EventObject evt) throws Exception {
                    String name = StringUtils.defaultIfEmpty(renameText.getText(), RandomUtil.upperCase(3));
                    System.out.println("name = " + name + ", force : " + forceChange.isSelected());
                    if (!name.matches("[a-zA-Z]{3}")) {
                        renameText.setText("");
                        JOptionPaneUtil.newInstance().iconErrorMessage()
                                .showMessageDialog("rename must eng 3 char!", "ERROR");
                        return;
                    }
                    DefaultListModel model = (DefaultListModel) vidList.getModel();
                    boolean matchOk = false;
                    if (model.size() != 0) {
                        File oldFile = null;
                        Matcher matcher = null;
                        for (int ii = 0; ii < model.getSize(); ii++) {
                            oldFile = (File) model.getElementAt(ii);

                            if (!oldFile.exists()) {
                                JOptionPaneUtil.newInstance().iconErrorMessage().showMessageDialog(
                                        "file not exeist : \n" + oldFile.getAbsolutePath(), getTitle());
                                return;
                            }
                            matcher = aviNamePattern.matcher(oldFile.getName());
                            matchOk = matcher.find();
                            System.out.println("matchOk = " + matchOk);
                            if (matchOk && !forceChange.isSelected()) {
                                oldFile.renameTo(getNewFile(oldFile.getParentFile(), matcher.group(1)));
                            } else {
                                oldFile.renameTo(getNewFile(oldFile.getParentFile(), name));
                            }
                        }
                        JOptionPaneUtil.newInstance().iconInformationMessage().showMessageDialog("success!",
                                getTitle());
                    }
                    loadDirVids();
                }
            });

            ToolTipManager.sharedInstance().setInitialDelay(0);
            swingUtil.addAction(btMovList, MouseEvent.class, new Action() {
                public void action(EventObject evt) throws Exception {
                    final File file = (File) JListUtil.getLeadSelectionObject(btMovList);
                    if (JMouseEventUtil.buttonLeftClick(1, evt)) {
                        btMovList.setToolTipText(
                                DateFormatUtils.format(file.lastModified(), "yyyy/MM/dd HH:mm:ss") + " length:"
                                        + (file.length() / 1024) + "k");
                    }

                    final Object[] objects = btMovList.getSelectedValues();
                    JPopupMenuUtil.newInstance(btMovList).applyEvent(evt)//
                            .addJMenuItem("move out", (objects != null && objects.length > 0),
                                    new ActionListener() {
                                        public void actionPerformed(ActionEvent paramActionEvent) {
                                            List<File> list = new ArrayList<File>();
                                            for (Object val : objects) {
                                                list.add((File) val);
                                            }
                                            if (!JCommonUtil._JOptionPane_showConfirmDialog_yesNoOption(
                                                    "sure move file from\n" + list.toString().replace(',', '\n')
                                                            + "\nto\n" + DEFAULT_BT_DIR,
                                                    "MOVE")) {
                                                return;
                                            }
                                            StringBuilder sb = new StringBuilder();
                                            File moveTo = null;
                                            for (File file : list) {
                                                sb.append((file.renameTo(
                                                        moveTo = new File(DEFAULT_BT_DIR, file.getName()))
                                                        && moveTo.exists()) ? "" : file + "\n");
                                            }
                                            JCommonUtil._jOptionPane_showMessageDialog_info(
                                                    sb.length() == 0 ? "move success!" : "move failed!\n" + sb);
                                        }
                                    })
                            .addJMenuItem("delete this", file.exists(), new ActionListener() {
                                public void actionPerformed(ActionEvent paramActionEvent) {
                                    if (!JCommonUtil._JOptionPane_showConfirmDialog_yesNoOption(
                                            "sure delete file \n" + file, "DELETE")) {
                                        return;
                                    }
                                    boolean result = file.delete();
                                    System.out.println("!!!!!" + result + "..." + file.exists());
                                    JCommonUtil._jOptionPane_showMessageDialog_info(
                                            result ? "delete success!" : "delete failed!");
                                }
                            }).show();

                    if (JMouseEventUtil.buttonLeftClick(2, evt)) {
                        Runtime.getRuntime().exec(String.format("cmd /c call \"%s\"", file));
                    }
                }
            });
            swingUtil.addAction(btDirTree, MouseEvent.class, new Action() {

                File getSingleFile() {
                    return ((JFile) JTreeUtil.newInstance(btDirTree).getSelectItem().getUserObject()).getFile();
                }

                public void action(EventObject evt) throws Exception {
                    int selectCount = btDirTree.getSelectionModel().getSelectionCount();
                    if (selectCount == 1) {
                        final File file = getSingleFile();
                        JPopupMenuUtil.newInstance(btDirTree).applyEvent(evt).addJMenuItem("delete this",
                                selectCount == 1 && file.exists(), new ActionListener() {
                                    public void actionPerformed(ActionEvent paramActionEvent) {
                                        if (file.isFile()) {
                                            if (JCommonUtil._JOptionPane_showConfirmDialog_yesNoOption(
                                                    "sure delete FILE : \n" + file, "WARNING")) {
                                                file.delete();
                                                JCommonUtil._jOptionPane_showMessageDialog_info(
                                                        (file.exists() ? "delete failed!" : "delete success!"));
                                            }
                                        }
                                        if (file.isDirectory()) {
                                            StringBuilder sb = new StringBuilder();
                                            if (JCommonUtil._JOptionPane_showConfirmDialog_yesNoOption(
                                                    "sure delete DIR : \n" + file, "WARNING")) {
                                                List<Boolean> delL = new ArrayList<Boolean>();
                                                for (File f : file.listFiles()) {
                                                    if (fileExtensionPattern.matcher(f.getName()).find()
                                                            || f.length() > 1000000L) {
                                                        if (!JCommonUtil
                                                                ._JOptionPane_showConfirmDialog_yesNoOption(
                                                                        "delete this : \n" + f,
                                                                        "CHECK AGAIN")) {
                                                            continue;
                                                        }
                                                        delL.add(f.delete());
                                                    }
                                                    delL.add(f.delete());
                                                }
                                                for (File f : file.listFiles()) {
                                                    if (f.exists()) {
                                                        sb.append(f + "\n");
                                                    }
                                                }
                                                System.out.println("delL.contains(false)==================>"
                                                        + delL.contains(false));
                                            }
                                            if (!file.delete()) {
                                                sb.append(file + "\n");
                                            }
                                            JCommonUtil._jOptionPane_showMessageDialog_info(
                                                    sb.length() > 0 ? "delete failed!\nlist:\n" + sb
                                                            : "delete success!");
                                            if (sb.length() == 0) {
                                                DefaultMutableTreeNode node = JTreeUtil.newInstance(btDirTree)
                                                        .getSelectItem();
                                                System.out.println(
                                                        JTreeUtil.newInstance(btDirTree).removeNode(node));
                                            }
                                        }
                                    }
                                }).addJMenuItem("open dir", new ActionListener() {
                                    public void actionPerformed(ActionEvent paramActionEvent) {
                                        File openTarget = file;
                                        if (file.isFile()) {
                                            openTarget = file.getParentFile();
                                        }
                                        try {
                                            Desktop.getDesktop().open(openTarget);
                                        } catch (IOException e) {
                                            JCommonUtil.handleException(e);
                                        }
                                    }
                                }).show();
                    }
                }
            });
            swingUtil.addAction(btDirTree, PropertyChangeEvent.class, new Action() {
                public void action(EventObject evt) throws Exception {
                    List<File> list = new ArrayList<File>();
                    for (DefaultMutableTreeNode node : JTreeUtil.newInstance(btDirTree).getSelectItems()) {
                        JFile jfile = (JFile) node.getUserObject();
                        if (jfile.getFile().isDirectory()) {
                            for (File f : jfile.getFile().listFiles(new FilenameFilter() {
                                public boolean accept(File paramFile, String paramString) {
                                    return fileExtensionPattern.matcher(paramString).find();
                                }
                            })) {
                                System.out.println(f.getName() + "...." + f.length());
                                list.add(f);
                            }
                        }
                    }
                    Collections.sort(list, new Comparator<File>() {
                        public int compare(File paramT1, File paramT2) {
                            return paramT1.lastModified() > paramT2.lastModified() ? -1 : 1;
                        }
                    });
                    btMovList.setModel(JListUtil.createModel(list.iterator()));
                }
            });
        }
        this.setSize(702, 422);

        loadDirVids();
        reload3DSDir();
    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:com.tiempometa.muestradatos.JReadTags.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY
    // //GEN-BEGIN:initComponents
    ResourceBundle bundle = ResourceBundle.getBundle("com.tiempometa.muestradatos.muestradatos");
    dialogPane = new JPanel();
    contentPanel = new JPanel();
    label2 = new JLabel();
    nextBibTextField = new JTextField();
    statusLabel = new JLabel();
    startReadingButton = new JButton();
    bibLabel = new JLabel();
    scrollPane1 = new JScrollPane();
    tagReadTable = new JTable();
    label3 = new JLabel();
    tidTextField = new JTextField();
    deleteSelectedButton = new JButton();
    label4 = new JLabel();
    epcTextField = new JTextField();
    deleteReadButton = new JButton();
    label1 = new JLabel();
    dataToStoreComboBox = new JComboBox<>();
    deleteAllButton = new JButton();
    allowDuplicateBibsCheckBox = new JCheckBox();
    buttonBar = new JPanel();
    closeButton = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setTitle(bundle.getString("JReadTags.this.title"));
    setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
    setResizable(false);/* www.j ava 2  s .com*/
    setIconImage(
            new ImageIcon(getClass().getResource("/com/tiempometa/resources/tiempometa_icon_large_alpha.png"))
                    .getImage());
    Container contentPane = getContentPane();
    contentPane.setLayout(new BorderLayout());

    //======== dialogPane ========
    {
        dialogPane.setBorder(Borders.DIALOG_BORDER);
        dialogPane.setLayout(new BorderLayout());

        //======== contentPanel ========
        {
            contentPanel.setLayout(new FormLayout(
                    new ColumnSpec[] { new ColumnSpec(Sizes.dluX(15)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(52)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(138)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(71)), FormFactory.LABEL_COMPONENT_GAP_COLSPEC,
                            new ColumnSpec(Sizes.dluX(155)) },
                    new RowSpec[] { new RowSpec(Sizes.dluY(17)), FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(20)), FormFactory.LINE_GAP_ROWSPEC,
                            new RowSpec(Sizes.dluY(25)), FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC, FormFactory.LINE_GAP_ROWSPEC,
                            FormFactory.DEFAULT_ROWSPEC }));

            //---- label2 ----
            label2.setText(bundle.getString("JReadTags.label2.text"));
            label2.setFont(new Font("Tahoma", Font.PLAIN, 36));
            contentPanel.add(label2, cc.xywh(3, 5, 3, 1));

            //---- nextBibTextField ----
            nextBibTextField.setFont(new Font("Tahoma", Font.PLAIN, 36));
            nextBibTextField.setHorizontalAlignment(SwingConstants.RIGHT);
            nextBibTextField.setText(bundle.getString("JReadTags.nextBibTextField.text"));
            contentPanel.add(nextBibTextField, cc.xy(7, 5));

            //---- statusLabel ----
            statusLabel.setText(bundle.getString("JReadTags.statusLabel.text"));
            statusLabel.setHorizontalAlignment(SwingConstants.CENTER);
            statusLabel.setBackground(Color.yellow);
            statusLabel.setOpaque(true);
            statusLabel.setFont(new Font("Tahoma", Font.BOLD, 20));
            contentPanel.add(statusLabel, cc.xywh(9, 3, 1, 5));

            //---- startReadingButton ----
            startReadingButton.setText(bundle.getString("JReadTags.startReadingButton.text"));
            startReadingButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            startReadingButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    startReadingButtonActionPerformed(e);
                }
            });
            contentPanel.add(startReadingButton, cc.xywh(3, 7, 3, 1));

            //---- bibLabel ----
            bibLabel.setForeground(Color.red);
            bibLabel.setFont(new Font("Tahoma", Font.BOLD, 36));
            bibLabel.setHorizontalAlignment(SwingConstants.CENTER);
            contentPanel.add(bibLabel, cc.xy(9, 9));

            //======== scrollPane1 ========
            {
                scrollPane1.setViewportView(tagReadTable);
            }
            contentPanel.add(scrollPane1, cc.xywh(3, 11, 7, 1));

            //---- label3 ----
            label3.setText(bundle.getString("JReadTags.label3.text"));
            label3.setHorizontalAlignment(SwingConstants.RIGHT);
            label3.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label3, cc.xy(3, 13));

            //---- tidTextField ----
            tidTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(tidTextField, cc.xy(5, 13));

            //---- deleteSelectedButton ----
            deleteSelectedButton.setText(bundle.getString("JReadTags.deleteSelectedButton.text"));
            deleteSelectedButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            deleteSelectedButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    deleteSelectedButtonActionPerformed(e);
                }
            });
            contentPanel.add(deleteSelectedButton, cc.xy(9, 13));

            //---- label4 ----
            label4.setText(bundle.getString("JReadTags.label4.text"));
            label4.setHorizontalAlignment(SwingConstants.RIGHT);
            label4.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label4, cc.xy(3, 15));

            //---- epcTextField ----
            epcTextField.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(epcTextField, cc.xy(5, 15));

            //---- deleteReadButton ----
            deleteReadButton.setText(bundle.getString("JReadTags.deleteReadButton.text"));
            deleteReadButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            deleteReadButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    deleteReadButtonActionPerformed(e);
                }
            });
            contentPanel.add(deleteReadButton, cc.xy(9, 15));

            //---- label1 ----
            label1.setText(bundle.getString("JReadTags.label1.text"));
            label1.setHorizontalAlignment(SwingConstants.RIGHT);
            label1.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(label1, cc.xy(3, 17));

            //---- dataToStoreComboBox ----
            dataToStoreComboBox.setModel(new DefaultComboBoxModel<>(new String[] { "EPC", "TID" }));
            dataToStoreComboBox.setFont(new Font("Tahoma", Font.PLAIN, 14));
            contentPanel.add(dataToStoreComboBox, cc.xy(5, 17));

            //---- deleteAllButton ----
            deleteAllButton.setText(bundle.getString("JReadTags.deleteAllButton.text"));
            deleteAllButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            deleteAllButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    deleteAllButtonActionPerformed(e);
                }
            });
            contentPanel.add(deleteAllButton, cc.xy(9, 17));

            //---- allowDuplicateBibsCheckBox ----
            allowDuplicateBibsCheckBox.setText(bundle.getString("JReadTags.allowDuplicateBibsCheckBox.text"));
            contentPanel.add(allowDuplicateBibsCheckBox, cc.xy(5, 19));
        }
        dialogPane.add(contentPanel, BorderLayout.CENTER);

        //======== buttonBar ========
        {
            buttonBar.setBorder(Borders.BUTTON_BAR_GAP_BORDER);
            buttonBar.setLayout(
                    new FormLayout(new ColumnSpec[] { FormFactory.GLUE_COLSPEC, FormFactory.BUTTON_COLSPEC },
                            RowSpec.decodeSpecs("pref")));

            //---- closeButton ----
            closeButton.setText("Cerrar");
            closeButton.setFont(new Font("Tahoma", Font.PLAIN, 14));
            closeButton.addActionListener(new ActionListener() {
                @Override
                public void actionPerformed(ActionEvent e) {
                    closeButtonActionPerformed(e);
                }
            });
            buttonBar.add(closeButton, cc.xy(2, 1));
        }
        dialogPane.add(buttonBar, BorderLayout.SOUTH);
    }
    contentPane.add(dialogPane, BorderLayout.CENTER);
    setSize(710, 675);
    setLocationRelativeTo(getOwner());
    // //GEN-END:initComponents
}

From source file:net.pms.newgui.LooksFrame.java

public static void initializeLookAndFeel() {
    synchronized (lookAndFeelInitializedLock) {
        if (lookAndFeelInitialized) {
            return;
        }//from ww  w  . j av a2 s. co  m

        if (Platform.isWindows()) {
            try {
                UIManager.setLookAndFeel(WINDOWS_LNF);
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                    | UnsupportedLookAndFeelException e) {
                LOGGER.error("Error while setting Windows look and feel: ", e);
            }
        } else if (System.getProperty("nativelook") == null && !Platform.isMac()) {
            try {
                UIManager.setLookAndFeel(PLASTICXP_LNF);
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                    | UnsupportedLookAndFeelException e) {
                LOGGER.error("Error while setting Plastic XP look and feel: ", e);
            }
        } else {
            try {
                String systemClassName = UIManager.getSystemLookAndFeelClassName();
                // Workaround for Gnome
                try {
                    String gtkLAF = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel";
                    Class.forName(gtkLAF);

                    if (systemClassName.equals("javax.swing.plaf.metal.MetalLookAndFeel")) {
                        systemClassName = gtkLAF;
                    }
                } catch (ClassNotFoundException ce) {
                    LOGGER.error("Error loading GTK look and feel: ", ce);
                }

                LOGGER.trace("Choosing Java look and feel: " + systemClassName);
                UIManager.setLookAndFeel(systemClassName);
            } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                    | UnsupportedLookAndFeelException e1) {
                try {
                    UIManager.setLookAndFeel(PLASTICXP_LNF);
                } catch (ClassNotFoundException | InstantiationException | IllegalAccessException
                        | UnsupportedLookAndFeelException e) {
                    LOGGER.error("Error while setting Plastic XP look and feel: ", e);
                }
                LOGGER.error("Error while setting native look and feel: ", e1);
            }
        }

        if (isParticularLaFSet(UIManager.getLookAndFeel(), PLASTICXP_LNF)) {
            PlasticLookAndFeel.setPlasticTheme(PlasticLookAndFeel.createMyDefaultTheme());
            PlasticLookAndFeel.setTabStyle(PlasticLookAndFeel.TAB_STYLE_DEFAULT_VALUE);
            PlasticLookAndFeel.setHighContrastFocusColorsEnabled(false);
        } else if (isParticularLaFSet(UIManager.getLookAndFeel(), METAL_LNF)) {
            MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
        }

        // Work around caching in MetalRadioButtonUI
        JRadioButton radio = new JRadioButton();
        radio.getUI().uninstallUI(radio);
        JCheckBox checkBox = new JCheckBox();
        checkBox.getUI().uninstallUI(checkBox);

        // Workaround for JDK-8179014: JFileChooser with Windows look and feel crashes on win 10
        // https://bugs.openjdk.java.net/browse/JDK-8179014
        if (isParticularLaFSet(UIManager.getLookAndFeel(), WINDOWS_LNF)) {
            UIManager.put("FileChooser.useSystemExtensionHiding", false);
        }

        lookAndFeelInitialized = true;
    }
}

From source file:de.atomfrede.tools.evalutation.options.ui.OptionsDialog.java

private JCheckBox getCo2AbsoluteDeltaCheckBox() {
    if (co2Absolute_isDeltaFiveMinutesAutoscaleCheckbox == null) {
        co2Absolute_isDeltaFiveMinutesAutoscaleCheckbox = new JCheckBox();
        co2Absolute_isDeltaFiveMinutesAutoscaleCheckbox.setText("Enable Autoscale");
        co2Absolute_isDeltaFiveMinutesAutoscaleCheckbox
                .setSelected(CO2AbsoluteOnlyEvaluationOptions.isAutoScaleDeltaFiveMinutes());

        co2Absolute_isDeltaFiveMinutesAutoscaleCheckbox.addActionListener(new ActionListener() {

            @Override//  www. j av a 2 s.  c o m
            public void actionPerformed(ActionEvent e) {
                // Autoscale is disabled enable minimum and maximum spinners
                getCo2Absolute_deltaFiveMinutesMinimumSpinner()
                        .setEnabled(!co2Absolute_isDeltaFiveMinutesAutoscaleCheckbox.isSelected());
                getCo2Absolute_deltaFiveMinutesMaximumSpinner()
                        .setEnabled(!co2Absolute_isDeltaFiveMinutesAutoscaleCheckbox.isSelected());
            }
        });
    }
    return co2Absolute_isDeltaFiveMinutesAutoscaleCheckbox;
}

From source file:edu.ku.brc.af.ui.weblink.WebLinkEditorDlg.java

@Override
public void createUI() {
    super.createUI();

    nameTF = UIHelper.createTextField();
    baseUrlTF = UIHelper.createTextField(25);
    descTA = UIHelper.createTextArea();/*  w w  w.  j  av a2s  .c o  m*/

    descTA.setLineWrap(true);
    descTA.setWrapStyleWord(true);

    txtFGColor = nameTF.getForeground();
    txtBGColor = nameTF.getBackground();

    if (isEdit) {
        ViewFactory.changeTextFieldUIForDisplay(nameTF, true);
    }

    descTA.setRows(5);

    model = new WebLinkArgsTableModel();
    table = new JTable(model);
    table.setDefaultRenderer(String.class, new BiColorTableCellRenderer(true));

    CellConstraints cc = new CellConstraints();
    PanelBuilder rightPB = new PanelBuilder(new FormLayout("p,2px,f:p:g", //$NON-NLS-1$
            "p,2px,p, 4px,p,2px,200px" + (tableInfo != null ? ",2px,200px" : ""))); //$NON-NLS-1$

    rightPB.add(createI18NFormLabel("WebLinkArgDlg.NAME"), cc.xy(1, 1)); //$NON-NLS-1$ //$NON-NLS-2$
    rightPB.add(nameTF, cc.xy(3, 1));

    rightPB.add(createI18NFormLabel("WebLinkArgDlg.URL"), cc.xy(1, 3)); //$NON-NLS-1$ //$NON-NLS-2$
    rightPB.add(baseUrlTF, cc.xy(3, 3));

    rightPB.add(createI18NFormLabel("WebLinkArgDlg.DESC"), cc.xy(1, 5)); //$NON-NLS-1$ //$NON-NLS-2$
    rightPB.add(UIHelper.createScrollPane(descTA), cc.xy(3, 5));

    rightPB.add(createI18NFormLabel("WebLinkArgDlg.FIELDS"), cc.xy(1, 7)); //$NON-NLS-1$ //$NON-NLS-2$
    rightPB.add(UIHelper.createScrollPane(table), cc.xy(3, 7));

    if (tableInfo != null) {
        rightPB.add(UIHelper.createScrollPane(availableFields), cc.xy(3, 9));
    }

    rightPB.setDefaultDialogBorder();

    TableColumn promptCol = table.getColumnModel().getColumn(2);
    promptCol.setCellEditor(new DefaultCellEditor(new JCheckBox()));
    //promptCol.setCellRenderer(cellRenderer)
    UIHelper.makeTableHeadersCentered(table, false);

    contentPanel = rightPB.getPanel();
    mainPanel.add(contentPanel, BorderLayout.CENTER);
    pack();

    setDataIntoUI();

    DocumentListener docLis = new DocumentListener() {
        protected void changed() {
            hasChanged = true;
            parseForFields();
            enableUI();
        }

        public void changedUpdate(DocumentEvent e) {
            changed();
        }

        public void insertUpdate(DocumentEvent e) {
            changed();
        }

        public void removeUpdate(DocumentEvent e) {
            changed();
        }
    };

    nameTF.getDocument().addDocumentListener(docLis);
    baseUrlTF.getDocument().addDocumentListener(docLis);

    adjustAvailableJList();

    enableUI();

    pack();
}