addstudentframe.java

来自「精通NetBeans光盘源代码,很好很好的资料」· Java 代码 · 共 165 行

JAVA
165
字号
/*
 * AddStudentFrame.java
 *
 * Created on 2006年3月12日, 下午3:16
 */

package org.netbeans.swing.addstudentinfo;

/**
 *
 * @author  boyingking
 */
public class AddStudentFrame extends javax.swing.JFrame {
    
    /** Creates new form AddStudentFrame */
    public AddStudentFrame() {
        initComponents();
    }
    
    /** 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.
     */
    // <editor-fold defaultstate="collapsed" desc=" Generated Code ">//GEN-BEGIN:initComponents
    private void initComponents() {
        JButtonGroupGender = new javax.swing.ButtonGroup();
        jLabelStudentName = new javax.swing.JLabel();
        jLabelStudentID = new javax.swing.JLabel();
        jLabelGender = new javax.swing.JLabel();
        JRadioButtonMale = new javax.swing.JRadioButton();
        JRadioButtonFemale = new javax.swing.JRadioButton();
        jLabelGrade = new javax.swing.JLabel();
        jLabelPhoneNum = new javax.swing.JLabel();
        JButtonEnter = new javax.swing.JButton();
        JButtonCancel = new javax.swing.JButton();
        jTextField1 = new javax.swing.JTextField();
        jTextFieldStudentID = new javax.swing.JTextField();
        jTextFieldGrade = new javax.swing.JTextField();
        jTextFieldPhoneNum = new javax.swing.JTextField();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("\u6dfb\u52a0\u5b66\u751f\u4fe1\u606f");
        jLabelStudentName.setText("\u59d3\u540d\uff1a");

        jLabelStudentID.setText("\u5b66\u53f7\uff1a");

        jLabelGender.setText("\u6027\u522b\uff1a");

        JButtonGroupGender.add(JRadioButtonMale);
        JRadioButtonMale.setSelected(true);
        JRadioButtonMale.setText("\u7537");
        JRadioButtonMale.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        JRadioButtonMale.setMargin(new java.awt.Insets(0, 0, 0, 0));

        JButtonGroupGender.add(JRadioButtonFemale);
        JRadioButtonFemale.setText("\u5973");
        JRadioButtonFemale.setBorder(javax.swing.BorderFactory.createEmptyBorder(0, 0, 0, 0));
        JRadioButtonFemale.setMargin(new java.awt.Insets(0, 0, 0, 0));

        jLabelGrade.setText("\u73ed\u7ea7\uff1a");

        jLabelPhoneNum.setText("\u8054\u7cfb\u7535\u8bdd\uff1a");

        JButtonEnter.setText("\u786e\u5b9a");

        JButtonCancel.setText("\u53d6\u6d88");

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(38, 38, 38)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabelGender)
                            .add(jLabelStudentID)
                            .add(jLabelGrade)
                            .add(jLabelStudentName))
                        .add(26, 26, 26)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jTextField1, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                            .add(jTextFieldStudentID, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)
                            .add(layout.createSequentialGroup()
                                .add(JRadioButtonMale)
                                .add(29, 29, 29)
                                .add(JRadioButtonFemale))
                            .add(jTextFieldGrade, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 159, Short.MAX_VALUE)))
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabelPhoneNum)
                            .add(layout.createSequentialGroup()
                                .add(36, 36, 36)
                                .add(JButtonEnter)))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(org.jdesktop.layout.GroupLayout.TRAILING, JButtonCancel)
                            .add(jTextFieldPhoneNum, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 120, Short.MAX_VALUE))))
                .add(70, 70, 70))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(39, 39, 39)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabelStudentName)
                    .add(jTextField1, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(19, 19, 19)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabelStudentID)
                    .add(jTextFieldStudentID, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(19, 19, 19)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabelGender)
                    .add(JRadioButtonMale)
                    .add(JRadioButtonFemale))
                .add(27, 27, 27)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabelGrade)
                    .add(jTextFieldGrade, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(20, 20, 20)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabelPhoneNum)
                    .add(jTextFieldPhoneNum, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(33, 33, 33)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(JButtonCancel)
                    .add(JButtonEnter, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 25, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(21, Short.MAX_VALUE))
        );
        pack();
    }// </editor-fold>//GEN-END:initComponents
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new AddStudentFrame().setVisible(true);
            }
        });
    }
    
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton JButtonCancel;
    private javax.swing.JButton JButtonEnter;
    private javax.swing.ButtonGroup JButtonGroupGender;
    private javax.swing.JRadioButton JRadioButtonFemale;
    private javax.swing.JRadioButton JRadioButtonMale;
    private javax.swing.JLabel jLabelGender;
    private javax.swing.JLabel jLabelGrade;
    private javax.swing.JLabel jLabelPhoneNum;
    private javax.swing.JLabel jLabelStudentID;
    private javax.swing.JLabel jLabelStudentName;
    private javax.swing.JTextField jTextField1;
    private javax.swing.JTextField jTextFieldGrade;
    private javax.swing.JTextField jTextFieldPhoneNum;
    private javax.swing.JTextField jTextFieldStudentID;
    // End of variables declaration//GEN-END:variables
    
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?