SMARTTEXTFIELD 1.2 DEMONSTRATION
| Try clicking in the text fields in each of the applets on this page and then tabbing (pressing the Tab key) and shift-tabbing (same thing, but with the Shift key held down too). |
| See the difference? |
|
After weeks of effort, I have concluded that the various implementations on various platforms of Java's Abstract Windowing Toolkit are ALL so buggy, and so idiosyncratically buggy, that there is no point in trying to provide further workarounds. Sooner or later, Sun, Netscape and Microsoft will fix these bugs, and then we won't have this bother. It's been a productive learning experience though. I reckon I now know Java through and through. The language clearly has enormous potential, and I like it too. A really cool language, well thought out and well designed. Currently, this applet behaves completely correctly under 3 out of 4 runtimes tried on the Macintosh. It behaves partially correctly under MS Internet Explorer on the Macintosh and under all runtimes tried so far on Windows 95 and SGI IRIX. As far as I can tell, my code's methods all run correctly if and when a runtime actually calls them. I currently believe that each problematic runtime's failure to call one or more methods at the appropriate time is that runtime's implementer's bug, not mine. My source code is available for critical evaluation, and I would appreciate any feedback. Netscape Navigator 3.x for Win32, and MS Internet Explorer 3.x for both Mac and Win32, all demonstrate at least some of the features correctly and do not crash, but also miss out some functions ~~ eg MSIE for Win32 doesn't change the rectangle's color, NN for Win32 lets you shift-tab out of all fields correctly but only lets you tab out of some fields, and MSIE for Mac responds to all tab-key presses in applets by selecting the address bar. There it rests for now. |
ColorTest
applet from
Teach Yourself Java for Macintosh in 21 Days
by
Laura Lemay
and
Charles L. Perkins
with Timothy Webster, Hayden Books 1996, so portions © them).
| Technical details: |
Applet
consists of a
Canvas
(for showing the color) and two
Containers,
all laid out left to right.
Containers
in each
Applet
contains three
Labels
and three
TextFields
/
SmartTextFields,
laid out vertically in columns.
SmartTextFields
are actually specialised descendants of
NumberTextField,
an abstract subclass of
SmartTextField
providing public methods to treat a
SmartTextField
as if it was a
Number.
The concrete
classes used here restrict input to numeric characters and values within
specific ranges. They are:
UByteTextField, for
numbers in the range 0 - 255 (the possible values of an unsigned 8-bit
byte)
DegreeTextField, for
numbers in the range 0 - 360.
PercentTextField,
for numbers in the range 0 - 100.
|
|
|
|