ATM system implementation [11]--withdrawal window [00 original]
Last Update:2018-07-23
Source: Internet
Author: User
Package cn.edu.ynu.sei.atm.client.ui;
Import Cn.edu.ynu.sei.atm.interfaceDef.IDataFormatChecker;
Import java.rmi.Naming;
Import java.rmi.RemoteException;
Import Org.eclipse.swt.SWT;
Import Org.eclipse.swt.events.MouseAdapter;
Import org.eclipse.swt.events.MouseEvent;
Import Org.eclipse.swt.widgets.Button;
Import Org.eclipse.swt.widgets.Composite;
Import Org.eclipse.swt.widgets.Display;
Import Org.eclipse.swt.widgets.Label;
Import Org.eclipse.swt.widgets.MessageBox;
Import Org.eclipse.swt.widgets.Text;
/**
* Withdrawal Interface Container
* @author 88250
*/
public class Withdrawcomposite extends composite
{
/**
* Prompt one-time withdrawal limit label
*/
Private Label PROMPTLBL = null;
/**
* Back button
*/
Private Button returnbtn = null;
/**
* Operation status Prompt label
*/
Private Label STATELBL = null;
/**
* OK button
*/
Private Button confirmbtn = null;
/**
* Operation Status Display label
*/
Private Label STATESHOWLBL = null;
/**
* Prompt to enter amount label
*/
Private Label PLEASEINPUTAMOUNTLBL = null;
/**
* Enter Amount Text field
*/
Private Text amounttext = null;
----Select the amount of----//
Private Button b500 = null;
Private Button b1000 = null;
Private Button b2000 = null;
Private Button b1500 = null;
// ------------------ //
/**
* Prompt to enter withdrawal amount
*/
Private Label PLEASESELECTDEPOSITAMOUNTLBL = null;
/**
* Input data legality verification interface
*/
Private Idataformatchecker dataformatchecker = null;
/**
* Parent Window Container
*/
Private composite parent = NULL;
/**
* Create withdrawal Operation interface
* @param parent window Container
*/
Public Withdrawcomposite (composite parent)
{
Super (parent, SWT. NONE);
this. Parent = parent;
Try
{
Dataformatchecker = (idataformatchecker) naming.lookup (logininterface.serviceaddr + "Dataformatchecker");
}
catch (RemoteException re)
{
Re.printstacktrace ();
MessageBox Exitdlg = new MessageBox (Parent.getshell ());
Exitdlg.settext ("Network connectivity problem ....") " );
Exitdlg.setmessage ("Cannot connect to the server, the system will exit.") " );
Exitdlg.open ();
System.exit (0);
}
catch (Exception e)
{
E.printstacktrace ();
}
Createcontents ();
}
public void setvisible (Boolean b)
{
ClearHistory ();
Super. setvisible (b);
}
/**
* Create a withdrawal operation interface containing controls
*/
private void Createcontents ()
{
PROMPTLBL = new Label (this, SWT. NONE);
Promptlbl.setforeground (Display.getcurrent (). Getsystemcolor (SWT. color_red));
Promptlbl.settext ("Withdrawals cannot be greater than 2000 at a time");
Promptlbl.setbounds (15, 6, 135, 25);
Set fixed amount available and not available from input amount
Addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent e)
{
if (e.x > 0)
{
B500.setenabled (TRUE);
B1000.setenabled (TRUE);
B1500.setenabled (TRUE);
B2000.setenabled (TRUE);
Amounttext.settext ("");
Amounttext.seteditable (FALSE);
}
}
});
PLEASESELECTDEPOSITAMOUNTLBL = new Label (this, SWT. NONE);
Pleaseselectdepositamountlbl.settext ("Please select your withdrawal amount:");
Pleaseselectdepositamountlbl.setbounds (17, 35, 130, 20);
b500 = new Button (this, SWT. RADIO);
B500.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent e)
{
Amounttext.seteditable (FALSE);
Setamountradioenabled (TRUE);
}
});
B500.settext ("500");
B500.setbounds (17, 61, 45, 25);
b1000 = new Button (this, SWT. RADIO);
B1000.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent e)
{
Amounttext.settext ("");
Amounttext.seteditable (FALSE);
Setamountradioenabled (TRUE);
}
});
B1000.settext ("1000");
B1000.setbounds (99, 62, 50, 25);
b1500 = new Button (this, SWT. RADIO);
B1500.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent e)
{
Amounttext.settext ("");
Amounttext.seteditable (FALSE);
Setamountradioenabled (TRUE);
}
});
B1500.settext ("1500");
B1500.setbounds (17, 95, 50, 25);
b2000 = new Button (this, SWT. RADIO);
B2000.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent e)
{
Amounttext.settext ("");
Amounttext.seteditable (FALSE);
Setamountradioenabled (TRUE);
}
});
B2000.settext ("2000");
B2000.setbounds (99, 94, 50, 25);
PLEASEINPUTAMOUNTLBL = new Label (this, SWT. NONE);
Pleaseinputamountlbl.settext ("Please enter your withdrawal amount:");
Pleaseinputamountlbl.setbounds (17, 126, 130, 20);
Amounttext = new Text (this, SWT. BORDER);
Amounttext.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent e)
{
Amounttext.settext ("");
Amounttext.seteditable (TRUE);
Setamountradioenabled (FALSE);
}
});
Amounttext.setbounds (44, 150