⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 addstu.java

📁 java netbeans 学习程序合集
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/*
 * AddStu.java
 *
 * Created on 2007年8月29日, 下午1:05
 */

package org.Adam;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 *
 * @author  Administrator
 */
public class AddStu extends javax.swing.JFrame {
     ResultSet rs=null;
     String ID=new String();
     public String a=new String();
    /** Creates new form AddStu */
    public AddStu() {
        initComponents();
        this.setLocationRelativeTo(this);
        this.setResizable(false);
        this.jComboBox1.addItem("");
        GetGrade(); 
    }
    private void GetGrade(){
        String sql="select distinct 年级 from 班级信息 ";
        DB dB=new DB();
        rs=dB.SelectpassDb(sql);
        try {
           while(rs.next()){
            a=rs.getString("年级");
            this.jComboBox1.addItem(a);
           }
            
        } catch (SQLException ex) {
            ex.printStackTrace();
        }
    }
    /** 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=" 生成的代码 ">//GEN-BEGIN:initComponents
    private void initComponents() {
        buttonGroup1 = new javax.swing.ButtonGroup();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jTextFieldID = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jTextFieldName = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        jRadioButton1 = new javax.swing.JRadioButton();
        jRadioButton2 = new javax.swing.JRadioButton();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jTextFieldBornTime = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jTextFieldBorn = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        jTextFieldMail = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        jTextFieldPhone = new javax.swing.JTextField();
        jComboBoxClass = new javax.swing.JComboBox();
        jComboBox1 = new javax.swing.JComboBox();
        jPanel2 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTextAreaOther = new javax.swing.JTextArea();
        jButtonEnter = new javax.swing.JButton();
        jButton2 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("\u5b66\u751f\u6863\u6848");
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("\u5165\u5b66\u767b\u8bb0"));
        jLabel1.setText("\u5b66\u53f7\uff1a");

        jLabel2.setText("\u59d3\u540d\uff1a");

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

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

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

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

        jLabel5.setText("\u5e74\u7ea7\uff1a");

        jLabel6.setText("\u51fa\u751f\u5e74\u6708\uff1a");

        jLabel7.setText("\u7c4d\u8d2f\uff1a");

        jLabel8.setText("\u90ae\u653f\u7f16\u7801\uff1a");

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

        jComboBoxClass.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "", "\u7535\u4fe1", "\u5e94\u7535", "\u7269\u65591\u73ed", "\u7269\u65592\u73ed", "\u7269\u65593\u73ed" }));

        org.jdesktop.layout.GroupLayout jPanel1Layout = new org.jdesktop.layout.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .add(33, 33, 33)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jPanel1Layout.createSequentialGroup()
                        .add(jLabel9)
                        .addContainerGap())
                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                        .add(jPanel1Layout.createSequentialGroup()
                            .add(jLabel8)
                            .addContainerGap())
                        .add(jPanel1Layout.createSequentialGroup()
                            .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                .add(jPanel1Layout.createSequentialGroup()
                                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                        .add(jPanel1Layout.createSequentialGroup()
                                            .add(jLabel5)
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                            .add(jComboBox1, 0, 95, Short.MAX_VALUE))
                                        .add(jPanel1Layout.createSequentialGroup()
                                            .add(jLabel3)
                                            .add(18, 18, 18)
                                            .add(jRadioButton1)
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 23, Short.MAX_VALUE)
                                            .add(jRadioButton2))
                                        .add(jPanel1Layout.createSequentialGroup()
                                            .add(jLabel1)
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                            .add(jTextFieldID, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 95, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))
                                    .add(21, 21, 21)
                                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                        .add(jPanel1Layout.createSequentialGroup()
                                            .add(jLabel7)
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                            .add(jTextFieldBorn, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE))
                                        .add(jPanel1Layout.createSequentialGroup()
                                            .add(jLabel2)
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                            .add(jTextFieldName, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 111, Short.MAX_VALUE))
                                        .add(jPanel1Layout.createSequentialGroup()
                                            .add(jLabel4)
                                            .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                                            .add(jComboBoxClass, 0, 111, Short.MAX_VALUE))))
                                .add(jPanel1Layout.createSequentialGroup()
                                    .add(jLabel6)
                                    .add(15, 15, 15)
                                    .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                                        .add(jTextFieldBornTime, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE)
                                        .add(jTextFieldMail, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 100, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                                        .add(jTextFieldPhone, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, 232, Short.MAX_VALUE))))
                            .add(20, 20, 20)))))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel1)
                    .add(jTextFieldID, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel2)
                    .add(jTextFieldName, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(22, 22, 22)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel3)
                    .add(jRadioButton1)
                    .add(jRadioButton2)
                    .add(jLabel4)
                    .add(jComboBoxClass, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(22, 22, 22)
                .add(jPanel1Layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)

⌨️ 快捷键说明

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