📄 bankadmin.java
字号:
/* * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved. U.S. * Government Rights - Commercial software. Government users are subject * to the Sun Microsystems, Inc. standard license agreement and * applicable provisions of the FAR and its supplements. Use is subject * to license terms. * * This distribution may include materials developed by third parties. * Sun, Sun Microsystems, the Sun logo, Java and J2EE are trademarks * or registered trademarks of Sun Microsystems, Inc. in the U.S. and * other countries. * * Copyright (c) 2005 Sun Microsystems, Inc. Tous droits reserves. * * Droits du gouvernement americain, utilisateurs gouvernementaux - logiciel * commercial. Les utilisateurs gouvernementaux sont soumis au contrat de * licence standard de Sun Microsystems, Inc., ainsi qu'aux dispositions * en vigueur de la FAR (Federal Acquisition Regulations) et des * supplements a celles-ci. Distribue par des licences qui en * restreignent l'utilisation. * * Cette distribution peut comprendre des composants developpes par des * tierces parties. Sun, Sun Microsystems, le logo Sun, Java et J2EE * sont des marques de fabrique ou des marques deposees de Sun * Microsystems, Inc. aux Etats-Unis et dans d'autres pays. */package com.sun.ebank.appclient;import java.util.Locale;import java.util.ResourceBundle;import java.text.NumberFormat;import java.text.DateFormat;import java.io.File;import java.io.RandomAccessFile;import java.io.FileNotFoundException;import java.io.IOException;import java.util.ArrayList;import java.util.Date;import java.math.BigDecimal;import java.awt.GridLayout;import java.awt.Color;import java.awt.event.WindowAdapter;import java.awt.event.WindowListener;import java.awt.event.WindowEvent;import java.awt.event.KeyEvent;import javax.swing.*;public class BankAdmin extends JFrame { //Protected instance variables protected static BankAdmin frame; protected static EventHandle ehandle; //Internationalization private static Locale currentLocale = null; protected static ResourceBundle messages = null; protected String desc; protected JButton OK; protected JButton cancel; protected JPanel p1; protected JPanel p2; protected JLabel fnamelab; protected JLabel lnamelab; protected JLabel milab; protected JLabel streetlab; protected JLabel citylab; protected JLabel statelab; protected JLabel ziplab; protected JLabel phonelab; protected JLabel emaillab; protected JLabel spacerlab1; protected JLabel spacerlab2; protected JLabel messlab; protected JLabel messlab2; protected JLabel messlab3; protected JLabel messlab4; protected JLabel messlab5; protected JLabel messlab6; protected JLabel descriplab; protected JLabel typelab; protected JLabel balab; protected JLabel creditlab; protected JLabel begbalab; protected JLabel customerlab; protected JLabel timelab; protected JMenuBar mb; protected JMenu custmenu; protected JMenu actmenu; protected JMenuItem createcust; protected JMenuItem viewcust; protected JMenuItem updatecust; protected JMenuItem createact; protected JMenuItem viewact; protected JMenuItem addcust; protected JMenuItem remact; protected JMenuItem srchcust; protected JRadioButton checkingact; protected JRadioButton savingsact; protected JRadioButton creditact; protected JRadioButton mnymktact; protected ButtonGroup group; protected JPanel radioPanel; //Editable variables protected JTextField fname; //Editable variables protected JTextField lname; //Editable variables protected JTextField mi; //Editable variables protected JTextField street; //Editable variables protected JTextField city; //Editable variables protected JTextField state; //Editable variables protected JTextField account; //Editable variables protected JTextField customer; //Editable variables protected JTextField zip; //Editable variables protected JTextField phone; //Editable variables protected JTextField e; //Editable variables protected JTextField descrip; //Editable variables protected JTextField type; //Editable variables protected JTextField bal; //Editable variables protected JTextField credit; //Editable variables protected JTextField begbal; //Editable variables protected JTextField cust; //Editable variables protected JTextField time; //Constructor public BankAdmin(Locale currentLocale) { //Internationalization setup messages = ResourceBundle.getBundle("appclient.AdminMessages", currentLocale); //Create initial UI (Panel 1) getContentPane() .setLayout(new GridLayout(1, 2)); p1 = new JPanel(); p1.setLayout(new GridLayout(20, 1)); p2 = new JPanel(); p2.setLayout(new GridLayout(0, 2)); p1.setBackground(Color.white); p2.setBackground(Color.gray); getContentPane() .add(p1); getContentPane() .add(p2); //Build menu bar mb = new JMenuBar(); setJMenuBar(mb); //Build Customer menu custmenu = new JMenu(messages.getString("CustAdmin"), true); custmenu.setMnemonic(KeyEvent.VK_C); mb.add(custmenu); createcust = new JMenuItem(messages.getString("CreateCust")); createcust.setMnemonic(KeyEvent.VK_U); viewcust = new JMenuItem(messages.getString("ViewCust")); viewcust.setMnemonic(KeyEvent.VK_V); updatecust = new JMenuItem(messages.getString("UpdateCust")); updatecust.setMnemonic(KeyEvent.VK_D); srchcust = new JMenuItem(messages.getString("SearchCust")); srchcust.setMnemonic(KeyEvent.VK_S); custmenu.add(createcust); custmenu.add(viewcust); custmenu.add(updatecust); custmenu.add(srchcust); //Build Account Menu actmenu = new JMenu(messages.getString("ActAdmin"), true); actmenu.setMnemonic(KeyEvent.VK_A); mb.add(actmenu); createact = new JMenuItem(messages.getString("CreateAct")); createact.setMnemonic(KeyEvent.VK_R); addcust = new JMenuItem(messages.getString("AddCust")); addcust.setMnemonic(KeyEvent.VK_T); viewact = new JMenuItem(messages.getString("ViewAct")); viewact.setMnemonic(KeyEvent.VK_I); remact = new JMenuItem(messages.getString("RemAct")); remact.setMnemonic(KeyEvent.VK_O); actmenu.add(createact); actmenu.add(addcust); actmenu.add(viewact); actmenu.add(remact); //Create Panel 2 OK and Cancel buttons //So EventHandle constructor can add as action listeners OK = new JButton(messages.getString("OKButton")); cancel = new JButton(messages.getString("CancelButton")); //Create message labels messlab = new JLabel(); messlab2 = new JLabel(); messlab3 = new JLabel(); messlab4 = new JLabel(); messlab5 = new JLabel(); messlab6 = new JLabel(); //Add components to panels p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); p1.add(new JLabel()); String wmess = messages.getString("WatchMess"); p1.add(new JLabel(wmess + " ")); p1.add(messlab); p1.add(messlab2); p1.add(messlab3); p1.add(messlab4); p1.add(messlab5); p1.add(messlab6); //Create spacer labels spacerlab1 = new JLabel("_____________________________"); spacerlab2 = new JLabel("_____________________________"); //Add spacer labels to Panel 2 initial screen p2.add(spacerlab1); p2.add(spacerlab2); //Create description text field this.descrip = new JTextField(); //Add functionality to close window addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent event) { System.exit(0); } }); } protected void clearMessages(int value) { messlab.setText(null); messlab2.setText(null); messlab3.setText(null); messlab4.setText(null); messlab5.setText(null); } protected void clearMessages() { messlab.setText(null); messlab2.setText(null); messlab3.setText(null); messlab4.setText(null); messlab5.setText(null); messlab6.setText(null); } protected void resetPanelTwo() { clearMessages(1); p2.removeAll(); p2.validate(); p2.repaint();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -