AWT Enhancements in the JavaTM Standard Edition 6.0
- Splash Screen
- System Tray
- Enhancements to Layouting Components
- Enhancements of the
Known Bugs and Issues
The following features were introduced in the Java SE 6.0:
The new modality model was introduced to handle modality blocking of a dialog box. This model comprises four modality types: modeless, application-modal, document-modal, and toolkit-modal.public Dialog(Window owner, String title, Dialog.ModalityType modalityType,GraphicsConfiguration gc)
modalityTypesparameter specifies whether a dialog box blocks input to other windows when shown. The null value and unsupported modality types are equivalent to the modeless type. The
setModalityTypemethods of the
Dialogclass allows you accordingly to return and set the modality type for the dialog box.
Any top-level window can be marked so it will not be blocked by modal dialogs. This property enables you to set up the modal exclusion mode. The
setModalExclusionTypemethod of the
Windowclass specifies one of the following modal exclusion modes:
See the How to Use Modality in Dialogs section of the Swing tutorial for more information about modality.The Desktop API (
java.awt.Desktop) API is provided to allow Java applications to interact with default applications associated with specific file types. All provided actions are represented as a
- BROWSE — Represents a browse action performed by the host's default browser.
- MAIL — Represents a mail action performed by the host's default email client.
- OPEN — Represents an open action performed by an application associated with opening a specific file type.
- EDIT — Represents an edit action performed by an application associated with editing a specific file type
- PRINT — Represents a print action performed by an application associated with printing a specific file type.
isSupportedmethod of the
Desktopclass to check whether an action is supported on the current platform.
See the How to Integrate with the Desktop Class section of the Swing tutorial for more information about using the
There is a new solution that allows the application to display the splash screen before the virtual machine starts has been introduced. Although the
SplashScreenclass cannot be sued to create a splash screen, a Java application can close the splash screen, change the splash screen image, get the image position/size and paint in the splash screen. An instance of the
SplashScreenclass can be obtained using the
To run an application with the splash screen from the command line use the following command:java -splash:<file name> <class name>
See the How to Create a Splash Screen section of the Swing Tutorial for more information about splash screen.
SystemTrayclass is intended to represent the system tray for a desktop. The system tray can be accessed by calling the
getSystemTray()static method. The system tray may contain one or more tray icons represented by the
TrayIconclass objects. However, the
TrayIconclass functionality is not limited to creating a tray icon. It also includes a text tooltip, a pop-up menu, and balloon messages:TrayIcon trayIcon = new TrayIcon(createImage("icon.gif", "tray icon")); trayIcon.displayMessage("Sun TrayIcon Demo", "This is an info message", TrayIcon.MessageType.INFO); trayIcon.setToolTip("Sun TrayIcon");
Note: The current implementation of the
TrayIconclass provides limited support of the Swing components. The workaround proposal for this issue is described in the Bug Database, see Bug ID 6285881.
See the How to Use the System Tray section of the Swing Tutorial for more information about the system tray and tray icons.
Two new methods of the
java.awt.Componentclass enable to obtain the baseline measured from the top of the component and to handle the baseline change as the size of the component changes:
public int getBaseline(int width int height)
public Component.BaselineResizeBehavior getBaselineResizeBehavior()
Two methods were introduced to control vertical components' alignment along their baseline:
The following constraints were added to the
GridBagConstraintsclass to enhance lay outing components with the
GridBagLayoutInfoclass was introduced to store align, size, and baseline parameters for every component within a container while lay outing components using
New methods were added to the
Windowclass to handle images that are displayed as the icon for the window. While the
setIconImage(Image image)method sets the only one image, the
setIconImages(List<? extends Image> icons)method supports the sequence of images of different dimensions to be applied depending on the platform capabilities.
In Java SE 6 a
Dialogobject can be created without a parent frame, the
ownerparameter in constructors of such objects equals
Here is a list of the key bug fixes:
6404008 Delivery of mouse events depends on drag sensitivity:
Mouse dragged events were received after the drag sensitivity setting of the operating system is reached. In the proposed solution the drag distance parameter of the operating system is ignored. Java drag events will be ganerated on the first movement of the mouse.
6242833 A mouse cursor does not behave properly after maximizing a window on Linux/JDS 3:
Some events essential for cursor update were not delivered while maximazing a window. The fix comprises x-crossing event handling within XWindow.
4841881: Tabbing by using Alt+Tab on Windows L&F moves focus to the application menu bar
Using Alt+Tab to navigate from a Java window to a native application window and back to the Java window resulted in the focus being moved to the first menu item of the Java window. The proposed fix allows to keep the focus on the initially focused component of the Java window.
6291992: All editable fields get frozenEditable fields became unable to be edited or to get the focus (
JTextArea, etc), even in fields that have been previously edited. Other components as combo boxes, tables, radio buttons remain editable.
6176814: Multi-click handling
The XWindow.java code lacks multi click handling. So, when the user dragged the mouse on the screen onto the Linux box, double clicks occurred when the user expected single clicks. Likewise, single clicks occurred when the user expected no clicks at all. The fix includes the
AWT_MULTICLICK_SMUDGEvariable to apply a smudge factor so that moving the mouse by a small amount does not wipe out the multi-click state variables.
5051557: The applet does not respond to keyboard commands
The applet itself did not get the focus, which apparently went to the embedded frame.This incompatibility was caused by a focus rearchitecture introduced in Java SE 1.4. The fix restores initial proper behavior.
4320050: Minimum size for a
Frameobject is not being enforced
Window.setMinimumSize()method has been modified to restrict user-resizing of top-level windows below specified dimensions. Previously, minimum size set for toplevel windows was ignored by platform, so this change can impact code that uses the
minimumSizeproperty of top-level windows for its own needs.
6199167: Live resizing
Native applications on Windows had the property to dynamically relayout and repaint during resizing. This property was controlled through system desktop settings. Java disables this property by default. In Java SE 6 the required property is enables by default.
4360364: Cyrillic input is not supported
If a locale was defined incorrectly, a native Input Method did not process keysyms and passed them as is to AWT
handleKeyEventroutine. In the fix a conversion table is added and key event handling generally streamlined in non Input Method situations.
Here is a list of known problems you may encounter in release 6.0.
JWindowcomponent stays on top of all other windows
JWindowcomponent stays up on top of all other windows hiding other windows behind it on Solaris and Linux. To workaround, you can use an undecorated frame.
6387273: The JVM crash
In some synthetic situations (such as repeated showing/disposing of a toplevel) the JVM may crash.
Copyright © 1993, 2011, Oracle and/or its affiliates. All rights reserved.