/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/*
* SelectiveMainFrame.java
*
* Created on 2014-7-8, 10:04:34
*/
package com.gs.stu.view;
import com.gs.stu.bean.*;
import com.gs.stu.util.FrameUtil;
import com.gs.stu.util.LocationUtil;
import java.beans.PropertyVetoException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JInternalFrame;
/**
*
* @author Administrator
*/
public class SelectiveMainFrame extends javax.swing.JFrame {
public static Manager manager;
public static Teacher teacher;
public static Student student;
/** Creates new form SelectiveMainFrame */
public SelectiveMainFrame() {
initComponents();
LocationUtil.setFullScreen(this);
if(manager!=null)
{
this.setTitle("学生选课系统 "+manager.getSysaccount()+",欢迎您!");
teacherMenu.setEnabled(false);
studentMenu.setEnabled(false);
}
if(teacher!=null)
{
this.setTitle("学生选课系统 "+teacher.getTname()+",欢迎您!");
managerMenu.setEnabled(false);
studentMenu.setEnabled(false);
}
if(student!=null)
{
this.setTitle("学生选课系统 "+student.getSname()+",欢迎您!");
teacherMenu.setEnabled(false);
managerMenu.setEnabled(false);
}
}
/** This method is called from within the constructor to
* initialize the form.
* WARNING: Do NOT modify this code. The content of this method is
* always regenerated by the Form Editor.
*/
@SuppressWarnings("unchecked")
//
private void initComponents() {
jMenu1 = new javax.swing.JMenu();
jMenu2 = new javax.swing.JMenu();
mainDesktopPane1 = new com.gs.stu.view.MainDesktopPane();
jMenuBar1 = new javax.swing.JMenuBar();
managerMenu = new javax.swing.JMenu();
managerMenuItem = new javax.swing.JMenuItem();
departmentMenuItem = new javax.swing.JMenuItem();
classMenuItem = new javax.swing.JMenuItem();
teacherMenuItem = new javax.swing.JMenuItem();
courseMenuItem = new javax.swing.JMenuItem();
studentMenuItem = new javax.swing.JMenuItem();
logMenuItem = new javax.swing.JMenuItem();
teacherMenu = new javax.swing.JMenu();
updateTpwdMenuItem = new javax.swing.JMenuItem();
queryTeachMenuItem = new javax.swing.JMenuItem();
querySelectMenuItem = new javax.swing.JMenuItem();
ScoreMenuItem = new javax.swing.JMenuItem();
studentMenu = new javax.swing.JMenu();
updateSpwdMenuItem = new javax.swing.JMenuItem();
selectCourseMenuItem = new javax.swing.JMenuItem();
PersonalSelectMenuItem = new javax.swing.JMenuItem();
queryScoreMenuItem = new javax.swing.JMenuItem();
returnMenu = new javax.swing.JMenu();
jMenuItem1 = new javax.swing.JMenuItem();
jMenuItem2 = new javax.swing.JMenuItem();
jMenu1.setText("jMenu1");
jMenu2.setText("jMenu2");
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
setTitle("学生选课系统");
mainDesktopPane1.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
mainDesktopPane1MouseClicked(evt);
}
});
managerMenu.setText("管理员");
managerMenuItem.setText("管理员管理");
managerMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
managerMenuItemActionPerformed(evt);
}
});
managerMenu.add(managerMenuItem);
departmentMenuItem.setText("系部管理");
departmentMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
departmentMenuItemActionPerformed(evt);
}
});
managerMenu.add(departmentMenuItem);
classMenuItem.setText("班级管理");
classMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
classMenuItemActionPerformed(evt);
}
});
managerMenu.add(classMenuItem);
teacherMenuItem.setText("教师管理");
teacherMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
teacherMenuItemActionPerformed(evt);
}
});
managerMenu.add(teacherMenuItem);
courseMenuItem.setText("课程管理");
courseMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
courseMenuItemActionPerformed(evt);
}
});
managerMenu.add(courseMenuItem);
studentMenuItem.setText("学生管理");
studentMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
studentMenuItemActionPerformed(evt);
}
});
managerMenu.add(studentMenuItem);
logMenuItem.setText("日志管理");
logMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
logMenuItemActionPerformed(evt);
}
});
managerMenu.add(logMenuItem);
jMenuBar1.add(managerMenu);
teacherMenu.setText("教师");
updateTpwdMenuItem.setText("修改密码");
updateTpwdMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
updateTpwdMenuItemActionPerformed(evt);
}
});
teacherMenu.add(updateTpwdMenuItem);
queryTeachMenuItem.setText("查看任课信息");
queryTeachMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
queryTeachMenuItemActionPerformed(evt);
}
});
teacherMenu.add(queryTeachMenuItem);
querySelectMenuItem.setText("查看选课信息");
querySelectMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
querySelectMenuItemActionPerformed(evt);
}
});
teacherMenu.add(querySelectMenuItem);
ScoreMenuItem.setText("成绩管理");
ScoreMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
ScoreMenuItemActionPerformed(evt);
}
});
teacherMenu.add(ScoreMenuItem);
jMenuBar1.add(teacherMenu);
studentMenu.setText("学生");
updateSpwdMenuItem.setText("修改密码");
updateSpwdMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
updateSpwdMenuItemActionPerformed(evt);
}
});
studentMenu.add(updateSpwdMenuItem);
selectCourseMenuItem.setText("选课");
selectCourseMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
selectCourseMenuItemActionPerformed(evt);
}
});
studentMenu.add(selectCourseMenuItem);
PersonalSelectMenuItem.setText("个人选课信息");
PersonalSelectMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
PersonalSelectMenuItemActionPerformed(evt);
}
});
studentMenu.add(PersonalSelectMenuItem);
queryScoreMenuItem.setText("成绩查询");
queryScoreMenuItem.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
queryScoreMenuItemActionPerformed(evt);
}
});
studentMenu.add(queryScoreMenuItem);
jMenuBar1.add(studentMenu);
returnMenu.setText("退出");
returnMenu.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
returnMenuMouseClicked(evt);
}
});
jMenuItem1.setText("退出系统");
jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem1ActionPerformed(evt);
}
});
returnMenu.add(jMenuItem1);
jMenuItem2.setText("切换账户");
jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
jMenuItem2ActionPerformed(evt);
}
});
returnMenu.add(jMenuItem2);
jMenuBar1.add(returnMenu);
setJMenuBar(jMenuBar1);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 495, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(mainDesktopPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 360, Short.MAX_VALUE)
);
pack();
}//
private void managerMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("managerframe");
}
private void departmentMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("departmentframe");
}
private void classMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("classframe");
}
private void teacherMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("teacherframe");
}
private void courseMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here
showFrame("courseframe");
}
private void studentMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("studentframe");
}
private void logMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("logframe");
}
private void updateTpwdMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("teaupdatepwdframe");
}
private void queryTeachMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("teasearchteachframe");
}
private void querySelectMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("teasearchselectframe");
}
private void ScoreMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("teascoreframe");
}
private void updateSpwdMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("stuspdateswdsrame");
}
private void selectCourseMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("stuselectcourseframe");
}
private void PersonalSelectMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("stusearchselfselectframe");
}
private void queryScoreMenuItemActionPerformed(java.awt.event.ActionEvent evt) {
showFrame("stusearchscoresframe");
}
private void returnMenuMouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
}
private void mainDesktopPane1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
}
private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {
this.dispose(); // TODO add your handling code here:
}
private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {
new LoginFrame().setVisible(true);
this.dispose();// TODO add your handling code here:
}
/**
* @param args the command line arguments
*/
public static void main(String args[]) {
/* Set the Nimbus look and feel */
//
/* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
* For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
*/
try {
for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(SelectiveMainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(SelectiveMainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(SelectiveMainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
java.util.logging.Logger.getLogger(SelectiveMainFrame.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
}
//
/* Create and display the form */
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new SelectiveMainFrame().setVisible(true);
}
});
}
private void showFrame(String frameName)
{
JInternalFrame internalFrame=FrameUtil.buildInternalFrame(frameName);
mainDesktopPane1.remove(internalFrame);
mainDesktopPane1.add(internalFrame);
LocationUtil.setParentCenter(this,internalFrame);
internalFrame.setVisible(true);
internalFrame.toFront();//最前
try {
internalFrame.setSelected(true);
} catch (PropertyVetoException ex) {
Logger.getLogger(SelectiveMainFrame.class.getName()).log(Level.SEVERE, null, ex);
}
}
// Variables declaration - do not modify
private javax.swing.JMenuItem PersonalSelectMenuItem;
private javax.swing.JMenuItem ScoreMenuItem;
private javax.swing.JMenuItem classMenuItem;
private javax.swing.JMenuItem courseMenuItem;
private javax.swing.JMenuItem departmentMenuItem;
private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private javax.swing.JMenuBar jMenuBar1;
private javax.swing.JMenuItem jMenuItem1;
private javax.swing.JMenuItem jMenuItem2;
private javax.swing.JMenuItem logMenuItem;
private com.gs.stu.view.MainDesktopPane mainDesktopPane1;
private javax.swing.JMenu managerMenu;
private javax.swing.JMenuItem managerMenuItem;
private javax.swing.JMenuItem queryScoreMenuItem;
private javax.swing.JMenuItem querySelectMenuItem;
private javax.swing.JMenuItem queryTeachMenuItem;
private javax.swing.JMenu returnMenu;
private javax.swing.JMenuItem selectCourseMenuItem;
private javax.swing.JMenu studentMenu;
private javax.swing.JMenuItem studentMenuItem;
private javax.swing.JMenu teacherMenu;
private javax.swing.JMenuItem teacherMenuItem;
private javax.swing.JMenuItem updateSpwdMenuItem;
private javax.swing.JMenuItem updateTpwdMenuItem;
// End of variables declaration
}