SMARTTEXTFIELD
1.2
NOTES
[
Java links
|
SmartTextField demo
|
Sample code
]
This is a bug-fix for some versions of the JDK
1.0.2 runtime, specifically Mac and Win32 ones. According to Sun's "Java
Workshop" FAQ:
14.Is the TAB key supported under Win95? It works OK under Solaris.
This was a regression in JDK 1.0.2 (the callback of TextField
focus tracking
mechanism was not implemented) and has been fixed in the final
product. By the way, , we also fixed the Win32 input focus problems for
TextArea, Button, and Frame besides
TextField in the next release.
SmartTextField
also contains code to add consistent Shift-Tab behaviour which should work
on all platforms. Once JDK
1.1.1 is released on all platforms I will delete the bug-fix code and
leave just the Shift-Tab enhancement.
These behaviours are available for any subclass of java.awt.Component
to implement via the RetroFocusable
interface, but descendants of Container should not implement
this interface ~~ the search routines will fail if they do. The RF utility class provides
search methods for determining which RetroFocus-implementing
Component should receive the focus next.
3 May 97 ~~ After weeks of effort, I have concluded that the various
browsers' 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 only under Netscape
Navigator 3.x for Macintosh.
For the rest, NN 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 (an acknowledged bug with java.awt.Component.update()),
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 moves the focus to the address
bar whenever you press Tab. There it rests for now.
THANK YOU, one and all! It's great to hear from you. I simply can't test
on all the available Java runtimes on all the popular platforms. Your feedback
is invaluable.
Compatibility of earlier versions of this class with various runtimes
as I understand it at the moment:
MACOS RUNTIMES
-
Correct Tab and Shift-Tab behaviour.
-
Setting the focus by clicking anywhere in the field highlights the
whole field ~~ this is the
gotFocus() method at work. Why
does clicking in a SmartTextField appear not to trigger its
gotFocus() method in the other runtimes? In fact, it does:
if you watch closely, you can see the field highlight for an instant. The
gotFocus() override passes the event on to its superclass,
which in most runtimes then places an insertion point near the click location.
-
Pressing the Del key plants an invisible character rather than deleting
(the problem is with Apple's system-wide TextEdit toolbox and occurs in
many apps).
-
Action keys (pgup, pgdn, home, end) don't do anything (ditto).
-
Arrow keys work correctly.
Sun JDK
1.0.2 Applet Viewer (and
Symantec Café Lite's AppletViewer, which looks like a straight rebadge
of Sun's)
-
Correct Tab and Shift-Tab behaviour.
-
Correct click-focus behaviour, i.e. an insertion point rather than
selecting the whole field.
-
Pressing the Del key plants an invisible character rather than deleting
(see above).
-
Action keys (pgup, pgdn, home, end) don't do anything (ditto).
-
Arrow keys work correctly.
Netscape Navigator 3.0x
-
Correct Tab and Shift-Tab behaviour.
-
Correct click-focus behaviour, i.e. an insertion point rather than
selecting the whole field.
-
Pressing the Del key plants an invisible character rather than deleting
(see above).
-
Action keys (pgup, pgdn, home, end) insert a character rather than
moving the insertion point.
-
Arrow keys work correctly.
Microsoft Internet Explorer 3.0x using either Apple MRJ VM or MS/Metrowerks VM
-
Pressing Tab has the same effect as in browser windows with no text
fields or frames: it moves the focus to the address bar at the top of the
window. In other words, the browser's behaviour supercedes the applet's.
-
Action keys and arrow keys don't work.
-
Click behaviour as per Apple AppletRunner.
-
Delete key as others.
WIN32 RUNTIMES
-
"In Windows 95 running Netscape 3.0 it works when you type in
colour, hue etc. by changing the colour of the rectangle..... but I don't
know what happens then. In IExplore 3.0, it doesn't load properly, does
not work, is kaput." ~~ Dylan Jones, IBIS,
26 Mar 97.
-
"We did play around with it a bit, using Explorer 3.01 and W95,
but the colour fields kept doing strange flickering things, and Explorer
crashed twice on your page." ~~ Steve Jump, IBIS, 2 Apr 97.
-
"Netscape: Shift-Tab works, but not Tab; IE 3.01: Both Shift-Tab
and Tab work." ~~ Kevin Boer, ITI, 4 Apr 97.
-
"Looked at the demo and indeed tabbing/backtabbing works fine
- I'd like to include this with the search applet, in fact!
Number limiting also worked (seems you're looking at value, not number
size: 0120 was accepter as an RGB value); very useful set of classes, and
I'll include a link with the next update of JavaWoman!
...
However....
Some things in the demo DO NOT work. Seems you're having UI problems like
I do. Doncha love those implementation differences?
-
no color change whatsoever - ever. In both applets, the box just stays
black. That's looking with MSIE 3.01b. Will have to go back later with
NS3.0. Both on Win95.
-
truncation of a few labels: under "Hue" there is "aturation"
and "ightness".
~~ Marjolein Katsma, Java
Woman, 23 Apr 97.
SGI/IRIX RUNTIMES
-
"If the difference is meant to be that tabbing works in the 2nd
one but not the first, it's inconsistent on an SGI, but consistent on a
Mac (on the SGI, it works in some fields of the 2nd one, not in all). Also,
on the SGI, the fields are too small for the writing to show. So much for
cross-platform standards :(" ~~ Philip
Machanick, cs.wits.ac.za, 27 Mar 97. (The applets have now been resized).
-
"So, I'm running Netscape 3.0 on SGI IRIX 5.3.
The ColorTest applet, using the standard-distribution java.awt.TextField
class:
Tab moves to the next field, Shift-Tab moves back, the text is not highlighted,
if you tab past field 6 or shift-tab before field 1 all focus disappears
and you have to click on a field again. Moving the mouse off the applet
and back on causes focus to return to field 1, but incorrectly leaves the
other field 'depressed'.
ColorTest using the SmartTextField class:
Tab does nothing except on field 6, where it moves the focus to field 1
and highlights the text. Shift-Tab moves back a field and highlights the
text - shift-tab on field 1 moves the focus to field 6. Moving the mouse
off the applet and back on correctly leaves the current field selected.
So, bugs in both, I'm afraid... This may be Netscape's fault, of course,
since I hear their Java implementation is legendary for its bugs."
~~ Michael
Isard, robots.oxford.ac.uk, 31 Mar 97.
SOLARIS RUNTIMES
LINUX RUNTIMES
AIX RUNTIMES
HP/UX RUNTIMES