/*
* 文件名:UI_teacher.java
* 作者:高占恒
* 描述:老师界面:用于实现老师的各种功能
* 修改人: 高占恒
* 修改时间:2019-12-12
* 修改内容:添加注释
*/
package UI;
import DAO.Alarm_DAO;
import INFO.Person;
import SQL.Interface_UI_SQL;
import UI_Part.*;
import UI_Part.JList;
// 内部引用
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
// 外部注释
public class UI_teacher extends JFrame {
/*主框架控件*///===============================================
private static String path_m = "photo/Teacher_m.png";
private static String path_w = "photo/Teacher_w.png";
private static String path_button = "photo/UI_button.png";
// 定义背景图片
// 个人信息部分----------------------------
public String user_id; // 老师账号
private Person user_info; // 老师信息对象
private JPanel jpanel_info; // 信息部分中间容器
private JButton_Image jbutton_refr;
// 定义个人信息部分的刷新按钮
// 界面切换部分-------------------------------
private JPanel jpanel_swit; // 界面切换部分中间容器
private JButton jbutton_rece;
private JButton jbutton_send;
private JButton jbutton_anno;
private JButton jbutton_file;
private JButton jbutton_stud;
private JButton jbutton_grow;
// 定义界面切换部分的按钮:分别代表一个界面的显示
/* 子框架控件*///===========================================
// 收信箱------------------------------------
private JPanel jpanel_rece; // 收信箱栏目中间容器
private JList jlist_rece; // 收信箱栏目列表
//send
private JPanel jpanel_send; // 发信箱栏目中间容器
private JList jlist_send; // 发信箱栏目列表
private JButton jbutton_messsend; // 发信箱栏目提问按钮
//announce
private JPanel jpanel_anno; // 公告栏目中间容器
private JList jlist_anno; // 公告栏目列表
private JButton jbutton_annosend; // 公告栏栏目发公告按钮
//file
private JPanel jpanel_file; // 文件管理栏目中间容器
private JList jlist_file; // 文件管理栏目列表
private JButton jbutton_filechoose; // 文件管理栏目上传文件按钮
//stud
private JPanel jpanel_stud; // 学生信息栏目中间容器
private JList jlist_stud; // 学生信息栏目列表
private JButton jbutton_studadd; // 学生信息栏目添加学生按钮
//grow
private JPanel jpanel_grow; // 成长档案栏目中间容器
private JList jlist_grow; // 成长档案栏目列表
//------------------------------------------------------------------------------------------------------------------
public UI_teacher(String username) throws SQLException, IOException {
user_id = username;
user_info = new Person(Interface_UI_SQL.SQLgetTeaInfo(user_id));
tea_init();
}
/* 老师界面*///======================================================================================================
//
// @function : 初始化老师界面,包括更新各列表、界面。
//
private void tea_init() throws SQLException, IOException {
/* 主框架控件*///================================================================================================
// 个人信息部分---------------------------------------------------------------------------------------------------
{
jpanel_info = new JPanel();
jpanel_info.setLayout(null);
jpanel_info.setBounds(0,0,540,120);
// 定义个人信息部分中间容器
jbutton_refr = new JButton_Image(443,65,60,40,"刷新",path_m,jpanel_info);
jbutton_refr.addColor(new Color(188, 248, 255));
jbutton_refr.addActionListener(new ActionListener(){
@Override
public void actionPerformed(ActionEvent e) {
try {
refresh();
} catch (SQLException | IOException ex) {
ex.printStackTrace();
}
}
});
// 设置修改信息和刷新按钮并添加回调函数
info_init();
// 运行个人信息初始化 包括获取个人信息并显示
}
//界面切换部分--------------------------------------------------------------------------------------------------------
{
jpanel_swit = new JPanel();
jpanel_swit.setLayout(null);
jpanel_swit.setBounds(0, 250, 150, 470);
jpanel_swit.setBackground(new Color(197, 255, 0, 0));
// 定义界面切换部分中间容器
jbutton_rece = new JButton_Image(20, 15, 110, 40,"收信箱",path_m,jpanel_swit);
jbutton_rece.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
swit_rece();
}
});
jbutton_send = new JButton_Image(20, 67, 110, 40,"发信箱",path_m,jpanel_swit);
jbutton_send.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
swit_send();
}
});
jbutton_anno = new JButton_Image(20, 118, 110, 40,"公告通知",path_m,jpanel_swit);
jbutton_anno.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
swit_anno();
}
});
jbutton_file = new JButton_Image(20, 168, 110, 40,"文件管理",path_m,jpanel_swit);
jbutton_file.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
swit_file();
}
});
jbutton_stud = new JButton_Image(20, 218, 110, 40,"学生管理",path_m,jpanel_swit);
jbutton_stud.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
swit_stud();
}
});
jbutton_grow = new JButton_Image(20, 270, 110, 40,"成长档案",path_m,jpanel_swit);
jbutton_grow.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
swit_grow();
}
});
// 设置六个界面切换按钮并添加回调函数
}
/* 子框架控件*///================================================================================================
// 收信箱栏目-------------------------------------------------------------------------------------------------------
{
jlist_rece = new JList(user_id,7); // 添加列表 模式为老师收信箱(7)
jlist_rece.jbutton_fileproP.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
jlist_rece.Page--;
try {
jlist_rece.list_init();
} catch (SQLException | IOException ex) {
ex.printStackTrace();
}
UI_teacher.super.repaint();
}