AWT Section Index | Page 2
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 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.
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
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
I'm using setComponentZOrder() to have overlapping components but the last component I click on is always drawn on top. How do I fix this?
When components overlap, be sure their container returns false from the isOptimizedDrawingEnabled() method that is inherited from JComponent. This ensures that lower z-order components are not dra...more
How can I control the Z-order that my overlapping components are drawn in? - 06.30.05
How can I control the Z-order that my overlapping components are drawn in?
What is z-order?
To understand z-order, think first of x and y positioning. The x-y coordinate space places position (0, 0) at the top-left corner of the screen. Increasing the x value moves the position to the ri...more
How do I create a Graphics object?
The initial answer is "you don't; AWT does".
Graphics objects are your "window" into an image, whether that image is onscreen or offscreen.
If you're looking to paint onscreen, the only way you ...more