BROKAT
is a German software house that develops and implements
object-oriented transaction solutions for financial service
companies.
The company's flagship product, Twister 2.0, is billed as
the BROKAT middleware solution. It uses CORBA and supports
nearly all server platforms. Twister applications "offer
customers the shortest time to market and optimum levels
of investment protection," the company declares.
In this guest article, BROKAT engineer Dietrich
Pfeifle shows how the creators of Twister 2.0 migrated
from AWT to Swing, and explains why.
By Dietrich Pfeifle
When we received
the first release of JFC (also called Swing) in February 1998,
we and other developers working in the JavaTM
programming language asked ourselves: What are pros and
cons of this new way of life -- this Swing?
This article briefly outlines how we answered
that question. It also tells how -- and why -- a modern
company like BROKAT decided to migrate from AWT to Swing.
As a special bonus, it presents several
code snippets and a small demo applet to show how our company
uses Swing.
Using Swing
for client GUIs
When
this article was written, the latest figures showed that 1,439
banks were using secure banking solutions offered by BROKAT.
As the following screen shot shows, Twister products use
applets written in the Java programming language to create
good-looking, easy-to-use graphical interfaces for clients.
The Java language helps us develop client applications
in a very short time, and ensures that they are platform-independent
and globally and quickly updatable.
Swing and mobile banking
One
of our Twister applications, X·SMS Banking, permits financial
applications to be called up by GSM mobile phones using the
Short Message Service (SMS). With X·SMS Banking, clients
can perform operations such as checking their accounts
or performing transfer orders by mobile phone. Also, mobile
phones can be used in such cross-channel applications
as devices for providing digital signatures for PC-based Internet
transactions. BROKAT demonstrated this new solution at
the German fair CEBIT '98 with great success.
This diagram shows how X·SMS Banking works:
Transactions
by the numbers
The operation shown in the diagram works as follows:
- First, a message -- for example a banking-transaction
-- is sent to the user.
- The phone rings, and a new short message (SM) appears
on the screen.
- The user checks the content of the transaction and digitally
signs the message content using a private key stored
on a special phonecard. (A phonecard works much like
the standard smartcards that are in common use, but
has one advantage over smartcards: It's wireless, so the
user doesn't need a PC and or reader hardware.)
- Now a similar message-plus-signature is sent to a Short
Message Service Center (SMSC), routed to an X·SMS-Gateway,
translated, and sent to Twister. Twister is such a
flexible and powerful integrator it lets transactions
plug into all possible existing back-end infrastructures
(banks and insurance companies, for example.). So they can
be used with non-repudiation, all messages are stored
in a database management system. Other possible storage
mediums include streamers, CD-writers, and so on.
- Here's what is stored:
- The message: For example, 'command=Order what=Book
costs=500.00USD'.
- The signature: For instance, 'A02F3C54...'
- The certificate, if not stored in a CA.
- A timestamp, such as '98-04-01 8:15.01'.
- Some additional information.
Repudiating transactions
If
an online customer repudiates a transaction at a later
time -- even weeks later -- he can simply call his bank. Then
it's up to the bank to verify the validity of the specified
transaction. To do this, it is necessary to check the
transaction again.
But that's easy. The transaction is exported from database,
and the signature is generated again. the the generated
signature is compared with the stored one, and both the
timestamp and the validity of the certificate are also
tested.
Because all these operations are necessary, we
need an easy-to-understand GUI that offers quick access
to a very large amount of information. We decided to use
JFC -- and it was a good decision. That's because JFC works
well in a typical client-server-infrastructure. In such
an infrastructure, all decisions are up to the server, and so
is database management, but the client must be able to handle
and display a very large amount of data.
![](../../shared_art/bar_purple_520.gif)
Benefits of
using Swing
We were glad to discover that the Swing API has
nearly the same structure as the AWT. For example, although
a button is called JButton instead of Button in Swing,
it retains the standard methods of AWT's Button class.
But it also has some cool extra features, such as letting one
add a picture. In the old days, everyone created their
own implementations of such things -- so we were able
to combine the old with the new every time we went back
to the drawing board.
Rapid-fire programming
Every
applet programmer knows the fundamentals of AWT programming,
and some have bemoaned its lack of a comfortable and flexible
table representation.
Times have changed. Our graphical user interface
was implemented in an extremely short time -- in about
2 weeks -- because it has become easy to use tables, trees,
image components, pictures on buttons, and the like.
JTable: a big double-buffered
picture
All
old AWT components kept their data in own variables, arrays,
and the like. But Swing offers a whole new way of life.
In Swing, you can define classes that can handle data
in the background, sorting it as the visualizer itself
just visualizes data.
With Swing tables, you can work with ranges of
records; for you can give a JTable object such instructions
as: "Shows me customer 103 up to 181."
Also, you can easily scroll through hundreds of
lines. No flickering. No crashing.
Another important feature: If your data keeping
class is updated, because a new request has been set up,
for example -- your table is updated automatically !
In short, Swing enabled us to implement a generic
solution to display all possible data in one and only
result window. Such code is often reusable and could be
very flexible.
We want small applets!
If
you you write an applet that turns out to be 400K long, your
users have to drink more than one cup of coffee while
your applet is loading. So programmers are always trying
to optimize applet code.
Swing has helped us provide applets with good
functionality and small size (40 kBytes are so). Why?
Because all the JFC classes are permanently stored in
the user's class path. So they don't have to be downloaded every
an applet is used. This is a welcome relief, in contrast to
self-implemented tables, picture-buttons, trees, and so
on.
We want good window-handling!
With
the help of Swing, we have found that it's easy to emulate a
windowing system such as the Windows MDI (multiple document
interface) design. Now that developers can develop custom
windowing systems with Swing, imagine what kinds of applets
might be coming in the future! To see one possible example,
follow this
link.
I implemented several GUI's with the Java 1.0.2
release and had many problems with Dialogs and Frames
because of the difficulty in emulating windowing systems.
When a windowing system is not provided by the API one
is working with, it costs application developers lots of time
and money. The only thing one can do in such a situation
is write one's own code -- which, more often than not,
turns out to be non-portable. Swing solves that problem
by providing an interface that makes it easy to create
standard dialogs, such as error-message dialogs, warning dialogs,
"Yes/No"dialogs, and so on.
The following pictures show how Swing was used
to create a simple standard dialog in three different
look-and-feel implementations. You can view or download
a code sample by following this
link.
Fasten your
seat belts!
I
almost forgot to mention the coolest feature of JFC: Its
support of a platform-independent pluggable look and feel.
You can rest assured that all your colleagues will look
surprised the first time you simply chose "Motif"
from a Windows a menu and then watch all your components change
to look like Motif. And if you choose "Java L&F,"
make sure you've provided enough seats!
To see an example, follow this
link. Also, the three thumbnail screen shots that
appear below blow up to full size when you click them.
They show the same application in three different L&F
implementations.
Overview
of sample code and demos
To
see Swing in action, check out the following code snippets and
run the small test applet I've provided. To start the
applet, you must have Swing installed in your browser's
class path. So download the JFC package from java.sun.com
and then install the snippets locally. (If your browser and
your computer system aren't yet set up to run Swing applications,
you can fix that by following the instructions provided
in the articles in this issue titled "Plug-in
Power" and "Make Your Browser Swing.")
Conclusion
(but not the end) . . .
I
hope this article has helped you get into the spirit of Swing.
I've watched it infect several colleagues of mine when
they discovered the Java Foundation (Swing) Classes. All
of them were programmers who worked in the Java language,
and all were fascinated from the great features that Swing
offers.
____
AWT, JFC: If you
aren't familiar with JFC or AWT, we suggest that you read
the "Introducing
Swing" article in this issue.
In this section, The Swing
Connection publishes articles that are written by third-party
developers and may contain code, statements, inferences, and
programming techniques that are not necessarily endorsed by
Sun Microsystems, Inc., or by The Swing Connection.