package com.niit;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.util.Vector;
import javax.swing.BorderFactory;
import javax.swing.CellEditor;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.JTable;
import javax.swing.JTextField;
import javax.swing.border.TitledBorder;
import javax.swing.table.DefaultTableModel;
public class Admin extends JFrame {
/**
* 管理员
*/
JTabbedPane jtabbedpane;
JPanel jp_user, jp_stu, jp_test, jp_user_top, jp_user_bottom, jp_bottom_info, jp_test_top, jp_test_top1,
jp_test_top2, jp_test_bottom, jp_stu_top, jp_stu_bottom;
JLabel jl_bottom_info, jl_name, jl_t_id, jl_add_tid, jl_add_tcontent, jl_add_tA, jl_add_tB, jl_add_tC, jl_add_tD,
jl_add_tTrue, jl_stu_sea;
JButton jbtn_search, jbtn_del, jbtn_t_search, jbtn_t_del, addTest, jbtn_stu_search, jbtn_stu_del;
JTextField jtxf_search, jtxf_t_search, jtx_add_tid, jtx_add_tcontent, jtx_add_tA, jtx_add_tB, jtx_add_tC,
jtx_add_tD, jtx_add_tTrue, jtx_stu_search;
DefaultTableModel dtm, dtm_t, dtm_stu;
JTable jtable_user, jtable_test, jtable_stu;
Object[][] userinfo = null, testinfo = null, stuinfo = null;
String[] table_user_head = { "帐号", "用户名", "密码", "等级" }, table_test_head = { "题号", "题目内容", "选项A", "选项B", "选项C",
"选项D", "答案" }, table_stu_head = { "学号", "姓名", "成绩" };
String admin_name;
JScrollPane jscroll_user_list, jscroll_test_list, jscroll_stu_list;
public Admin(String tempname) {
this.admin_name = tempname;
this.setTitle("NIIT考试系统---管理员界面");
this.setBounds(0, 0, 1024, 768);
this.setLocationRelativeTo(null);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
this.setResizable(false);
}
public void goAdmin() {
jtabbedpane = new JTabbedPane();
/**
* 用户区界面
*/
jp_user = new JPanel();
jp_user.setLayout(null);
jp_user_top = new JPanel(new FlowLayout(FlowLayout.LEFT));
jp_user_top.setBounds(5, 5, 1005, 250);
jp_user_top.setBorder(BorderFactory.createTitledBorder(null, "操作区", TitledBorder.LEADING, TitledBorder.TOP,
new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
jl_name = new JLabel("按姓名查找");
jtxf_search = new JTextField(12);
jbtn_search = new JButton("查找");
jbtn_search.addActionListener(new actionButton());
jbtn_del = new JButton("删除");
jbtn_del.addActionListener(new actionButton1());
jp_user_top.add(jl_name);
jp_user_top.add(jtxf_search);
jp_user_top.add(jbtn_search);
jp_user_top.add(jbtn_del);
jp_user_bottom = new JPanel(new BorderLayout());
jp_user_bottom.setBounds(5, 260, 1005, 420);
jp_user_bottom.setBorder(BorderFactory.createTitledBorder(null, "信息区", TitledBorder.LEADING, TitledBorder.TOP,
new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
/**
* 用户表信息面板
*/
dtm = new DefaultTableModel(userinfo, table_user_head);
jtable_user = new JTable(dtm);
jtable_user.getSelectionModel().setSelectionMode(JTable.AUTO_RESIZE_OFF);
jtable_user.setAutoCreateRowSorter(true);
jscroll_user_list = new JScrollPane(jtable_user);
jp_user_bottom.add(jscroll_user_list);
jp_bottom_info = new JPanel(new FlowLayout(FlowLayout.RIGHT));
jp_bottom_info.setBounds(5, 680, 1005, 30);
jl_bottom_info = new JLabel();
jl_bottom_info.setText("当前用户:" + admin_name);
jp_bottom_info.add(jl_bottom_info);
jp_user.add(jp_user_top);
jp_user.add(jp_user_bottom);
jp_user.add(jp_bottom_info);
/**
* 题库区界面
*/
jp_test = new JPanel();
jp_test.setLayout(null);
jp_test_top = new JPanel();
jp_test_top.setLayout(null);
jp_test_top.setBounds(5, 5, 1005, 260);
jp_test_top.setBorder(BorderFactory.createTitledBorder(null, "操作区", TitledBorder.LEADING, TitledBorder.TOP,
new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
jp_test_top1 = new JPanel(new FlowLayout(FlowLayout.LEFT));
jp_test_top1.setBounds(10, 15, 980, 40);
jl_t_id = new JLabel("按题号查询");
jtxf_t_search = new JTextField(10);
jbtn_t_search = new JButton("查找");
jbtn_t_search.addActionListener(new actionButton3());
jbtn_t_del = new JButton("删除");
jbtn_t_del.addActionListener(new acctionButton2());
jp_test_top2 = new JPanel(new FlowLayout(FlowLayout.LEFT));
jp_test_top2.setBounds(20, 50, 980, 200);
addTest = new JButton("提交");
jl_add_tid = new JLabel("题目编号");
jl_add_tcontent = new JLabel("题目内容");
jl_add_tA = new JLabel("A 选项");
jl_add_tB = new JLabel("B 选项");
jl_add_tC = new JLabel("C 选项");
jl_add_tD = new JLabel("D 选项");
jl_add_tTrue = new JLabel("标准答案");
jtx_add_tid = new JTextField(80);
jtx_add_tcontent = new JTextField(80);
jtx_add_tA = new JTextField(80);
jtx_add_tB = new JTextField(80);
jtx_add_tC = new JTextField(80);
jtx_add_tD = new JTextField(80);
jtx_add_tTrue = new JTextField(40);
jp_test_top2.add(jl_add_tid);
jp_test_top2.add(jtx_add_tid);
jp_test_top2.add(jl_add_tcontent);
jp_test_top2.add(jtx_add_tcontent);
jp_test_top2.add(jl_add_tA);
jp_test_top2.add(jtx_add_tA);
jp_test_top2.add(jl_add_tB);
jp_test_top2.add(jtx_add_tB);
jp_test_top2.add(jl_add_tC);
jp_test_top2.add(jtx_add_tC);
jp_test_top2.add(jl_add_tD);
jp_test_top2.add(jtx_add_tD);
jp_test_top2.add(jl_add_tTrue);
jp_test_top2.add(jtx_add_tTrue);
jp_test_top2.add(addTest);
addTest.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
insertTest();
}
});
jp_test_top.add(jp_test_top2);
jp_test_top1.add(jl_t_id);
jp_test_top1.add(jtxf_t_search);
jp_test_top1.add(jbtn_t_search);
jp_test_top1.add(jbtn_t_del);
jp_test_top.add(jp_test_top1);
jp_test_bottom = new JPanel(new BorderLayout());
jp_test_bottom.setBounds(5, 270, 1005, 410);
jp_test_bottom.setBorder(BorderFactory.createTitledBorder(null, "信息区", TitledBorder.LEADING, TitledBorder.TOP,
new Font("Dialog", Font.BOLD, 12), new Color(51, 51, 51)));
dtm_t = new DefaultTableModel(testinfo, table_test_head);
jtable_test = new JTable(dtm_t);
jtable_test.getSelectionModel().setSelectionMode(JTable.AUTO_RESIZE_OFF);
jtable_test.setAutoCreateRowSorter(true);
jscroll_test_list = new JScrollPane(jtable_test);
jp_test_bottom.add(jscroll_test_list);
jp_test.add(jp_test_bottom);
jp_test.add(jp_test_top);
/**
* 学生区界面
*/
jp_stu = new JPanel();
jp_stu.setLayout(null);
jp_stu_top = new JPanel(new FlowLayout(FlowLayout.LEFT));
jp_stu_top.setBounds(5, 5, 1005, 250);
jp_stu_top.setBorder(BorderFactory.createTitledBorder(null, "操作区"));
jp_stu_bottom = new JPanel(new BorderLayout());
jp_stu_bottom.setBorder(BorderFactory.createTitledBorder(null, "信息区"));
jp_stu_bottom.setBounds(5, 260, 1005, 420);
jl_stu_sea = new JLabel("按学号查找");
jtx_stu_search = new JTextField(10);
jbtn_stu_search = new JButton("查找");
jbtn_stu_search.addActionListener(new actionButton4());
jbtn_stu_del = new JButton("删除");
jp_stu_top.add(jl_stu_sea);
jp_stu_top.add(jtx_stu_search);
jp_stu_top.add(jbtn_stu_search);
jp_stu_top.add(jbtn_stu_del);
dtm_stu = new DefaultTableModel(stuinfo, table_stu_head);
jtable_stu = new JTable(dtm_stu);
jscroll_stu_list = new JScrollPane(jtable_stu);
jp_stu_bottom.add(jscroll_stu_list);
jp_stu.add(jp_stu_top);
jp_stu.add(jp_stu_bottom);
jtabbedpane.add("用户信息", jp_user);
jtabbedpane.addTab("题目信息", jp_test);
jtabbedpane.addTab("学生信息", jp_stu);
this.add(jtabb
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
Java_GUI_考试系统_MySql.rar (27个子文件)
testsystem.sql 17KB
Test
.project 380B
bin
java.policy.applet 141B
com
niit
TestFrame$1.class 755B
Admin$1.class 658B
Admin$actionButton.class 1011B
Admin$actionButton4.class 1KB
Admin.class 14KB
TestFrame$EndTime.class 2KB
Admin$acctionButton2.class 761B
Conn.class 1KB
Index.class 5KB
TestFrame$actionStart.class 3KB
TestFrame$choiseAction.class 964B
Index$LoginAction.class 644B
TestFrame$2.class 755B
TestFrame$3.class 681B
TestFrame.class 8KB
Admin$actionButton1.class 1KB
TestFrame$btnAction.class 1KB
Admin$actionButton3.class 1024B
Index$1.class 655B
src
com
niit
Conn.java 1KB
TestFrame.java 11KB
Index.java 4KB
Admin.java 17KB
.classpath 341B
共 27 条
- 1
资源评论
- the杜2018-04-22可以说一下账户名和密码吗?
- 老SH2015-12-09值得借鉴!数据库也可以自己重构。
reeves101
- 粉丝: 5
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功