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

📄 stuinfosearchsnum.java

📁 java编写的与SQL数据连接的好例子~~功能很完善,可以做实训直接交
💻 JAVA
字号:
/* * StuSearchSnum.java * * Created on 2008年6月29日, 上午8:35 */package stuMS;/** * * @author  Administrator */public class StuInfoSearchSnum extends javax.swing.JDialog {    String []Sno;    /** Creates new form StuSearchSnum */    public StuInfoSearchSnum(java.awt.Frame parent, boolean modal) {        super(parent, modal);        StuBean getSno = new StuBean();        Sno = getSno.getAllId();        initComponents();        this.setLocationRelativeTo(parent);    }    StuInfoSearchSnum(EditStuInformation aThis) {        throw new UnsupportedOperationException("Not yet implemented");    }    public String getSnum(){        return (String)this.selectSnum.getSelectedItem();    }    /** 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() {        jPanel1 = new javax.swing.JPanel();        jLabel1 = new javax.swing.JLabel();        selectSnum = new javax.swing.JComboBox(Sno);        searchInfo = new javax.swing.JButton();        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);        setTitle("学号查询");        jLabel1.setText("请输入或选择学号:");        selectSnum.setEditable(true);        selectSnum.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                selectSnumActionPerformed(evt);            }        });        searchInfo.setText("查询");        searchInfo.addActionListener(new java.awt.event.ActionListener() {            public void actionPerformed(java.awt.event.ActionEvent evt) {                searchInfoActionPerformed(evt);            }        });        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);        jPanel1.setLayout(jPanel1Layout);        jPanel1Layout.setHorizontalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel1Layout.createSequentialGroup()                .addContainerGap()                .addComponent(jLabel1)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)                .addComponent(selectSnum, javax.swing.GroupLayout.PREFERRED_SIZE, 87, javax.swing.GroupLayout.PREFERRED_SIZE)                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)                .addComponent(searchInfo)                .addContainerGap(23, Short.MAX_VALUE))        );        jPanel1Layout.setVerticalGroup(            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(jPanel1Layout.createSequentialGroup()                .addContainerGap()                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)                    .addComponent(jLabel1)                    .addComponent(selectSnum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                    .addComponent(searchInfo))                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());        getContentPane().setLayout(layout);        layout.setHorizontalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(layout.createSequentialGroup()                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                .addContainerGap(32, Short.MAX_VALUE))        );        layout.setVerticalGroup(            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)            .addGroup(layout.createSequentialGroup()                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))        );        pack();    }// </editor-fold>//GEN-END:initComponents    private void selectSnumActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_selectSnumActionPerformed        // TODO add your handling code here:        this.dispose();    }//GEN-LAST:event_selectSnumActionPerformed    private void searchInfoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_searchInfoActionPerformed        // TODO add your handling code here:        this.dispose();    }//GEN-LAST:event_searchInfoActionPerformed        /**     * @param args the command line arguments     */    public static void main(String args[]) {        java.awt.EventQueue.invokeLater(new Runnable() {            public void run() {                StuInfoSearchSnum dialog = new StuInfoSearchSnum(new javax.swing.JFrame(), true);                dialog.addWindowListener(new java.awt.event.WindowAdapter() {                    public void windowClosing(java.awt.event.WindowEvent e) {                        System.exit(0);                    }                });                dialog.setVisible(true);            }        });    }        // Variables declaration - do not modify//GEN-BEGIN:variables    private javax.swing.JLabel jLabel1;    private javax.swing.JPanel jPanel1;    private javax.swing.JButton searchInfo;    private javax.swing.JComboBox selectSnum;    // End of variables declaration//GEN-END:variables    }

⌨️ 快捷键说明

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