ATM系統實現[3]——餘額查詢時段[00原創]

來源:互聯網
上載者: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;

/**
 * 餘額查詢時段
 * @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
    }

}

 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.