📄 中心机房管理.txt
字号:
//POS管理主菜单START
private JMenu createPosMenu()
{
JMenu posMenu;
posMenu = new JMenu("E.POS管理");
posMenu.setMnemonic('E');
posMenu.setToolTipText("POS管理,商户管理");
posMenu.getAccessibleContext().setAccessibleDescription("The standard defined");
// POS管理START
JMenuItem posSetMenuItem=new JMenuItem("POS管理");
posSetMenuItem.setToolTipText("POS用户设置");
posSetMenuItem.getAccessibleContext().setAccessibleDescription("POS用户设置");
posSetMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
doPosUserSet();
}
});
// POS管理END
//商户管理start
JMenuItem merchantSetMenuItem=new JMenuItem("商户管理");
merchantSetMenuItem.setToolTipText("POS用户设置");
merchantSetMenuItem.getAccessibleContext().setAccessibleDescription("POS用户设置");
merchantSetMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
doMerchantUserSet();
}
});
//商户管理end
//pos冲账start
JMenuItem posstrikeSetMenuItem=new JMenuItem("POS冲账");
posstrikeSetMenuItem.setToolTipText("POS冲账处理");
posstrikeSetMenuItem.getAccessibleContext().setAccessibleDescription("POS冲账处理");
posstrikeSetMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
PosStrikePanel bet=new PosStrikePanel();
}
});
//POS冲账end
//ATM管理start
JMenuItem ATMSetMenuItem=new JMenuItem("ATM管理");
ATMSetMenuItem.setToolTipText("ATM用户设置");
ATMSetMenuItem.getAccessibleContext().setAccessibleDescription("ATM用户设置");
ATMSetMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
doATMUserSet();
}
});
//ATM管理end
posMenu.add((posSetMenuItem));
posMenu.addSeparator();
posMenu.add(( merchantSetMenuItem));
posMenu.addSeparator();
posMenu.add(( ATMSetMenuItem));
posMenu.addSeparator();
posMenu.add(( posstrikeSetMenuItem));
return posMenu;
}
private JMenu createSystemMenu()
{
//系统主菜单start
JMenu systemMenu;//界面设置主菜单
systemMenu = new JMenu("S.系统设置");
systemMenu.setMnemonic('S');
systemMenu.setToolTipText("用户设置,帮助等");
systemMenu.getAccessibleContext().setAccessibleDescription("The standard defined display interface");
//系统主菜单end;
//关于界面设置的菜单选项start
JMenu displayMenu;//设置菜单
ConfigActionListener l=new ConfigActionListener();
JRadioButtonMenuItem item1;
JRadioButtonMenuItem item2;
JRadioButtonMenuItem item3;
displayMenu = new JMenu("S.系统设置");
displayMenu.setMnemonic('H');
displayMenu.setToolTipText("系统设置");
displayMenu.getAccessibleContext().setAccessibleDescription("setup");
item1= new JRadioButtonMenuItem("金 属 界 面",true);
item2= new JRadioButtonMenuItem("Solaris界面",true);
item3= new JRadioButtonMenuItem("WINDOW 界面",true);
ButtonGroup group = new ButtonGroup();
group.add(item1);
displayMenu.add(item1);
item1.setActionCommand("Metal");
item1.setToolTipText("夸平台界面,金属组特制!");
item1.addActionListener(l);
item1.setSelected(true);
group.add(item2);
displayMenu.add(item2);
item2.setActionCommand("Motif");
item2.setToolTipText("模拟Macintosh的界面,充满活力");
item2.addActionListener(l);
group.add(item3);
displayMenu.add(item3);
item3.setActionCommand("Windows");
item3.setToolTipText("模拟WINDOW 的界面,喜欢WINDOWS则可用它!");
item3.addActionListener(l);
item3.setSelected(true);
systemMenu.add(displayMenu);
//关于界面设置的菜单选项end
systemMenu.addSeparator();
//帮助 start
JMenuItem helpMenuItem;//关于菜单项
helpMenuItem = new JMenuItem("H.帮助");
helpMenuItem.setMnemonic('H');
helpMenuItem.setToolTipText("如有疑问?点击此项会有启发!");
helpMenuItem.getAccessibleContext().setAccessibleDescription("Find out about the SwingSet application");
systemMenu.add(helpMenuItem);
helpMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
displayRegisterInternalFrame();
repaint();
}
});
//帮助 end
//关于我们的... start
JMenuItem aboutMenuItem;//关于菜单项
aboutMenuItem = new JMenuItem("A.关于我们的...");
aboutMenuItem.setMnemonic('A');
aboutMenuItem.setToolTipText("关于我们的一些信息");
aboutMenuItem.getAccessibleContext().setAccessibleDescription("Find out about the SwingSet application");
systemMenu.add(aboutMenuItem);
aboutMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
doAboutUs();
}
});
//关于我们的... end
systemMenu.addSeparator();
//退出程序 start
JMenuItem exitMenuItem;//退出菜单项
exitMenuItem=(JMenuItem) systemMenu.add(new JMenuItem("X.退出"));
exitMenuItem.setMnemonic('X');
exitMenuItem.setToolTipText("退出整个系统");
exitMenuItem.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
CenterUtilClass.doExit(0);
}
});
//退出程序 end
return systemMenu;
}
/**
*此函数用于创建一个状态条,反应当前的状态信息
**/
static JPanel createStatusBar()
{
JPanel s=new JPanel();
Dimension d=CenterMainPanel.desktop.getSize();
s.setBounds(0,0,d.width,30);
s.setBorder(BorderFactory.createBevelBorder(1,Color.cyan,Color.green));
s.setLayout(new GridLayout(1,3,2,2));//共一行三列
JPanel systemNotePanel=new JPanel(new BorderLayout());
systemNotePanel.setBorder(BorderFactory.createBevelBorder(1,Color.black,Color.cyan));
systemNotePanel.setSize(410,25);
CenterMainPanel.systemNoteLabel.setText("系统提示:");
CenterMainPanel.systemNoteLabel.setBounds(0,0,400,20);
systemNotePanel.add("Center",CenterMainPanel.systemNoteLabel);
JPanel operatorPanel=new JPanel(new BorderLayout());
operatorPanel.setBorder(BorderFactory.createBevelBorder(1,Color.black,Color.cyan));
operatorPanel.setSize(210,25);
CenterMainPanel.operatorLabel.setBounds(0,0,200,20);
CenterMainPanel.operatorLabel.setText("登录操作员");
// CenterMainPanel.operatorLabel.setText("登录操作员"+);
CenterMainPanel.operatorLabel.setForeground(Color.red);
operatorPanel.add("Center",CenterMainPanel.operatorLabel);
// CenterMainPanel.operatorLabel.setText();
CenterMainPanel.operatorLabel.setIcon(CenterUtilClass.ICON_COFFEE);
JPanel systemDateTimePanel=new JPanel(new BorderLayout());
systemDateTimePanel.setBorder(BorderFactory.createBevelBorder(1,Color.black,Color.cyan));
CenterMainPanel.systemDateTimeButton.setBounds(0,0,250,20);
systemDateTimePanel.add("Center",CenterMainPanel.systemDateTimeButton);
CenterMainPanel.systemDateTimeButton.setLabel("登录:"+CenterUtilClass.getCurrentDateTime());
CenterMainPanel.systemDateTimeButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e)
{
if(CenterMainPanel.isLoginOn)
{
String str=CenterUtilClass.getCurrentDateTime();
JOptionPane.showMessageDialog(null,"系统当前时间:"+str,"显示系统时间",JOptionPane.PLAIN_MESSAGE);
// CenterMainPanel.systemDateTimeButton.setLabel(str);
}
}
});
s.add(systemNotePanel);
s.add(operatorPanel);
s.add(systemDateTimePanel);
return s;
}
/**
*此函数创建一个新的工具条
**/
JToolBar createToolBar() {
JToolBar toolBar = new JToolBar();
toolBar.setLayout(new FlowLayout(FlowLayout.LEFT,0,0));
addButton = new JButton("添加");
addButton.setIcon(new ImageIcon("../centerimage/add.gif"));
addButton.setToolTipText("在表中添加新的纪录...");
addButton.setCursor(new Cursor(Cursor.HAND_CURSOR) );
addButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
if(currentITable==null) return;
ITable commonITable = (ITable)currentITable;
commonITable.addRecord(null);
}
});
modifyButton = new JButton("修改");
modifyButton.setIcon(new ImageIcon("../centerimage/modify.gif"));
modifyButton.setToolTipText("修改表纪录...");
modifyButton.setCursor(new Cursor(Cursor.HAND_CURSOR) );
modifyButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
if(currentITable==null) return;
ITable commonITable = (ITable)currentITable;
commonITable.modifyRecord(1);
}
});
deleteButton = new JButton("删去");
deleteButton.setIcon(new ImageIcon("../centerimage/delete.gif"));
deleteButton.setToolTipText("删除表中的纪录...");
deleteButton.setCursor(new Cursor(Cursor.HAND_CURSOR) );
deleteButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
if(currentITable==null) return;
ITable commonITable = (ITable)currentITable;
commonITable.deleteRecord(1);
}
});
/*
confirmButton = new JButton("确认");
confirmButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{;
}
});
confirmButton.setIcon(new ImageIcon("../centerimage/confirm.gif"));
confirmButton.setToolTipText("确认处理!");
confirmButton.setCursor(new Cursor(Cursor.HAND_CURSOR) );
cancelButton = new JButton("取消");
cancelButton.setIcon(new ImageIcon("../centerimage/cancel.gif"));
cancelButton.setToolTipText("取消处理!");
cancelButton.setCursor(new Cursor(Cursor.HAND_CURSOR) );
*/
refreshButton = new JButton("刷新");
refreshButton.setIcon(new ImageIcon("../centerimage/refresh.gif"));
refreshButton.setToolTipText("重新读取数据...");
refreshButton.setCursor(new Cursor(Cursor.HAND_CURSOR) );
refreshButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{
if(currentITable==null) return;
ITable commonITable = (ITable)currentITable;
try{
commonITable.refreshTable();
}catch(Exception re){
System.out.println("refresh table error");
return;
}
}
});
pageButton = new JButton("翻页");
//centerlog.centerlog(centerlog.getCurrentDateTime1(), "fanye......2");
pageButton.setIcon(new ImageIcon("../centerimage/next.gif"));
pageButton.setToolTipText("向后翻!");
pageButton.setCursor(new Cursor(Cursor.HAND_CURSOR) );
pageButton.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e)
{ //centerlog.centerlog(centerlog.getCurrentDateTime1(), "fanye......1");
if (currentITable==null )return;
//centerlog.centerlog(centerlog.getCurrentDateTime1(), "fanye......3");
ITable commonITable=(ITable)currentITable;
//centerlog.centerlog(centerlog.getCurrentDateTime1(), "fanye......4");
try{
// centerlog.centerlog(centerlog.getCurrentDateTime1(), "fanye......");
commonITable.pagedownTable();
}catch(Exception pa){
System.out.println("refresh table error");
return;
}
}
});
toolBar.setFloatable(true);
toolBar.add(addButton);
toolBar.add(modifyButton);
toolBar.add(deleteButton);
// toolBar.add(confirmButton);
// toolBar.add(cancelButton);
toolBar.add(refreshButton);
toolBar.add(pageButton);
return toolBar;
}
}
class ConfigActionListener implements ActionListener
{
static String metal= "Metal";
static String metalClassName = "javax.swing.plaf.metal.MetalLookAndFeel";
static String motif = "Motif";
static String motifClassName =
"com.sun.java.swing.plaf.motif.MotifLookAndFeel";
static String windows = "Windows";
static String windowsClassName =
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
public void actionPerformed(ActionEvent e)
{
String lnfName = e.getActionCommand();
String path="";
if (lnfName.equals("Metal" )) {
path=metalClassName;
}else if (lnfName.equals("Motif" )){
path=motifClassName;
}else if (lnfName.equals("Windows" )){
path=windowsClassName;
} else { path=metalClassName;
}
Component root = CenterUtilClass.getRootComponent();
try
{
root.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
UIManager.setLookAndFeel(path);
SwingUtilities.updateComponentTreeUI(CenterUtilClass.getRootComponent());
}
catch (Exception exc)
{
JRadioButton button = (JRadioButton)e.getSource();
button.setEnabled(false);
updateState();
System.err.println("找不到此界面: " + lnfName+",系统不支持!");
}
root.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
public void updateState()
{
System.err.println("对不起,系统无法知道设置界面! " );
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -