AWT Section Index
When dropping an object over a JTree, how do you determine the node being dropped over?
The importData() method of your TransferHandler has a TransferSupport argument. From this support object, you can ask for the drop location with getDropLocation(). This returns an implementation o...more
When having a droppable JTree, how do I change the default behavior of using selection to see the active drop target?
JTree has a setDropMode() method to change the default setting of USE_SELECTION. Other valid modes are ON, INSERT, and ON_OR_INSERT. ON lets you drop something onto another node. INSERT is for bet...more
How can I find out if my application is being used with a screen magnifier?
The javax.accessibility.screen_magnifier_present property is available. When true, the magnifier is present, and your application can be altered accordingly.
What accessible roles were added to the 1.4 J2SE accessibility API?
Class AccessibleRole Added the following constants:
DATE_EDITOR
FONT_CHOOSER
GROUP_BOX
SPIN_BOX
STATUS_BAR
Which accessible interfaces were added for J2SE 1.4?
The 1.4 API increased the accessibility API by adding the following:
javax.accessibility.AccessibleEditableText
javax.accessibility.AccessibleExtendedComponent
javax.accessibility.AccessibleExt...more
What is the purpose of AccessibleExtendedComponent?
The original accessible API set missed some features in the AccessibleComponent interface. Since the main interface couldn't be altered, Sun introduced a secondary interface AccessibleExtendedComp...more
How do I explicitly set the Toolkit for my program?
Either by setting the AWT_TOOLKIT environment variable or the awt.toolkit system property.
The AWT_TOOLKIT environment variable can be set to XToolkit or MToolkit depending upon which of the Unix...more
What this I hear about a new Toolkit for Linux machines in Java 5.0?
J2SE 5.0 reimplemented the AWT Toolkit to remove the Motif and Xt dependency and improve performance. Solaris still keeps the Motif default but Linux machines uses the newer XToolkit as its default.more
Should I use the invokeLater() and invokeAndWait() method of EventQueue or SwingUtilities?
Short answer: EventQueue.
Longer answer... Utility methods were added to the SwingUtilities class because the first version of the Swing classes had to work with JDK 1.1, even though Swing was re...more
I want the user to be able to input tabs in my application, but the tab character moves the input focus to the next component in the app and my application's keylistener gets nothing. Is there any way to change this behaviour ?
The tab is a focus traversal key by default and you have to change this to catch the tab entries in your keylistener. You do this by overriding the Component method : getFocusTraversalKeys(int id)...more
How can I write a GIF image?
Patent restrictions didn't allow a GIF writer to be part of the Java platform prior to JDK 6. With the recent expiration of the Unisys patent, JDK 6 includes support.
import javax.imageio.*;
impo...more
How can I place my Java app in the Windows System Tray area?
Java 6 offers a SystemTray class for this. Users of prior versions of Java can add this through the JDesktop Integration Components (JDIC) available from https://jdic.dev.java.net/. You'll find a ...more
How do I use the default mail client to send an email?
The Java 6 Desktop class has a mail() method for just such an action.
After adding a bunch of points to a Polygon, can I reuse it or must I create a new one?
You can call reset() to remove the existing set of points from a Polygon. With that said, according to the javadoc: All internally-cached data relating to the old vertices are discarded. Note that...more
How do I test my program for how accessible it is?
Sun provides the Java Access Bridge for Microsoft Windows users, with programs like Monkey and Ferret to see how well you've designed your graphical programs to take advantage of assistive technol...more