--- old/src/share/classes/java/awt/Window.java 2009-10-28 18:55:59.000000000 +0300 +++ new/src/share/classes/java/awt/Window.java 2009-10-28 18:55:59.000000000 +0300 @@ -149,6 +149,51 @@ public class Window extends Container implements Accessible { /** + * Enumeration of available window types. + * + * A window type defines the generic visual appearance and behavior of a + * top-level window. E.g., the type may affect the kind of decorations of a + * decorated {@code Frame} or {@code Dialog} instance. + *

+ * Some platforms may not fully support a certain window type. Depending on + * the level of support, some properties of the window type may be + * disobeied. + * + * @see #getType + * @see #setType + * @since 1.7 + */ + public static enum Type { + /** + * Represents a normal window. + * + * This is the default type for objects of the {@code Window} class or + * its descendants. Use this type for regular top-level windows. + */ + NORMAL, + + /** + * Represents an utility window. + * + * An utility window is usually a small window such as a toolbar or a + * palette. The native system may render the window with smaller + * title-bar if the window is either a {@code Frame} or a {@code + * Dialog} object, and has decorations enabled. + */ + UTILITY, + + /** + * Represents a popup window. + * + * A popup window is a temporary window such as a drop-down menu or a + * tooltip. On some platforms windows of that type may be forcibly made + * undecorated even if they are instances of the {@code Frame} or + * {@code Dialog} class, and have decorations enabled. + */ + POPUP + } + + /** * This represents the warning message that is * to be displayed in a non secure window. ie : * a window that has a security manager installed for @@ -2704,6 +2749,52 @@ } /** + * Window type. + * + * Synchronization: ObjectLock + */ + private Type type = Type.NORMAL; + + /** + * Sets the type of the window. + * + * This method can only be called while the window is not displayable. + * + * @throws IllegalComponentStateException if the window + * is displayable. + * @throws IllegalArgumentException if the type is {@code null} + * @see Component#isDisplayable + * @see #getType + * @since 1.7 + */ + public void setType(Type type) { + if (type == null) { + throw new IllegalArgumentException("type should not be null."); + } + synchronized (getTreeLock()) { + if (isDisplayable()) { + throw new IllegalComponentStateException( + "The window is displayable."); + } + synchronized (getObjectLock()) { + this.type = type; + } + } + } + + /** + * Returns the type of the window. + * + * @see #setType + * @since 1.7 + */ + public Type getType() { + synchronized (getObjectLock()) { + return type; + } + } + + /** * The window serialized data version. * * @serial