package com.iotek.gui;
import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import com.iotek.Joption.GuiMessage;
import com.iotek.Joption.UpdatePassword;
import com.iotek.cont.FindStudent;
import com.iotek.cont.RemoveCon;
import com.iotek.cont.UpdateCon;
import com.luwenrui.abstractfather.GuiView;
import com.luwenrui.dao.Temp;
import com.luwenrui.staticType.StaticType;
public class FindStudentGui extends GuiView implements ItemListener {
private int oa = 0;
private int ziduan = 1;
private JPanel painMain;
private JPanel painTop;
private JPanel painCenter;
private JPanel painEast;
private JPanel showOne;
private JTextArea textAre;
private JScrollPane js;
private JComboBox jc;
private JRadioButton jrb1;
private JRadioButton jrb2;
private JLabel titleLabel;
private JLabel tidLabel;
private JLabel tnameLabel;
private JLabel tageLabel;
private JLabel classLabel;
private JLabel emploLabel;
private JLabel englishLabel;
private JLabel chineseLabel;
private JTextField tidText;
private JTextField tnameText;
private JTextField tageText;
private JTextField classText;
private JTextField emploText;
private JTextField englishText;
private JTextField chineseText;
private JButton findButton;
private JButton updateButton;
private JButton defauButton;
private JButton okButton;
private JButton backButton;
private JButton exitButton;
private ButtonGroup bg;
public void show() {
// TODO Auto-generated method stub
GuiView.Show(this.PrintJPanel());
}
@Override
public void actionPerformed(ActionEvent e) {
// TODO Auto-generated method stub
if (e.getActionCommand().equals("单条记录")) {
oa = 1;
GuiView.frame.remove(this.painMain);
this.show();
} else if (e.getActionCommand().equals("多条记录")) {
oa = 2;
GuiView.frame.remove(this.painMain);
this.show();
}
if (e.getSource() == okButton) {
Temp tem = new Temp();
tem.setId(Integer.parseInt(tidText.getText()));
tem.setUsername(tnameText.getText());
tem.setPassword(StaticType.getUpdateInfo().getPassword());
tem.setString1(tageText.getText());
tem.setString2(classText.getText());
tem.setString3(emploText.getText());
tem.setString4(englishText.getText());
tem.setString5(chineseText.getText());
StaticType.setUpdateInfo(tem);
StaticType.getUpdateInfo().setType(2);
new UpdateCon().other();
} else if (e.getSource() == backButton) {
GuiView.frame.remove(painMain);
new TeacherGui().show();
} else if (e.getSource() == updateButton) {
if (oa == 2) {
GuiMessage.showErr("多条记录不能修改");
} else if (oa == 1) {
tageText.setEditable(true);
classText.setEditable(true);
emploText.setEditable(true);
englishText.setEditable(true);
chineseText.setEditable(true);
}
} else if (e.getSource() == findButton) {
if (ziduan == 1 && oa == 1) {
String id = UpdatePassword.PassOption("请 输入要查找的学号");
if (id != null) {
new FindStudent().findOne(Integer.parseInt(id));
tidText.setText(StaticType.getUpdateInfo().getId() + "");
tnameText.setText(StaticType.getUpdateInfo().getUsername());
tageText.setText(StaticType.getUpdateInfo().getString1());
classText.setText(StaticType.getUpdateInfo().getString2());
emploText.setText(StaticType.getUpdateInfo().getString3());
englishText
.setText(StaticType.getUpdateInfo().getString4());
chineseText
.setText(StaticType.getUpdateInfo().getString5());
}
} else if (ziduan == 2 && oa == 2) {
String name = UpdatePassword.PassOption("请输入要查找的姓名");
if (name != null) {
textAre.setText(new FindStudent().findOther(name));
}
} else if (ziduan == 3 && oa == 2) {
String name = UpdatePassword.PassOption("请输入要查找的班级");
if (name != null) {
textAre.setText(new FindStudent().findClassOther(name));
}
}
} else if (e.getSource() == defauButton) {
if (oa == 2) {
GuiMessage.showErr("多条记录不能删除");
} else if (oa == 1) {
String id = UpdatePassword.PassOption("请出入删除的学生号");
if (id != null) {
new FindStudent().findOne(Integer.parseInt(id));
StaticType.getUpdateInfo().setType(2);
new RemoveCon().other();
}
}
} else if (e.getSource() == exitButton) {
super.exit();
}
}
@Override
protected JPanel PrintJPanel() {
// TODO Auto-generated method stub
painTop = new JPanel();
painTop.setLayout(new FlowLayout());
titleLabel = new JLabel("学 生 查 找 修 改");
titleLabel.setFont(new Font("宋体", Font.BOLD, 24));
painTop.add(titleLabel);
painCenter = new JPanel();
painCenter.setLayout(new BorderLayout());
if (oa == 0 || oa == 1) {
painCenter.add(this.showOneTeacher(), BorderLayout.CENTER);
painCenter.add(new JLabel(), BorderLayout.NORTH);
painCenter.add(new JLabel(), BorderLayout.SOUTH);
painCenter.add(new JLabel(), BorderLayout.EAST);
} else {
painCenter.add(this.showAllTeacher(), BorderLayout.CENTER);
painCenter.add(new JLabel(), BorderLayout.NORTH);
painCenter.add(new JLabel(), BorderLayout.SOUTH);
painCenter.add(new JLabel(), BorderLayout.EAST);
}
painEast = new JPanel();
JPanel jcP = new JPanel();
jcP.setLayout(new FlowLayout());
jc = new JComboBox();
jc.addItem("学号");
jc.addItem("学生姓名");
jc.addItem("班级");
jc.addItemListener(this);
jcP.add(jc);
JPanel jrbP = new JPanel();
jrbP.setLayout(new GridLayout(1, 2, 30, 30));
jrb1 = new JRadioButton("单条记录");
jrb1.addActionListener(this);
jrb2 = new JRadioButton("多条记录");
jrb2.addActionListener(this);
bg = new ButtonGroup();
bg.add(jrb1);
bg.add(jrb2);
jrbP.add(jrb1);
jrbP.add(jrb2);
findButton = new JButton("查找(F)");
findButton.setMnemonic(KeyEvent.VK_F);
findButton.addActionListener(this);
updateButton = new JButton("修改(U)");
updateButton.setMnemonic(KeyEvent.VK_U);
updateButton.addActionListener(this);
defauButton = new JButton("删除(D)");
defauButton.setMnemonic(KeyEvent.VK_D);
defauButton.addActionListener(this);
okButton = new JButton("确认(O)");
okButton.setMnemonic(KeyEvent.VK_O);
okButton.addActionListener(this);
backButton = new JButton("返回(B)");
backButton.setMnemonic(KeyEvent.VK_B);
backButton.addActionListener(this);
exitButton = new JButton("退出(E)");
exitButton.setMnemonic(KeyEvent.VK_E);
exitButton.addActionListener(this);
JPanel panela = new JPanel();
panela.setLayout(new GridLayout(8, 1, 30, 30));
panela.add(jcP);
panela.add(jrbP);
panela.add(findButton);
panela.add(updateButton);
panela.add(defauButton);
panela.add(okButton);
panela.add(backButton);
panela.add(exitButton);
painEast = new JPanel();
painEast.setLayout(new BorderLayout());
painEast.add(panela, BorderLayout.CENTER);
painEast.add(new JLabel(), BorderLayout.SOUTH);
painEast.add(new JLabel(), BorderLayout.NORTH);
painEast.add(new JLabel(), BorderLayout.EAST);
painMain = new JPanel();
painMain.setLayout(new BorderLayout());
painMain.add(painTop, BorderLayout.NORTH);
painMain.add(painCenter, BorderLayout.CENTER);
painMain.add(painEast, BorderLayout.EAST);
painMain.setSize(700, 700);
return painMain;
}
public JPanel showAllTeacher() {
String string = new String("学号
没有合适的资源?快使用搜索试试~ 我知道了~
MVC模式的Java编写学生管理系统源码
共91个文件
class:43个
java:43个
jar:2个
3星 · 超过75%的资源 需积分: 20 141 下载量 21 浏览量
2011-08-09
20:49:21
上传
评论 5
收藏 1.09MB RAR 举报
温馨提示
Java编写的学生管理系统源码,采用MVC模式,含有用户操作界面对话框,实现增,查,修,删,排序等功能
资源推荐
资源详情
资源评论
收起资源包目录
StudentSystem.rar (91个子文件)
StudentSystem
.project 389B
bin
com
luwenrui
zhuanhuan
Zhuanhuan.class 3KB
text
Test.class 502B
dao
Temp.class 3KB
Admin.class 2KB
Teacher.class 2KB
Student.class 3KB
staticType
StaticType.class 857B
sql
TeaDataIn.class 4KB
AdminDataIn.class 4KB
StuDataIn.class 5KB
abstractfather
GuiView.class 1KB
Person.class 1KB
panduan
PanDuan.class 4KB
iotek
cont
LoginGoto.class 625B
AutoId.class 1KB
FindTeacher.class 3KB
GotoLogin.class 638B
RemoveCon.class 2KB
AddCon.class 2KB
UpdateCon.class 2KB
FindStudent.class 3KB
AdminstorAll.class 3KB
TeacherAll.class 4KB
jdbc
SqlClose.class 703B
SqlConnect.class 1KB
sort
StudentSort.class 4KB
TeacherSort.class 3KB
interfacev
FindInterface.class 214B
ShowAll.class 156B
SortInterface.class 383B
UpdateInterface.class 169B
Joption
GuiMessage.class 586B
UpdatePassword.class 955B
likefind
LikeFind.class 748B
gui
AddTeacher.class 5KB
AdminstorGui.class 5KB
TeacherGui.class 5KB
AddStudent.class 5KB
FindStudentGui.class 9KB
FindTeacherGui.class 8KB
StudentManager.class 5KB
LoginGui.class 4KB
RegiGui.class 5KB
mysql-connector-java-5.0.8-bin.jar 528KB
.settings
org.eclipse.jdt.core.prefs 629B
src
com
luwenrui
zhuanhuan
Zhuanhuan.java 2KB
text
Test.java 592B
dao
Temp.java 3KB
Teacher.java 1KB
Admin.java 1KB
Student.java 2KB
staticType
StaticType.java 521B
sql
StuDataIn.java 4KB
AdminDataIn.java 3KB
TeaDataIn.java 4KB
abstractfather
Person.java 700B
GuiView.java 834B
panduan
PanDuan.java 3KB
iotek
cont
AutoId.java 670B
FindTeacher.java 2KB
GotoLogin.java 261B
AddCon.java 1KB
FindStudent.java 2KB
TeacherAll.java 3KB
UpdateCon.java 2KB
RemoveCon.java 1KB
AdminstorAll.java 2KB
LoginGoto.java 377B
jdbc
SqlConnect.java 683B
SqlClose.java 358B
sort
TeacherSort.java 2KB
StudentSort.java 3KB
interfacev
UpdateInterface.java 119B
FindInterface.java 145B
SortInterface.java 264B
ShowAll.java 99B
Joption
UpdatePassword.java 499B
GuiMessage.java 236B
likefind
LikeFind.java 498B
gui
TeacherGui.java 5KB
FindStudentGui.java 10KB
RegiGui.java 6KB
LoginGui.java 4KB
FindTeacherGui.java 9KB
AdminstorGui.java 5KB
StudentManager.java 5KB
AddTeacher.java 5KB
AddStudent.java 6KB
.classpath 456B
lib
mysql-connector-java-5.0.8-bin.jar 528KB
共 91 条
- 1
kb_080
- 粉丝: 2
- 资源: 12
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
- 3
前往页