ATM system implementation [3]--Balance Query window [00 original]
Last Update:2018-07-23
Source: Internet
Author: User
Package cn.edu.ynu.sei.atm.client.ui;
Import java.rmi.RemoteException;
Import Org.eclipse.swt.SWT;
Import Org.eclipse.swt.widgets.Button;
Import Org.eclipse.swt.widgets.Composite;
Import Org.eclipse.swt.widgets.Label;
Import Org.eclipse.swt.widgets.MessageBox;
Import Org.eclipse.swt.widgets.Text;
/**
* Balance Query window
* @author 88250
*/
public class Balancequerycomposite extends composite
{
/**
* Back button
*/
Private Button returnbtn = null;
/**
* Prompt for the number of acceptable labels
*/
Private Label PROMPTAVAILABLEAMOUNTLBL = null;
/**
* The number of desirable sections display field
*/
Private Text availableamounttext = null;
/**
* Balance Display Field
*/
Private Text balancetext = null;
/**
* Prompt Balance Label
*/
Private Label PROMPTBALANCELBL = null;
/**
* Prompt Account Type label
*/
Private Label PROMPTACCOUNTTYPELBL = null;
/**
* Account type display field
*/
Private Text accounttypetext = null;
/**
* Account ID Display domain
*/
Private Text accountidtext = null;
/**
* Prompt Account ID label
*/
Private Label PROMPTACCOUNTIDLBL = null;
/**
* Create Balance Query window container
* @param parent window Container
*/
Public Balancequerycomposite (composite parent)
{
Super (parent, SWT. NONE);
Createcontents ();
}
/**
* Show account related information
*/
public void Displayaccountinfo ()
{
Try
{
Accountidtext.settext (Integer
. ToString (AccountSelectComposite.account.getID ()));
Accounttypetext.settext (Accountselectcomposite.account
. GetAccountType ());
Balancetext.settext (Float.tostring (accountselectcomposite.account
. GetBalance ());
Availableamounttext.settext (Float
. ToString (AccountSelectComposite.account.getRemain ()));
}
catch (RemoteException re)
{
MessageBox Exitdlg = new MessageBox (this. Getshell ());
Exitdlg.settext ("Network connectivity problem ....") " );
Exitdlg.setmessage ("Cannot connect to the server, the system will exit.") " );
Exitdlg.open ();
System.exit (0);
Re.printstacktrace ();
}
catch (Exception e)
{
E.printstacktrace ();
}
}
/**
* Create Balance Query window container containing controls
*/
private void Createcontents ()
{
PROMPTACCOUNTIDLBL = new Label (this, SWT. NONE);
Promptaccountidlbl.settext ("Account ID:");
Promptaccountidlbl.setbounds (26, 20, 55, 20);
Accountidtext = new Text (this, SWT. BORDER);
Accountidtext.seteditable (FALSE);
Accountidtext.setbounds (82, 14, 80, 25);
Accounttypetext = new Text (this, SWT. BORDER);
Accounttypetext.seteditable (FALSE);
Accounttypetext.setbounds (82, 46, 80, 25);
PROMPTACCOUNTTYPELBL = new Label (this, SWT. NONE);
Promptaccounttypelbl.settext ("Account type:");
Promptaccounttypelbl.setbounds (14, 51, 65, 20);
PROMPTBALANCELBL = new Label (this, SWT. NONE);
Promptbalancelbl.settext ("Current balance:");
Promptbalancelbl.setbounds (15, 86, 65, 20);
Balancetext = new Text (this, SWT. BORDER);
Balancetext.seteditable (FALSE);
Balancetext.setbounds (83, 82, 80, 25);
Availableamounttext = new Text (this, SWT. BORDER);
Availableamounttext.seteditable (FALSE);
Availableamounttext.setbounds (83, 118, 80, 25);
PROMPTAVAILABLEAMOUNTLBL = new Label (this, SWT. NONE);
Promptavailableamountlbl.settext ("Desirable number:");
Promptavailableamountlbl.setbounds (17, 122, 65, 20);
RETURNBTN = new Button (this, SWT. BORDER);
Returnbtn.settext ("return");
Returnbtn.setbounds (124, 154, 40, 30);
}
/**
* Get the return button
* @return Return button
*/
Public Button GETRETURNLBL ()
{
return returnbtn;
}
@Override
public void Dispose ()
{
Super. Dispose ();
}
@Override
protected void Checksubclass ()
{
Disable the check that prevents subclassing of SWT components
}
}