|
Last modified: 1 November 1996. |
c2 = c1
points c2 to c2,
ie changing c1 will change c2 as well.
new FileInputStream()
both / and \ are recognised as directory delimiters.
<PARAM NAME=pretext VALUE="Here is ">
,
then they are lost by the time GetParameter() sees them.
Use PHDUtils.getCStringParameter.
GridBagForm
gets round some of the problems.
handleEvent()
.
Either handle them here and return true, or return super.handleEvent()
.
If super.handleEvent()
is not called then the event is ignored!
super.handleEvent()
passes the event to the appropriate delegated Applet
event handler, then to the component.
So the Applet action()
, keyDown()
, etc. methods are called.
You should return false from keyDown()
, etc. if you want
a component, eg TextField, to receive the key.
Delegated event handler list:
mouseEnter()
mouseExit()
mouseMove()
mouseDown()
mouseDrag()
mouseUp()
keyDown()
keyUp()
action()
lostFocus()
gotFocus()
A better technique (methinks) is to have an integer id for each Component
of your form. PHD's GridBagForm class provides this facility wrapped round
the GridBagLayout layout.
GridBagForm.getIdFromComponent() and GridBagForm.getComponentFromId()
are used in event handling.
GridBagForm also has methods to handle tabbing between components,
and to remember the current field when you mouse click to a new tab field.
Obviously you could subclass each field, eg MyButton derived from Button and have an id for each button.
N3.0
Case 1: When your Applet is loaded, then
Case 2: If you move to a different page then come back, the Applet is normally not reloaded.
Case 3: If you re-select a link to the page with the Applet in, the Applet is normally not reloaded.
Note carefully that the static initialisation of other classes is only called once, as you would expect. So when init() is run again in case 3 make sure that your other classes are set up properly. Do not assume that when you enter init() that other classes have just been static initialised. You might want to provide a separate init() function which "re-does" the static initialisation.
stop()
is also called once per visit exit (and not destroy()
);
So, is the applet's destroy()
method ever called?
IE3.0
Case 3 does not happen, ie this case is the same as Case 2.
Implications
Design your applet carefully to cope with these cases.
PHD's HelpIndex makes use of start() to select the whole of main query text. This makes it easy either to add to it or to overwrite it.
Somewhat worryingly, Applets seem to continue to work after the user has left the web page. I think that they also keep the input focus, if they have it! I would have assumed that their threads were suspended at the very least.
showDocument()
a file parameter with
an anchor name attached, eg "next.html#top" then a new page is not displayed.
With no anchor the call works. An http parameter with anchor name works.
handleEvent()
is supposed to receive MOUSE_ENTER and MOUSE_EXIT
messages whenever the mouse enters or leaves a component.
(NB these events are also generated when the mouse enters the surrounding
area; in this case the Applet component is the target).
N3.0 is the only browser to generate these events properly.
N2.x, IE3.0 and Appletviewer (JDK1.0) do not generate these events.
GOT_FOCUS and LOST_FOCUS are therefore only generated by N3.0 (although there seem to be too many events arriving).
This will be improved once JDK 1.1 is adopted. A Java Archive (JAR) file can contain multiple files (compressed), including classes, images, sounds and other files, meaning that only one download is necessary. Let's hope that there is a method of providing a JAR file for those browsers that understand them, and the ordinary files for existing browsers.
This discourages a programmer from making up classes for ordinary situations,
eg a simple structure might be needed to group a record of items together.
For an initialised array, then an Object[][] would allow you to initialise
objects (but not simple types) although you would need to cast them to the
required type. Eg an array of colours could be
Object[][] colours = { { "white". Color.white }, { "red", Color.red }, }
etc.
There is a sneaky way of avoiding an extra class in some situations
(taken from Java by Example card
example).
If you want to represent individual items, and a single collection of them,
then have the individual items as instances of your class,
while the static class represents the collection.
This works as long as you only want one collection.
I use this approach for our GridBadForm
class,
where each instance represents the individual form components,
while the static class is used to manipulate the whole form.
Another trick is to avoid having a class extending Thread.
Get another class (eg your applet) to implement Runnable
and do your thread stuff in run()
.
HoT MetaL Light 3 may be deemed useful for longer articles. However it seemed to reject some existing pages that displayed OK. Useful spelling checker. If you give it an anchor name, it moves the </A> tag to an inconvenient place.
Frontpage seems too interventionist by half.
I am not sure if I like all its clever "bots".
You need to set up a stack of sub-directories to support it.
It did not seem to support local development of files
which were then uploaded to the real server.
I am not sure how it does its "connect to web server".
What mechanism beyond HTTP does it use?
Does it only work with Microsoft servers?
Microsoft Word's Internet Assistant may be useful. However we are still in the bygone era of Word 6 so it does not support most useful features.
Sun's Java Workshop looks kinda cute, but is unusable.
There's no simple list of files in your project;
this is a must as it is what programming is all about: selecting files to edit.
Can you edit more than one file at once (in different windows)?
The browser is annoying:
keeping the mouse pressed down on the vertical scroll bar down arrow does not auto-repeat.
Similarly, the down arrow key does not auto-repeat.
In the code editor pressing F1 while on a method name, for example,
should bring up help on that keyword.
The source browser only lists non-private variables and methods.
Its JDK classes seem out of date. Eg Label.setForeground() does not work and
GOT_FOCUS is not generated properly (see above).
In browser forms, Ctrl+arrow keys move back a web page, not back a word.
I have seen other people's comments complaining at a lack of documentation.
Seems pretty slow on my NT4.0 P133 32MB.
When selecting files or directories, there is no disk browser dialog box (File Open).
Whatever nice features there are, the basics aren't there.
It may be good for UNIX people, but PC people expect more...
I have not tried Microsoft's J++, Borland's Latt�, Symantec Caf� or Aimtech's Jamba. What is the ++ in J++?
The following development tools have recently been announced:
Iona has a Java version of its object request broker Orbix Web 2.0 (+35 316 625 255)
Object Design has a Java database PSE-Pro, a lightweight persistent storage engine (UK: 01344 458200).