Window
classThe 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)
The modalityTypes
parameter 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 getModalityType
and setModalityType
methods of the Dialog
class 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 setModalExclusionType
method
of the Window
class specifies one of the following
modal exclusion modes: APPLICATION_EXCLUDE
,
TOOLKIT_EXCLUDE
, or NO_EXCLUDE
.
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
Desktop.Action
enumeration instance:
Use the
isSupported
method of the Desktop
class 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 Desktop
class.
There is a new solution that allows the application to display
the splash screen before the virtual machine starts has been
introduced. Although the SplashScreen
class 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 SplashScreen
class can be obtained using the
getSplashScreen()
static method.
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.
The SystemTray
class 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 TrayIcon
class objects. However, the TrayIcon
class
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
TrayIcon
class 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.Component
class
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()
FlowLayout:
Two methods were introduced to control vertical components' alignment along their baseline:
GridBagLayout:
The following constraints were added to the
GridBagConstraints
class to enhance lay outing
components with the GridBagLayout
class:
BASELINE
BASELINE_LEADING
BASELINE_TRAILING
ABOVE_BASELINE
ABOVE_BASELINE_LEADING
ABOVE_BASELINE_TRAILING
BELOW_BASELINE
BELOW_BASELINE_LEADING
BELOW_BASELINE_TRAILING
Additionally the
GridBagLayoutInfo
class was introduced to store align,
size, and baseline parameters for every component within a
container while lay outing components using
GridBagLayout
.
Window
classNew methods were added to the Window
class 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 Window
or Dialog
object
can be created without a parent frame, the owner
parameter in constructors of such objects equals
null
.
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.
Some events essential for cursor update were not delivered while maximazing a window. The fix comprises x-crossing event handling within XWindow.
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.
JTextField
, JTextArea
, etc), even in
fields that have been previously edited. Other components as combo
boxes, tables, radio buttons remain editable.
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_SMUDGE
variable to
apply a smudge factor so that moving the mouse by a small amount
does not wipe out the multi-click state variables.
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.
Frame
object is
not being enforcedThe 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 minimumSize
property 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.
If a locale was defined incorrectly, a native Input Method did
not process keysyms and passed them as is to AWT
handleKeyEvent
routine. 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.
JWindow
component stays on top of all
other windowsThe JWindow
component 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.
In some synthetic situations (such as repeated showing/disposing of a toplevel) the JVM may crash.