您的位置:首页 > 其它

ATM系统实现[3]——余额查询窗口[00原创]

2007-07-23 20:14 501 查看
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;

/**
* 余额查询窗口
* @author 88250
*/
public class BalanceQueryComposite extends Composite
{
/**
* 返回按钮
*/
private Button returnBtn = null;

/**
* 提示可取款数标签
*/
private Label promptAvailableAmountLbl = null;

/**
* 可取款数显示域
*/
private Text availableAmountText = null;

/**
* 余额显示域
*/
private Text balanceText = null;

/**
* 提示余额标签
*/
private Label promptBalanceLbl = null;

/**
* 提示帐户类型标签
*/
private Label promptAccountTypeLbl = null;

/**
* 帐户类型显示域
*/
private Text accountTypeText = null;

/**
* 帐户ID显示域
*/
private Text accountIDText = null;

/**
* 提示帐户ID标签
*/
private Label promptAccountIDLbl = null;

/**
* 创建余额查询窗口容器
* @param parent 父窗口容器
*/
public BalanceQueryComposite(Composite parent)
{
super(parent, SWT.NONE);
createContents();
}

/**
* 显示帐户相关信息
*/
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("网络连接出现问题....");
exitDlg.setMessage("不能连接到服务器,系统将退出!");
exitDlg.open();
System.exit(0);
re.printStackTrace();
}
catch (Exception e)
{
e.printStackTrace();
}
}

/**
* 创建余额查询窗口容器内含控件
*/
private void createContents()
{
promptAccountIDLbl = new Label(this, SWT.NONE);
promptAccountIDLbl.setText("帐户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("帐户类型:");
promptAccountTypeLbl.setBounds(14, 51, 65, 20);

promptBalanceLbl = new Label(this, SWT.NONE);
promptBalanceLbl.setText("当前余额:");
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("可取款数:");
promptAvailableAmountLbl.setBounds(17, 122, 65, 20);

returnBtn = new Button(this, SWT.BORDER);
returnBtn.setText("返回");
returnBtn.setBounds(124, 154, 40, 30);
}

/**
* 取得返回按钮
* @return 返回按钮
*/
public Button getReturnLbl()
{
return returnBtn;
}

@Override
public void dispose()
{
super.dispose();
}

@Override
protected void checkSubclass()
{
// Disable the check that prevents subclassing of SWT components
}

}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: