import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import java.awt.Dimension;
import java.awt.GridBagLayout;
import java.awt.Image;
import javax.swing.JButton;
import java.awt.GridBagConstraints;
import java.awt.Rectangle;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.JTextField;
import javax.swing.JOptionPane;//
import java.sql.*;//
import javax.swing.filechooser.*;//
import javax.swing.JFileChooser;//
import java.io.File;//
import java.util.Vector;
import javax.swing.JTable;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.DefaultTableModel;
import javax.swing.JScrollPane;
public class J_StudentManage extends JFrame {
private static final long serialVersionUID = 1L;
private JPanel jContentPane = null;
private JPanel jPanel = null;
private JButton jButton = null;
private JButton jButton1 = null;
private JButton jButton2 = null;
private JLabel jLabel = null;
private JComboBox jComboBox = null;
private JPanel jPanel1 = null; // @jve:decl-index=0:visual-constraint="14,313"
private JTextField jTextField = null;
private JLabel jLabel1 = null;
private JButton jButton3 = null;
private JButton jButton4 = null;
private JPanel jPanel2 = null; // @jve:decl-index=0:visual-constraint="14,600"
private JButton jButton5 = null;
private JButton jButton6 = null;
private JButton jButton7 = null;
private JButton jButton8 = null;
private JPanel jPanel3 = null;
private JPanel jPanel4 = null;
private JButton jButton9 = null;
private JButton jButton10 = null;
private JButton jButton11 = null;
private JButton jButton12 = null;
private JButton jButton13 = null;
private JButton jButton14 = null;
private JLabel jLabel2 = null;
private JLabel jLabel3 = null;
private JLabel jLabel4 = null;
private JLabel jLabel5 = null;
private JLabel jLabel6 = null;
private JLabel jLabel7 = null;
private JLabel jLabel8 = null;
private JTextField jTextField1 = null;
private JTextField jTextField2 = null;
private JTextField jTextField3 = null;
private JTextField jTextField4 = null;
private JTextField jTextField5 = null;
private JTextField jTextField6 = null;
private JTextField jTextField7 = null;
private JLabel jLabel9 = null;
private JPanel jPanel5 = null; // @jve:decl-index=0:visual-constraint="139,875"
private JButton jButton15 = null;
private JButton jButton16 = null;
private JPanel jPanel6 = null;
private JButton jButton17 = null;
private JButton jButton18 = null;
private JPanel jPanel7 = null; // @jve:decl-index=0:visual-constraint="139,913"
private JButton jButton19 = null;
private JButton jButton20 = null;
private JPanel jPanel8 = null; // @jve:decl-index=0:visual-constraint="140,947"
private JButton jButton21 = null;
private JButton jButton22 = null;
private JPanel jPanel9 = null; // @jve:decl-index=0:visual-constraint="143,979"
private JButton jButton23 = null;
private JButton jButton24 = null;
private JScrollPane jScrollPane1 = null; // @jve:decl-index=0:visual-constraint="506,-12"
private JScrollPane jScrollPane = null; // @jve:decl-index=0:visual-constraint="489,37"
private JTable jTable = null;
String str;//存放选择的班级
int num;//存放标号
String fileName=new String();//获取图片的路径 // @jve:decl-index=0:
ImageIcon icon=new ImageIcon(fileName); // @jve:decl-index=0:
/**
* This is the default constructor
*/
public J_StudentManage() {
super();
initialize();
}
/**
* This method initializes this
*
* @return void
*/
private void initialize() {
this.setSize(475, 301);
this.setContentPane(getJContentPane());
this.setTitle("学生管理系统");
}
/**
* This method initializes jContentPane
*
* @return javax.swing.JPanel
*/
private JPanel getJContentPane() {
if (jContentPane == null) {
jContentPane = new JPanel();
jContentPane.setLayout(null);
jContentPane.add(getJPanel6(), null);
}
return jContentPane;
}
/**
* This method initializes jPanel
*
* @return javax.swing.JPanel
*/
private JPanel getJPanel() {
if (jPanel == null) {
jLabel = new JLabel();
jLabel.setBounds(new Rectangle(68, 62, 134, 28));
jLabel.setText("班级名称:");
jPanel = new JPanel();
jPanel.setLayout(null);
jPanel.setBounds(new Rectangle(27, -3, 416, 274));
jPanel.add(getJButton(), null);
jPanel.add(getJButton1(), null);
jPanel.add(getJButton2(), null);
jPanel.add(jLabel, null);
jPanel.add(getJComboBox(), null);
jPanel.add(getJButton17(), null);
}
return jPanel;
}
/**
* This method initializes jButton
*
* @return javax.swing.JButton
*/
private JButton getJButton() {
if (jButton == null) {
jButton = new JButton();
jButton.setBounds(new Rectangle(285, 55, 85, 25));
jButton.setText("进入>>");
jButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent e) {
//将登录框去掉,加上学生信息的面板
getJPanel6().remove(getJPanel());
getJPanel6().add(getJPanel2());
getJPanel6().repaint();
str=(String)getJComboBox().getSelectedItem();//获取要进入的班级
System.out.println("进入的班级为:"+str);
//将数据库的内容导入
try
{
getJTextField1().setEditable(true);
getJTextField2().setEditable(true);
getJTextField3().setEditable(true);
getJTextField4().setEditable(true);
getJTextField5().setEditable(true);
getJTextField6().setEditable(true);
getJTextField7().setEditable(true);
//加载JDBC-ODBC桥驱动程序
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//建立连接
Connection c=DriverManager.getConnection(
"jdbc:odbc:studentSqlDatabase","sa"," ");
Statement s=c.createStatement
(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);//创建sql语句对象
ResultSet r=s.executeQuery("select * from tbmessage where class='"+str+"'");
r.beforeFirst();
if(r.next())//若有信息存在则将第一条记录显示
{
num=r.getRow();
getJTextField1().setText(r.getString("学号"));
getJTextField2().setText(r.getString("姓名"));
getJTextField3().setText(r.getString("性别"));
getJTextField4().setText(r.getString("出生日期"));
getJTextField5().setText(r.getString("住址"));
getJTextField6().setText(r.getString("联系方式"));
getJTextField7().setText(r.getString("QQ"));
icon=new ImageIcon(r.getString("图片"));
jLabel9.setIcon(icon);
}
else//无信息记录则置空
{
num=0;
getJTextField1().setText("");
getJTextField2().setText("");
getJTextField3().setText("");
getJTextField4().setText("");
getJTextField5().setText("");
getJTextField6().setText("");
getJTextField7().setText("");
}
getJTextField1().setEditable(false);
getJTextField2().setEditable(false);
getJTextField3().setEditable(false);
getJTextField4().setEditable(false);
getJTextField5().setEditable(false);
getJTextField6().setEditable(false);
getJTextField7().setEditable(false);
s.close();
没有合适的资源?快使用搜索试试~ 我知道了~
java 小型学生管理系统
共46个文件
class:29个
jpg:9个
gif:3个
需积分: 0 27 下载量 6 浏览量
2008-12-24
23:04:01
上传
评论
收藏 618KB RAR 举报
温馨提示
首先出现一个登陆框选择班级进入详细的学习信息框
资源详情
资源评论
资源推荐
收起资源包目录
SudentManage.rar (46个子文件)
SudentManage
image
5.jpg 176KB
3.jpg 5KB
8.jpg 2KB
4.jpg 4KB
12.gif 38KB
10.gif 56KB
9.jpg 78KB
2.jpg 7KB
7.gif 37KB
1.jpg 3KB
11.jpg 43KB
6.jpg 38KB
student
.project 503B
J_StudentManage$10.class 2KB
J_StudentManage.class 19KB
J_StudentManage$2.class 1KB
J_StudentManage$19.class 793B
J_StudentManage$7.class 2KB
J_StudentManage$28.class 4KB
J_StudentManage$25.class 4KB
J_StudentManage$13.class 3KB
J_StudentManage$15.class 3KB
J_StudentManage$3.class 2KB
J_StudentManage$24.class 4KB
J_StudentManage$20.class 2KB
J_StudentManage$6.class 2KB
J_StudentManage$14.class 3KB
J_StudentManage$16.class 2KB
J_StudentManage$4.class 3KB
J_StudentManage$5.class 1KB
J_StudentManage$22.class 4KB
J_StudentManage$26.class 4KB
J_StudentManage$8.class 1KB
J_StudentManage$9.class 1KB
J_StudentManage$18.class 2KB
J_StudentManage.java 76KB
J_StudentManage$12.class 3KB
J_StudentManage$1.class 4KB
J_StudentManage$23.class 5KB
J_StudentManage$27.class 1KB
.classpath 226B
J_StudentManage$11.class 1KB
J_StudentManage$17.class 4KB
J_StudentManage$21.class 5KB
数据库
studentSqlDatabase_Data.MDF 1024KB
studentSqlDatabase_Log.LDF 1024KB
共 46 条
- 1
yagebubu
- 粉丝: 4
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0