ATM system implementation [6]--Password Panel component [00 original]

Source: Internet
Author: User
Package cn.edu.ynu.sei.atm.client.ui;

Import cn.edu.ynu.sei.atm.interfaceDef.IVerification;
Import Com.swtdesigner.SWTResourceManager;
Import java.rmi.Naming;
Import java.rmi.RemoteException;
Import Org.eclipse.swt.SWT;
Import org.eclipse.swt.events.ModifyEvent;
Import Org.eclipse.swt.events.ModifyListener;
Import Org.eclipse.swt.events.MouseAdapter;
Import org.eclipse.swt.events.MouseEvent;
Import Org.eclipse.swt.widgets.Composite;
Import Org.eclipse.swt.widgets.Label;
Import Org.eclipse.swt.widgets.MessageBox;
Import Org.eclipse.swt.widgets.Text;

/**
* Password Input Panel
* @author 88250
*/
public class Pwdinputcomposite extends composite
{
-----Password Keyboard button-----//
Private Label L4;
Private Label L1;
Private Label L2;
Private Label L3;
Private Label L9;
Private Label L7;
Private Label L0;
Private Label L6;
Private Label L5;
Private Label L8;
//  ----------------------  //

/**
* Confirm Button Label
*/
Private Label Confirmlbl;

/**
* Clear Button Label
*/
Private Label Clearlbl;

/**
* Password Input box
*/
Private Text Pwdtext;

/**
* Verify Identity interface instance
*/
Private iverification verification = null;

/**
* Parent Window Container
*/
Private composite parent = NULL;

/**
* Create password Input Panel container
* @param parent window Container
*/
Public Pwdinputcomposite (composite parent)
{
Super (parent, SWT. NONE);
this. Parent = parent;
Get remote Service object
Try
{
Verification = (iverification) naming.lookup (logininterface.serviceaddr + "verification");
}
catch (RemoteException re)
{
Re.printstacktrace ();
MessageBox Exitdlg = new MessageBox (Parent.getshell ());
Exitdlg.settext ("Network connectivity problem ....") " );
Exitdlg.setmessage ("Cannot connect to the server.) " );
Exitdlg.open ();
System.exit (0);
}
catch (Exception e)
{
E.printstacktrace ();
}
Createcontents ();
}

/**
* Create password Input Panel containing controls
*/
private void Createcontents ()
{
Createpwdbuttons ();
Pwdtext = new Text (this, SWT. BORDER);
Pwdtext.addmodifylistener (New Modifylistener ()
{
public void Modifytext (Modifyevent arg0)
{
if (Pwdtext.getcharcount ()!= 0)
{//Set the Purge button available
Clearlbl.setbackgroundimage (Swtresourcemanager.getimage (
Pwdinputcomposite. Class, "Loginimages/clear. JPG "));
Clearlbl.setenabled (TRUE);
}
Else
{//Set ' Clear ' button not available
Clearlbl.setbackgroundimage (Swtresourcemanager.getimage (
Pwdinputcomposite. Class,
"Loginimages/cleardisable.jpg"));
Clearlbl.setenabled (FALSE);
}

Try
{
if (pwdtext.getcharcount () = = Verification.getpwdlength ())
{//Set ' OK ' button available
Confirmlbl.setbackgroundimage (Swtresourcemanager
. GetImage (Pwdinputcomposite. Class,
"Loginimages/confirm. JPG "));
Confirmlbl.setenabled (TRUE);
}
Else
{//Set ' OK ' button not available
Confirmlbl.setbackgroundimage (Swtresourcemanager
. GetImage (Pwdinputcomposite. Class,
"Loginimages/confirmdisable.jpg"));
Confirmlbl.setenabled (FALSE);
}
}
catch (RemoteException re)
{
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);
Re.printstacktrace ();
}
catch (Exception e)
{
E.printstacktrace ();
}
}
});
Pwdtext.setbounds (6, 4, 109, 25);

Get a qualified password length
Try
{
Pwdtext.settextlimit (Verification.getpwdlength ());
}
catch (RemoteException re)
{
Re.printstacktrace ();
}
catch (Exception e)
{
E.printstacktrace ();
}

Pwdtext.seteditable (FALSE);

Pwdtext.setechochar (' * ');

CLEARLBL = new Label (this, SWT. BORDER);
Clearlbl.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent e)
{
Pwdtext.settext ("");
}
});
Clearlbl.setbackgroundimage (Swtresourcemanager.getimage (
Pwdinputcomposite. Class, "loginimages/cleardisable.jpg"));
Clearlbl.setbounds (44, 149, 33, 33);

CONFIRMLBL = new Label (this, SWT. BORDER);
Confirmlbl.setbackgroundimage (Swtresourcemanager.getimage (
Pwdinputcomposite. Class, "loginimages/confirmdisable.jpg"));
Confirmlbl.setbounds (82, 149, 33, 33);
Confirmlbl.setenabled (FALSE);
}

/**
* Create Password button
*/
private void Createpwdbuttons ()
{
L8 = new Label (this, SWT. BORDER);
L8.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent e)
{
Pwdtext.append ("8");
}
});
L8.setbackgroundimage (Swtresourcemanager.getimage (
Pwdinputcomposite. Class, "loginimages/8.jpg"));
L8.setbounds (82, 111, 32, 32);

L5 = new Label (this, SWT. BORDER);
L5.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent e)
{
Pwdtext.append ("5");
}
});
L5.setbackgroundimage (Swtresourcemanager.getimage (
Pwdinputcomposite. Class, "loginimages/5.jpg"));
L5.setbounds (82, 73, 32, 32);

L6 = new Label (this, SWT. BORDER);
L6.addmouselistener (New Mouseadapter ()
{
public void MouseDown (MouseEvent e)
{<

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.