package com.lmx.View.Person;
import com.lmx.Pojo.Croom;
import com.lmx.Pojo.Equipment;
import com.lmx.Pojo.Request;
import com.lmx.Pojo.RequestLog;
import com.lmx.Service.ServiceRequest;
import com.lmx.Service.ServiceUser;
import com.lmx.Until.MyRecoverbutton;
import com.lmx.Until.MyShengpibutton;
import javax.swing.*;
import javax.swing.event.MenuEvent;
import javax.swing.event.MenuListener;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.JTableHeader;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Vector;
import java.util.regex.Pattern;
//老师权限之后
public class Teacherlogin extends JFrame{
// private String name;
private String id;
private JPanel jPanel=new JPanel();
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public Teacherlogin(String id) throws HeadlessException {
// 初始化窗体程序
this.id=id;
this.init();
}
// 初始化
protected void init() {
this.setTitle("教室信息管理系统");
this.setSize(700,700);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
this.setResizable(false);
this.setjpanel();
this.setVisible(true);
}
// 创建panel
private void setjpanel(){
// 创建页面
// JPanel jPanel = new JPanel();
jPanel.setLayout(null);
JLabel jLabel = new JLabel("教室信息管理系统---教师端");
jLabel.setBounds(160,30,400,40);
jLabel.setFont(new Font("",Font.BOLD,30));
jPanel.add(jLabel);
// 设置菜单组
JMenuBar menuBar = new JMenuBar(); // 创建一个菜单栏
JMenu fileMenu = new JMenu("查询"); // 创建一个菜单
fileMenu.setFont(new Font(null,Font.BOLD,20));
JMenu editMenu = new JMenu("审批"); // 创建一个菜单
editMenu.setFont(new Font(null,Font.BOLD,20));
JMenu equment = new JMenu("设备报修"); // 创建一个菜单
equment.setFont(new Font(null,Font.BOLD,20));
JMenu helpMenu = new JMenu("我的申请"); // 创建一个菜单
JMenu huifu = new JMenu("恢复");//恢复按钮
huifu.setFont(new Font(null,Font.BOLD,20));
helpMenu.setFont(new Font(null,Font.BOLD,20));
menuBar.add(fileMenu);
menuBar.add(editMenu);
menuBar.add(equment);
menuBar.add(helpMenu);
menuBar.add(huifu);
// menuBar.add(quit);
this.setJMenuBar(menuBar);
huifu.addMenuListener(new MenuListener() {
@Override
public void menuSelected(MenuEvent e) {
try {
JScrollPane jScrollPane=new JScrollPane();
ServiceUser serviceUser = new ServiceUser();
ArrayList<RequestLog> requestLogs = serviceUser.SelectrequestlogTeacher(id);
System.out.println(requestLogs);
String columnNames[]={"申请事项","日期","开始时间","结束时间","楼号","教室编号","恢复"};
DefaultTableModel dm = // 重写表格
new DefaultTableModel(columnNames,0); // 列名
JTable jTable = new JTable(dm);
jTable.setFont(new Font(null,Font.PLAIN,18));
jTable.setRowHeight(25);
JTableHeader tab_header =jTable.getTableHeader(); //获取表头
tab_header.setFont(new Font("微软雅黑", Font.PLAIN, 20));
tab_header.setPreferredSize(new Dimension(tab_header.getWidth(), 30));
for (RequestLog r:requestLogs){
Vector<Object> objects = new Vector<>();
objects.add(r.getThing());
objects.add(r.getDatetime());
objects.add(r.getStartrequest());
objects.add(r.getEndrequest());
objects.add(r.getFoolnumber());
objects.add(r.getRoomnumber());
dm.addRow(objects);
}
MyRecoverbutton.arrayList=requestLogs;
System.out.println("该学生的id是"+id);
jTable.getColumnModel().getColumn(6).setCellEditor(new MyRecoverbutton("恢复",2,requestLogs,dm,id));
jTable.getColumnModel().getColumn(6).setCellRenderer(new MyRecoverbutton("恢复",2,requestLogs,dm,id) );
jScrollPane.setViewportView(jTable);
setContentPane(jScrollPane);
setVisible(true);
} catch (IOException ioException) {
ioException.printStackTrace();
}
}
@Override
public void menuDeselected(MenuEvent e) {
}
@Override
public void menuCanceled(MenuEvent e) {
}
});
//添加查询事件
// quit.addMenuListener(new MenuListener() {
//
// @Override
// public void menuSelected(MenuEvent e) {
//
// }
//
// @Override
// public void menuDeselected(MenuEvent e) {
// System.exit(0);
// }
//
// @Override
// public void menuCanceled(MenuEvent e) {
//
// }
// });
fileMenu.addMenuListener(new MenuListener() {
@Override
public void menuSelected(MenuEvent e) {
// getTimeclassroom()a
addSelect();
//
// JLabel starttime = new JLabel("开始时间");
// starttime.setBounds(190,100,400,40);
// starttime.setFont(new Font("",Font.BOLD,20));
// jPanel.add(date);
//
// JLabel end = new JLabel("结束时间");
// end.setBounds(220,100,400,40);
// end.setFont(new Font("",Font.BOLD,20));
// jPanel.add(end);
setContentPane(jPanel);
}
@Override
public void menuDeselected(MenuEvent e) {
}
@Override
public void menuCanceled(MenuEvent e) {
}
});
// 添加审批界面
editMenu.addMenuListener(new MenuListener() {
@Override
public void menuSelected(MenuEvent e) {
JPanel jp = null;
try {
jp = addRequestSwing();
} catch (IOException ioException) {
ioException.printStackTrace();
}
setContentPane(jp);
setVisible(true);
}
@Override
public void menuDeselected(MenuEvent e) {
}
@Override
public void menuCanceled(MenuEvent e) {
}
});
// 添加我的申请界面
helpMenu.addMenuListener(new MenuListener() {
@Override
public void menuSelected(MenuEvent e) {
JScrollPane jScrollPane=new JScrollPane();
ArrayList<Request> requests = null;
try {
requests = new ServiceRequest().ServiceTeacherSelectArrylist(id);
} catch (IOException ioException) {
ioException.printStackTrace();
}
System.out.println(requests.toString());
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
20225754高杭州扩展实验.zip (86个子文件)
20225754高杭州扩展实验
代码文件
sql
classroom.sql 15KB
ClassRomeManger
pom.xml 1KB
src
main
resources
mybatis-config.xml 806B
com
lmx
Mapper
Mapper.xml 7KB
java
com
lmx
Until
MyFoundButton.java 5KB
MyShengpibutton.java 4KB
Requsetuntil.java 62B
MyRecoverbutton.java 4KB
Mybutton.java 4KB
LoginUntil.java 841B
MyEquipmentbutton.java 2KB
Mapper
Mapper.java 5KB
View
Person
Teacherlogin.java 32KB
Studentlogin.java 32KB
ManangerLogin.java 14KB
Request
StudentRequest.java 1KB
Login
LoginSwing.java 5KB
Service
ServiceManger.java 4KB
ServiceUser.java 6KB
ServiceSelect.java 105B
ServiceRequest.java 3KB
Pojo
Teacher.java 1KB
Equipment.java 2KB
Request.java 4KB
Course.java 2KB
Student.java 2KB
Manger.java 1KB
Croom.java 2KB
RequestLog.java 3KB
target
classes
mybatis-config.xml 806B
com
lmx
Until
MyFoundButton.class 4KB
MyShengpibutton.class 4KB
LoginUntil.class 1KB
Mybutton.class 4KB
MyEquipmentbutton.class 3KB
MyRecoverbutton.class 4KB
Requsetuntil.class 289B
Mapper
Mapper.xml 7KB
Mapper.class 4KB
View
Person
Studentlogin$6.class 2KB
Teacherlogin$3.class 1KB
Teacherlogin$7.class 5KB
Studentlogin$8.class 2KB
Studentlogin.class 11KB
ManangerLogin$3.class 4KB
Teacherlogin$10.class 2KB
Teacherlogin$1.class 5KB
Studentlogin$4.class 5KB
Studentlogin$10.class 2KB
Studentlogin$3.class 1KB
Teacherlogin$8.class 2KB
ManangerLogin$1.class 5KB
ManangerLogin.class 3KB
Studentlogin$1.class 5KB
Teacherlogin$9.class 2KB
Studentlogin$7.class 4KB
Teacherlogin$4.class 5KB
Teacherlogin$11.class 2KB
Studentlogin$5.class 1KB
ManangerLogin$4.class 5KB
Studentlogin$2.class 1KB
Studentlogin$9.class 2KB
Teacherlogin.class 12KB
Teacherlogin$6.class 2KB
Studentlogin$11.class 2KB
ManangerLogin$2.class 5KB
Teacherlogin$5.class 1KB
Teacherlogin$2.class 1KB
Request
StudentRequest.class 1KB
Login
LoginSwing$1.class 2KB
LoginSwing$2.class 745B
LoginSwing.class 5KB
Service
ServiceSelect.class 296B
ServiceRequest.class 4KB
ServiceUser.class 7KB
ServiceManger.class 4KB
Pojo
Request.class 5KB
RequestLog.class 3KB
Student.class 2KB
Teacher.class 2KB
Manger.class 1KB
Croom.class 2KB
Equipment.class 3KB
Course.class 3KB
ClassRomeManger.iml 81B
扩展实验报告20225754高杭州.pdf 1.84MB
共 86 条
- 1
资源评论
故故糕
- 粉丝: 186
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功