Some reader favorites:
EJB fundamentals and session beans
Create a scrollable virtual desktop in Swing
Wizard API updated!
Tim Boudreau has released a new version of the Swing Wizard library (version 0.997) that fixes the WizardException bug reported in JavaWorld's recent Open Source Java Project profile. The article's examples have been reworked to test out the new, improved WizardException. Thanks, Tim, for this helpful fix!
Open Source Java Projects: The Wizard API
Double-click mouse events are "synthetic." They are really a fiction created by the system/application. The basic idea is that if you click a mouse button twice in succession in the same location fast enough then a double-click event will be created. That begs the question of how we define "same location" and "fast enough."
Unfortunately, the "normal" AWT behavior for double-click handling seems to be hard-coded into the Java AWT implementation. The AWT definitions for "same location" and "fast enough" are also not very user friendly for folks who are a bit slow on mouse buttons or for people who have shaky hands.
The DoubleClicker applet illustrates handling mouse clicks in the applet itself. This allows the applet to not only provide its own definitions for the double-click behavior but make its behavior customizable by the user.
You should see a nice little greeting message. Move your mouse over the running applet and click once on any of the mouse buttons. Without moving the mouse further, look down to your browser's status line and you should see some mouse event time data from the application. Click slowly and you can watch the event times change.
The basic idea behind this method of mouse-event handling is to have the applet keep track of the time of the previous event. The applet has a "threshold" value to determine the maximal separation between the two click events in time. If the clicks are closer than the threshold (300 in the given code) then the double-click behavior is performed. Otherwise, just the single-click behavior takes place.
Now, start clicking in the applet again and slowly increase your clicking speed on the applet until you get the applet to display a different salutation. You should note that the event time difference displayed in the status line is indeed below the threshold value.
There are a couple of oddities in the code to note:
Free Download - 5 Minute Product Review. When slow equals Off: Manage the complexity of Web applications - Symphoniq
![]()
Free Download - 5 Minute Product Review. Realize the benefits of real user monitoring in less than an hour. - Symphoniq