⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 accountclient.java

📁 EJB功能实现
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   AccountClient.java

import java.awt.Container;
import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.PrintStream;
import javax.naming.InitialContext;
import javax.rmi.PortableRemoteObject;
import javax.swing.*;

public class AccountClient extends JFrame
{
    class displayEvent
        implements ActionListener
    {

        public void actionPerformed(ActionEvent actionevent)
        {
            AccountClient.id = tid.getText();
            try
            {
                InitialContext initialcontext = new InitialContext();
                Object obj = initialcontext.lookup("myAccount");
                AccountHome accounthome = (AccountHome)PortableRemoteObject.narrow(obj, AccountClient.class$AccountHome != null ? AccountClient.class$AccountHome : (AccountClient.class$AccountHome = AccountClient.class$("AccountHome")));
                if(!AccountClient.id.equals(""))
                {
                    Account account = accounthome.findByPrimaryKey(AccountClient.id);
                    tdate.setText(account.getDate());
                    tvc.setText(account.getVc());
                    tcheck.setText(account.getCheck());
                    tamount.setText(String.valueOf(account.getAmount()));
                    result.setText("Account created");
                } else
                {
                    result.setText("Invalid ID");
                }
            }
            catch(Exception exception)
            {
                System.out.println(exception);
            }
        }

        displayEvent()
        {
        }
    }

    class saveEvent
        implements ActionListener
    {

        public void actionPerformed(ActionEvent actionevent)
        {
            AccountClient.id = tid.getText();
            AccountClient.date = tdate.getText();
            AccountClient.vc = tvc.getText();
            AccountClient.check = tcheck.getText();
            AccountClient.amount = tamount.getText();
            AccountClient.damount = Double.parseDouble(AccountClient.amount);
            try
            {
                InitialContext initialcontext = new InitialContext();
                Object obj = initialcontext.lookup("myAccount");
                AccountHome accounthome = (AccountHome)PortableRemoteObject.narrow(obj, AccountClient.class$AccountHome != null ? AccountClient.class$AccountHome : (AccountClient.class$AccountHome = AccountClient.class$("AccountHome")));
                Account account = accounthome.create(AccountClient.id, AccountClient.date, AccountClient.vc, AccountClient.check, AccountClient.damount);
                result.setText("Account created");
            }
            catch(Exception exception)
            {
                System.out.println(exception);
            }
        }

        saveEvent()
        {
        }
    }


    public static int w = 600;
    public static int h = 400;
    public static String str = "Earnest Bank Welcomes You";
    Container c;
    JLabel result;
    JLabel lid;
    JLabel ldate;
    JLabel lvc;
    JLabel lcheck;
    JLabel lamount;
    JTextField tid;
    JTextField tdate;
    JTextField tvc;
    JTextField tcheck;
    JTextField tamount;
    JButton bsave;
    JButton bdisplay;
    public static String id;
    public static String date;
    public static String vc;
    public static String check;
    public static String amount;
    public static double damount;
    static Class class$AccountHome; /* synthetic field */

    public AccountClient()
    {
        super(str);
        c = getContentPane();
        c.setLayout(new GridLayout(7, 2, 2, 2));
        lid = new JLabel("Account ID:");
        c.add(lid);
        tid = new JTextField(20);
        c.add(tid);
        ldate = new JLabel("Date:");
        c.add(ldate);
        tdate = new JTextField(16);
        c.add(tdate);
        lvc = new JLabel("Particulars:");
        c.add(lvc);
        tvc = new JTextField(16);
        c.add(tvc);
        lcheck = new JLabel("Check:");
        c.add(lcheck);
        tcheck = new JTextField(16);
        c.add(tcheck);
        lamount = new JLabel("Amount:");
        c.add(lamount);
        tamount = new JTextField(16);
        c.add(tamount);
        bsave = new JButton("Save");
        bsave.addActionListener(new saveEvent());
        c.add(bsave);
        bdisplay = new JButton("Dispaly");
        bdisplay.addActionListener(new displayEvent());
        c.add(bdisplay);
        result = new JLabel("");
        c.add(result);
        setSize(w, h);
        show();
    }

    public static void main(String args[])
    {
        new AccountClient();
    }

    static Class class$(String s)
    {
        return Class.forName(s);
        ClassNotFoundException classnotfoundexception;
        classnotfoundexception;
        throw new NoClassDefFoundError(classnotfoundexception.getMessage());
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -