Methods Summary |
---|
public void | actionPerformed(java.awt.event.ActionEvent event)JDK 1.1 AWT method for performing ActionListener
related functionality. Specifically, this means responding
to menu clicks and button clicks.
MenuItem m = (MenuItem)event.getSource();
String l = m.getLabel();
if( l.equalsIgnoreCase("Open...") ) {
// Opens a dialog box that prompts the user for a
// customer ID to open
OpenAccountDialog d = new OpenAccountDialog(this, true);
d.show();
}
else if( l.equalsIgnoreCase("Transfer...") ) {
// Opens a dialog box that allowed a user to
// specify an amount and target account for
// money transfers
RemoteAccount acct;
TransferDialog d;
acct = customer_panel.getSelectedAccount();
d = new TransferDialog(this, true, acct);
d.show();
}
else if( l.equalsIgnoreCase("About") ) {
// Shows a simple about dialog
AboutDialog d = new AboutDialog(this, true);
d.show();
}
else if( l.equalsIgnoreCase("Exit") ) {
// Confirms the quit for the user
QuitDialog d = new QuitDialog(this, true);
d.show();
}
|
public void | loadCustomer(int cust_id)The OpenAccountDialog calls this method once the
user has entered a customer ID and clicked OK.
This method then uses that ID to load a customer
object from the application server.
RemoteCustomer c;
try {
c = server.getCustomer(this, cust_id);
customer_panel.cleanUp();
remove(customer_panel);
customer_panel = new CustomerPanel(this, c);
add(customer_panel);
validateTree();
customer_panel.show();
}
catch( PersistenceException e ) {
System.err.println("Error loading remote customer.");
e.printStackTrace();
}
catch( RemoteException e ) {
System.err.println("Failed to load remote customer.");
e.printStackTrace();
}
|
public static void | main(java.lang.String[] args)Sets the static host variable to the first command line
argument. It then creates a new BankClient frame and
shows it.
try {
BankClient frame;
if( args.length != 1 ) {
System.out.println("Syntax: <java bank.client.BankClient " +
"APP_SERVER_HOST>");
return;
}
host = args[0];
frame = new BankClient();
frame.show();
}
catch( RemoteException e ) {
e.printStackTrace();
System.exit(-1);
}
|
public void | monitorLock(imaginary.persist.RemotePersistent p)This is called by the remote lock object from time to
time just to check if the network is still up.
|
public void | run()This method runs in a separate thread at the time the
frame is created so that it can load the application
server.
try {
System.out.println("Connecting to app server at " + host + "...");
server = (RemoteAppServer)Naming.lookup("rmi://" + host +
"/AppServer");
System.out.println("Connected to server...");
}
catch( Exception e ) {
System.err.println("Failed to connect to application server.");
e.printStackTrace();
server = null;
}
|
public void | setLock(imaginary.persist.RemoteLock l)This is called by the RemoteLock object when it first
gets created.
lock = l;
|
public synchronized void | show()Move the frame to the proper place when it is shown.
move(50, 50);
super.show();
|
public synchronized void | transfer(float amount, bank.server.RemoteAccount source, bank.server.RemoteAccount target)The TransferDialog box calls this method with the desired
transfer amount, source account, and target account. The method
in turn tells the source account to tranfer the specified
amount to the specified target account.
try {
source.transfer(this, amount, target);
lock.save();
}
catch( Exception e ) {
e.printStackTrace();
}
|
public void | windowActivated(java.awt.event.WindowEvent event)
|
public void | windowClosed(java.awt.event.WindowEvent event)
|
public void | windowClosing(java.awt.event.WindowEvent event)
customer_panel.cleanUp();
dispose();
System.exit(0);
|
public void | windowDeactivated(java.awt.event.WindowEvent event)
|
public void | windowDeiconified(java.awt.event.WindowEvent event)
|
public void | windowIconified(java.awt.event.WindowEvent event)
|
public void | windowOpened(java.awt.event.WindowEvent event)
|