package netbar;
import javax.swing.JFrame;
import javax.swing.JMenuBar;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.*;
public class Manager extends JFrame {
public static int cpc;
public Manager() {
try {
jbInit();
} catch (Exception ex) {
ex.printStackTrace();
}
}
private void jbInit() throws Exception {
this.getContentPane().setLayout(null);
this.setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
this.setJMenuBar(jMenuBar1);
this.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent arg0) {
System.exit(0);
}
});
menManager.setText("管理员");
RLanding.setText("重新登陆");
RLanding.addActionListener(new Manager_RLanding_actionAdapter(this));
AddManager.setText("添加管理员");
AddManager.addActionListener(new Manager_AddManager_actionAdapter(this));
DeleteManager.setText("删除管理员");
DeleteManager.addActionListener(new Manager_DeleteManager_actionAdapter(this));
ReworkPassword.setText("修改密码");
ReworkPassword.addActionListener(new
Manager_ReworkPassword_actionAdapter(this));
NoteOfManager.setText("管理员资料");
NoteOfManager.addActionListener(new Manager_NoteOfManager_actionAdapter(this));
LockedManager.setText("锁定管理员");
LockedManager.addActionListener(new Manager_LockedManager_actionAdapter(this));
ReleaseManager.setText("释放管理员");
ReleaseManager.addActionListener(new
Manager_ReleaseManager_actionAdapter(this));
WorkOfManager.setText("工作情况");
WorkOfManager.addActionListener(new Manager_WorkOfManager_actionAdapter(this));
ExitOfManager.setText("退出");
ExitOfManager.addActionListener(new Manager_ExitOfManager_actionAdapter(this));
menUse.setText("使用");
DoneNetting.addActionListener(new Manager_DoneNetting_actionAdapter(this));
OutNetting.setText("下机");
OutNetting.addActionListener(new Manager_OutNetting_actionAdapter(this));
menAssociator.setText("会员 ");
AddAssociator.setText("添加会员");
AddAssociator.addActionListener(new Manager_AddAssociator_actionAdapter(this));
AddPrice.setText("充值");
AddPrice.addActionListener(new Manager_AddPrice_actionAdapter(this));
LockedASSociator.setText("锁定会员");
LockedASSociator.addActionListener(new
Manager_LockedASSociator_actionAdapter(this));
ReleaseAssociator.setText("释放会员");
ReleaseAssociator.addActionListener(new
Manager_ReleaseAssociator_actionAdapter(this));
DeleteAssociator.setText("删除会员");
DeleteAssociator.addActionListener(new
Manager_DeleteAssociator_actionAdapter(this));
menHlep.setText("帮助");
Helping.setText("帮助");
Helping.addActionListener(new Manager_Helping_actionAdapter(this));
RewrokPassword.setText("修改密码");
RewrokPassword.addActionListener(new
Manager_RewrokPassword_actionAdapter(this));
MessageOfUse.setText("用户信息");
MessageOfUse.addActionListener(new Manager_jMenuItem1_actionAdapter(this));
DoneNetting.setText("上机");
jMenuBar1.add(menManager);
jMenuBar1.add(menUse);
jMenuBar1.add(menAssociator);
jMenuBar1.add(menHlep);
menManager.add(RLanding);
menManager.add(AddManager);
menManager.add(DeleteManager);
menManager.add(ReworkPassword);
menManager.add(NoteOfManager);
menManager.add(LockedManager);
menManager.add(ReleaseManager);
menManager.add(WorkOfManager);
menManager.add(ExitOfManager);
menUse.add(DoneNetting);
menUse.add(OutNetting);
menAssociator.add(AddAssociator);
menAssociator.add(AddPrice);
menAssociator.add(RewrokPassword);
menAssociator.addSeparator();
menAssociator.add(MessageOfUse);
menAssociator.add(LockedASSociator);
menAssociator.add(ReleaseAssociator);
menAssociator.add(DeleteAssociator);
menHlep.add(Helping);
}
JMenuBar jMenuBar1 = new JMenuBar();
JMenu menManager = new JMenu();
JMenuItem RLanding = new JMenuItem();
JMenuItem AddManager = new JMenuItem();
JMenuItem DeleteManager = new JMenuItem();
JMenuItem ReworkPassword = new JMenuItem();
JMenuItem NoteOfManager = new JMenuItem();
JMenuItem LockedManager = new JMenuItem();
JMenuItem ReleaseManager = new JMenuItem();
JMenuItem WorkOfManager = new JMenuItem();
JMenuItem ExitOfManager = new JMenuItem();
JMenu menUse = new JMenu();
JMenuItem DoneNetting = new JMenuItem();
JMenuItem OutNetting = new JMenuItem();
JMenu menAssociator = new JMenu();
JMenuItem AddAssociator = new JMenuItem();
JMenuItem AddPrice = new JMenuItem();
JMenuItem LockedASSociator = new JMenuItem();
JMenuItem ReleaseAssociator = new JMenuItem();
JMenuItem DeleteAssociator = new JMenuItem();
JMenu menHlep = new JMenu();
JMenuItem Helping = new JMenuItem();
JMenuItem RewrokPassword = new JMenuItem();
JMenuItem MessageOfUse = new JMenuItem();
//退出
public void ExitOfManager_actionPerformed(ActionEvent e) {
ManagerDate managerdate=new ManagerDate();
String endtime=GetTime.gettime(); //获取结束时间
String cardId=LandingOfManager.cardId;
String begintime=managerdate.getBeginTime(cardId);//获得开始时间
int time=managerdate.getManagerTime(begintime,endtime);
int isExit=JOptionPane.showConfirmDialog(this,cardId+"管理员"+"\n您确定要退出吗?");
switch(isExit){
case 0:
managerdate.notedate(cardId,endtime,time);//记录数据
this.dispose();
break;
case 1:break;
case 2: break;
}
}
//重新登陆
public void RLanding_actionPerformed(ActionEvent e) {
LandingOfManager landingofmanager=new LandingOfManager();
ManagerDate managerdate=new ManagerDate();
String endtime=GetTime.gettime(); //获取结束时间
String cardId=LandingOfManager.cardId;
String begintime=managerdate.getBeginTime(cardId);//获得开始时间
int time=managerdate.getManagerTime(begintime,endtime);
managerdate.notedate(cardId,endtime,time);//记录数据
this.dispose();
landingofmanager.setSize(300,250);
landingofmanager.show();
}
//添加管理员
public void AddManager_actionPerformed(ActionEvent e) {
AddManager addmanager=new AddManager();
addmanager.setSize(380,350);
addmanager.setTitle("添加管理员");
addmanager.show();
}
//删除管理员
public void DeleteManager_actionPerformed(ActionEvent e) {
Delete delete=new Delete();
delete.setSize(350,200);
delete.setTitle("删除管理员");
delete.show();
}
//修改密码
public void ReworkPassword_actionPerformed(ActionEvent e) {
cpc=1;
ReworkPassword reworkpassword=new ReworkPassword();
reworkpassword.setSize(323,238);
reworkpassword.show();
}
//管理员资料
public void NoteOfManager_actionPerformed(ActionEvent e) {
NoteOfManager noteofmanager=new NoteOfManager();
noteofmanager.setSize(400,400);
noteofmanager.setTitle("管理员资料");
noteofmanager.show();
}