Developing
the Bank Checking Account MTS Client
Gopalan Suresh Raj
Note |
To
work with any of these samples, you will need the
following: .........................................Microsoft Visual J++ ver 6.0 .........................................Windows NT 4.0 Options Pack |
The CheckingClient is used to access the CheckingServer and manage Checking accounts.
Figure : Shows the
CheckingClient MTS client program in action
The Steps involved in developing the MTS Client are
1. Create a new Windows Application
2. Add COM Wrappers for the Java MTS Server Component
3. Add code in the Client to call the MTS Server
4. Build and Run the Client
A Three Tier Architecture for a typical Bank Account
Figure shows what we are trying to ultimately accomplish in these pages
1. Create a new
Windows Application
Create a Windows Application project in Visual J++ by selecting
the New Project in the File menu, then choosing the Windows
Application project template. Name the project ClickClient and
choose Open.
2. Add COM Wrappers
for the BankServer Java MTS Component
Set up COM access to the Java Client App by adding COM wrappers
to the server component. From the Project menu, select Add COM
wrapper. Select the checkbox next to the Bank in the list of
installed COM components in the COM Wrappers dialog and press OK.
You will notice a package called Bank added to the CheckingClient
project. Alternatively, if the Bank does not show up on the list
of registered COM wrappers, you always have the option of
browsing and selecting the DLL manually.
3. Add code in the
CheckingClient to call the BankServer Java MTS component
This is where we add code to the Client apps form to interact
with the Java MTS BankServer component. Create a form similar to
the one shown.
Figure : Shows the form that
we need to develop for our CheckingClient program
Now add code to the generated source. The completed code is shown below:
CheckingClient.java |
import com.ms.wfc.app.*; import com.ms.wfc.core.*; import com.ms.wfc.ui.*; import com.ms.wfc.html.*; import com.ms.com.*; import bank.*; /**
/** public
void fillAccountList() { private
void retrieveButton_click(Object source, Event e)
{ private
void addButton_click(Object source, Event e) { private
void closeButton_click(Object source, Event e)
{ private
void creditButton_click(Object source, Event e)
{ private
void debitButton_click(Object source, Event e)
{ /** private
void initForm() {
accountList.setAllowDrop(true);
retrieveButton.setLocation(new Point(184, 240));
closeButton.setLocation(new Point(184, 280));
addButton.setLocation(new Point(96, 112));
numberEdit.setLocation(new Point(120, 16));
nameEdit.setLocation(new Point(120, 48));
balanceEdit.setLocation(new Point(120, 80));
label1.setLocation(new Point(16, 16));
label2.setLocation(new Point(16, 48));
label3.setLocation(new Point(16, 80));
creditEdit.setLocation(new Point(16, 152));
debitEdit.setLocation(new Point(16, 184));
creditButton.setLocation(new Point(184, 152));
debitButton.setLocation(new Point(184, 184));
this.setNewControls(new Control[] { /** |
4. Build and Run the Client
program - CheckingClient
Build the project by selecting Build from the Build menu. This
creates a Windows executable with all the class files needed to
execute the client including the COM wrappers for the server -
packaged into one executable. Run it and have fun...
click here to go
to the Developing the Checking Account MTS Server Component Page... |
click here to go to My MTS HomePage... |
This site was developed and is maintained by Gopalan Suresh Raj This page has been visited |
Last Updated : Apr 26, '99 |
Copyright (c) 1997-99, Gopalan Suresh Raj - All rights reserved. Terms of use. |
All products and companies mentioned at this site,are trademarks of their respective owners. |