Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

java.awt
Class Window  view Window download Window.java

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, MenuContainer, java.io.Serializable
Direct Known Subclasses:
Dialog, Frame

public class Window
extends Container
implements javax.accessibility.Accessible

This class represents a top-level window with no decorations.


Nested Class Summary
protected  class Window.AccessibleAWTWindow
           
private  class Window.WindowBltBufferStrategy
          A BltBufferStrategy for windows.
private  class Window.WindowFlipBufferStrategy
          A FlipBufferStrategy for windows.
 
Nested classes inherited from class java.awt.Container
Container.AccessibleAWTContainer, Container.GfxPaintAllVisitor, Container.GfxPaintVisitor, Container.GfxPrintAllVisitor, Container.GfxPrintVisitor, Container.GfxVisitor
 
Nested classes inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy, Component.HeavyweightInLightweightListener
 
Field Summary
private  boolean focusableWindowState
           
private  GraphicsConfiguration graphicsConfiguration
           
private static long next_window_number
           
private  java.util.Vector ownedWindows
           
private static long serialVersionUID
           
private  boolean shown
           
private  int state
           
private  java.lang.String warningString
           
private  java.awt.event.WindowFocusListener windowFocusListener
           
(package private)  Component windowFocusOwner
           
private  java.awt.event.WindowListener windowListener
           
private  int windowSerializedDataVersion
           
private  java.awt.event.WindowStateListener windowStateListener
           
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, focusCycleRoot, focusTraversalKeys, layoutMgr, maxSize, ncomponents
 
Fields inherited from class java.awt.Component
accessibleContext, background, BOTTOM_ALIGNMENT, bufferStrategy, CENTER_ALIGNMENT, changeSupport, componentListener, componentSerializedDataVersion, cursor, dropTarget, enabled, eventMask, focusable, focusListener, focusTraversalKeysEnabled, font, foreground, graphicsConfig, height, hierarchyBoundsListener, hierarchyListener, ignoreRepaint, inputMethodListener, isFocusTraversableOverridden, isPacked, keyListener, LEFT_ALIGNMENT, locale, minSize, mouseListener, mouseMotionListener, mouseWheelListener, name, nameExplicitlySet, newEventsOnly, orientation, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, TOP_ALIGNMENT, treeLock, valid, visible, width, x, y
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
(package private) Window()
          This (package access) constructor is used by subclasses that want to build windows that do not have parents.
  Window(Frame owner)
          Initializes a new instance of Window with the specified parent.
(package private) Window(GraphicsConfiguration gc)
           
  Window(Window owner)
          Initializes a new instance of Window with the specified parent.
  Window(Window owner, GraphicsConfiguration gc)
          Initializes a new instance of Window with the specified parent.
 
Method Summary
 void addNotify()
          Creates the native peer for this window.
 void addWindowFocusListener(java.awt.event.WindowFocusListener wfl)
          Adds the specified listener to this window.
 void addWindowListener(java.awt.event.WindowListener listener)
          Adds the specified listener to the list of WindowListeners that will receive events for this window.
 void addWindowStateListener(java.awt.event.WindowStateListener wsl)
          Adds the specified listener to this window.
 void applyResourceBundle(java.util.ResourceBundle rb)
          Deprecated.  
 void applyResourceBundle(java.lang.String rbName)
          Deprecated.  
 void createBufferStrategy(int numBuffers)
          Creates a buffering strategy that manages how this window is repainted.
 void createBufferStrategy(int numBuffers, BufferCapabilities caps)
          Creates a buffering strategy that manages how this window is repainted.
(package private)  void dispatchEventImpl(AWTEvent e)
          Implementation of dispatchEvent.
 void dispose()
          Destroys any resources associated with this window.
(package private)  java.lang.String generateName()
          Generate a unique name for this window.
 javax.accessibility.AccessibleContext getAccessibleContext()
          Gets the AccessibleContext associated with this Window.
 java.awt.image.BufferStrategy getBufferStrategy()
          Returns the buffer strategy used by the window.
 boolean getFocusableWindowState()
          Returns the value of the focusableWindowState property.
 Container getFocusCycleRootAncestor()
          Returns the root container that owns the focus cycle where this component resides.
 Component getFocusOwner()
          Returns the child window that has focus if this window is active.
 GraphicsConfiguration getGraphicsConfiguration()
          Get graphics configuration.
(package private)  GraphicsConfiguration getGraphicsConfigurationImpl()
          Implementation method that allows classes such as Canvas and Window to override the graphics configuration without violating the published API.
 java.util.EventListener[] getListeners(java.lang.Class listenerType)
          Returns an array of all the objects currently registered as FooListeners upon this Window.
 java.util.Locale getLocale()
          Returns the locale that this window is configured for.
 Component getMostRecentFocusOwner()
          Returns the child component of this window that would receive focus if this window were to become focused.
 Window[] getOwnedWindows()
           
 Window getOwner()
           
 Toolkit getToolkit()
          Returns the toolkit used to create this window.
private static long getUniqueLong()
           
 java.lang.String getWarningString()
          Returns the warning string that will be displayed if this window is popped up by an unsecure applet or application.
 java.awt.event.WindowFocusListener[] getWindowFocusListeners()
          Returns an array of all the window focus listeners registered on this window.
 java.awt.event.WindowListener[] getWindowListeners()
          Returns an array of all the window listeners registered on this window.
 java.awt.event.WindowStateListener[] getWindowStateListeners()
          Returns an array of all the window state listeners registered on this window.
 void hide()
          Hides this component so that it is no longer shown on the screen.
 boolean isActive()
          Identifies if this window is active.
 boolean isFocusableWindow()
          Returns whether this Window can get the focus or not.
 boolean isFocusCycleRoot()
          Check whether this Container is a focus cycle root.
 boolean isFocused()
          Identifies if this window is focused.
 boolean isShowing()
          Tests whether or not this window is visible on the screen.
 void pack()
          Relays out this window's child components at their preferred size.
 boolean postEvent(Event e)
          Deprecated.  
protected  void processEvent(AWTEvent evt)
          Processes the specified event for this window.
protected  void processWindowEvent(java.awt.event.WindowEvent evt)
          Dispatches this event to any listeners that are listening for WindowEvents on this window.
protected  void processWindowFocusEvent(java.awt.event.WindowEvent event)
           
protected  void processWindowStateEvent(java.awt.event.WindowEvent event)
           
 void removeWindowFocusListener(java.awt.event.WindowFocusListener wfl)
          Removes the specified listener from this window.
 void removeWindowListener(java.awt.event.WindowListener listener)
          Removes the specified listener from the list of WindowListeners that will receive events for this window.
 void removeWindowStateListener(java.awt.event.WindowStateListener wsl)
          Removes the specified listener from this window.
 void setCursor(Cursor cursor)
          Sets the cursor for this window to the specifiec cursor.
 void setFocusableWindowState(boolean focusableWindowState)
          Sets the value of the focusableWindowState property.
 void setFocusCycleRoot(boolean focusCycleRoot)
          Set whether or not this Container is the root of a focus traversal cycle.
(package private)  void setFocusOwner(Component windowFocusOwner)
          Set the focus owner for this window.
 void setLocationRelativeTo(Component c)
           
 void show()
          Shows on-screen this window and any of its owned windows for whom isVisible returns true.
 void toBack()
          Sends this window to the back so that all other windows display in front of it.
 void toFront()
          Brings this window to the front so that it displays in front of any other windows.
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, eventTypeEnabled, findComponentAt, findComponentAt, findNextFocusComponent, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, invalidateTree, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setPeer, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, translateEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

warningString

private java.lang.String warningString

windowSerializedDataVersion

private int windowSerializedDataVersion

state

private int state
Since:
1.2

focusableWindowState

private boolean focusableWindowState
Since:
1.4

ownedWindows

private transient java.util.Vector ownedWindows

windowListener

private transient java.awt.event.WindowListener windowListener

windowFocusListener

private transient java.awt.event.WindowFocusListener windowFocusListener

windowStateListener

private transient java.awt.event.WindowStateListener windowStateListener

graphicsConfiguration

private transient GraphicsConfiguration graphicsConfiguration

shown

private transient boolean shown

windowFocusOwner

transient Component windowFocusOwner

next_window_number

private static transient long next_window_number
Constructor Detail

Window

Window()
This (package access) constructor is used by subclasses that want to build windows that do not have parents. Eg. toplevel application frames. Subclasses cannot call super(null), since null is an illegal argument.


Window

Window(GraphicsConfiguration gc)

Window

public Window(Frame owner)
Initializes a new instance of Window with the specified parent. The window will initially be invisible.


Window

public Window(Window owner)
Initializes a new instance of Window with the specified parent. The window will initially be invisible.

Since:
1.2

Window

public Window(Window owner,
              GraphicsConfiguration gc)
Initializes a new instance of Window with the specified parent. The window will initially be invisible.

Since:
1.3
Method Detail

getGraphicsConfigurationImpl

GraphicsConfiguration getGraphicsConfigurationImpl()
Description copied from class: Component
Implementation method that allows classes such as Canvas and Window to override the graphics configuration without violating the published API.

Overrides:
getGraphicsConfigurationImpl in class Component

addNotify

public void addNotify()
Creates the native peer for this window.

Overrides:
addNotify in class Container

pack

public void pack()
Relays out this window's child components at their preferred size.


show

public void show()
Shows on-screen this window and any of its owned windows for whom isVisible returns true.

Overrides:
show in class Component

hide

public void hide()
Description copied from class: Component
Hides this component so that it is no longer shown on the screen.

Overrides:
hide in class Component

dispose

public void dispose()
Destroys any resources associated with this window. This includes all components in the window and all owned top-level windows.


toBack

public void toBack()
Sends this window to the back so that all other windows display in front of it.


toFront

public void toFront()
Brings this window to the front so that it displays in front of any other windows.


getToolkit

public Toolkit getToolkit()
Returns the toolkit used to create this window.

Overrides:
getToolkit in class Component

getWarningString

public final java.lang.String getWarningString()
Returns the warning string that will be displayed if this window is popped up by an unsecure applet or application.


getLocale

public java.util.Locale getLocale()
Returns the locale that this window is configured for.

Overrides:
getLocale in class Component

setCursor

public void setCursor(Cursor cursor)
Sets the cursor for this window to the specifiec cursor.

Overrides:
setCursor in class Component

getOwner

public Window getOwner()

getOwnedWindows

public Window[] getOwnedWindows()
Since:
1.2

addWindowListener

public void addWindowListener(java.awt.event.WindowListener listener)
Adds the specified listener to the list of WindowListeners that will receive events for this window.


removeWindowListener

public void removeWindowListener(java.awt.event.WindowListener listener)
Removes the specified listener from the list of WindowListeners that will receive events for this window.


getWindowListeners

public java.awt.event.WindowListener[] getWindowListeners()
Returns an array of all the window listeners registered on this window.

Since:
1.4

getWindowFocusListeners

public java.awt.event.WindowFocusListener[] getWindowFocusListeners()
Returns an array of all the window focus listeners registered on this window.

Since:
1.4

getWindowStateListeners

public java.awt.event.WindowStateListener[] getWindowStateListeners()
Returns an array of all the window state listeners registered on this window.

Since:
1.4

addWindowFocusListener

public void addWindowFocusListener(java.awt.event.WindowFocusListener wfl)
Adds the specified listener to this window.


addWindowStateListener

public void addWindowStateListener(java.awt.event.WindowStateListener wsl)
Adds the specified listener to this window.

Since:
1.4

removeWindowFocusListener

public void removeWindowFocusListener(java.awt.event.WindowFocusListener wfl)
Removes the specified listener from this window.


removeWindowStateListener

public void removeWindowStateListener(java.awt.event.WindowStateListener wsl)
Removes the specified listener from this window.

Since:
1.4

getListeners

public java.util.EventListener[] getListeners(java.lang.Class listenerType)
Returns an array of all the objects currently registered as FooListeners upon this Window. FooListeners are registered using the addFooListener method.

Overrides:
getListeners in class Container
Since:
1.3

dispatchEventImpl

void dispatchEventImpl(AWTEvent e)
Description copied from class: Component
Implementation of dispatchEvent. Allows trusted package classes to dispatch additional events first. This implementation first translates e to an AWT 1.0 event and sends the result to Component.postEvent(java.awt.Event) 55 . If the AWT 1.0 event is not handled, and events of type e are enabled for this component, e is passed on to Component.processEvent(java.awt.AWTEvent) 55 .

Overrides:
dispatchEventImpl in class Container

processEvent

protected void processEvent(AWTEvent evt)
Processes the specified event for this window. If the event is an instance of WindowEvent, then processWindowEvent() is called to process the event, otherwise the superclass version of this method is invoked.

Overrides:
processEvent in class Container

processWindowEvent

protected void processWindowEvent(java.awt.event.WindowEvent evt)
Dispatches this event to any listeners that are listening for WindowEvents on this window. This method only gets invoked if it is enabled via enableEvents() or if a listener has been added.


isActive

public boolean isActive()
Identifies if this window is active. The active window is a Frame or Dialog that has focus or owns the active window.

Since:
1.4

isFocused

public boolean isFocused()
Identifies if this window is focused. A window is focused if it is the focus owner or it contains the focus owner.

Since:
1.4

getFocusOwner

public Component getFocusOwner()
Returns the child window that has focus if this window is active. This method returns null if this window is not active or no children have focus.


getMostRecentFocusOwner

public Component getMostRecentFocusOwner()
Returns the child component of this window that would receive focus if this window were to become focused. If the window already has the top-level focus, then this method returns the same component as getFocusOwner. If no child component has requested focus within the window, then the initial focus owner is returned. If this is a non-focusable window, this method returns null.

Since:
1.4

setFocusOwner

void setFocusOwner(Component windowFocusOwner)
Set the focus owner for this window. This method is used to remember which component was focused when this window lost top-level focus, so that when it regains top-level focus the same child component can be refocused.


postEvent

public boolean postEvent(Event e)
Deprecated.  

Post a Java 1.0 event to the event queue.

Specified by:
postEvent in interface MenuContainer
Overrides:
postEvent in class Component

isShowing

public boolean isShowing()
Tests whether or not this window is visible on the screen. In contrast to the normal behaviour of Container, which is that a container is showing if its parent is visible and showing, a Window is even showing, if its parent (i.e. an invisible Frame) is not showing.

Overrides:
isShowing in class Component

setLocationRelativeTo

public void setLocationRelativeTo(Component c)

createBufferStrategy

public void createBufferStrategy(int numBuffers)
Creates a buffering strategy that manages how this window is repainted. This method attempts to create the optimum strategy based on the desired number of buffers. Hardware or software acceleration may be used. createBufferStrategy attempts different levels of optimization, but guarantees that some strategy with the requested number of buffers will be created even if it is not optimal. First it attempts to create a page flipping strategy, then an accelerated blitting strategy, then an unaccelerated blitting strategy. Calling this method causes any existing buffer strategy to be destroyed.

Since:
1.4

createBufferStrategy

public void createBufferStrategy(int numBuffers,
                                 BufferCapabilities caps)
                          throws AWTException
Creates a buffering strategy that manages how this window is repainted. This method attempts to create a strategy based on the specified capabilities and throws an exception if the requested strategy is not supported. Calling this method causes any existing buffer strategy to be destroyed.

Since:
1.4

getBufferStrategy

public java.awt.image.BufferStrategy getBufferStrategy()
Returns the buffer strategy used by the window.

Since:
1.4

applyResourceBundle

public void applyResourceBundle(java.util.ResourceBundle rb)
                         throws gnu.classpath.NotImplementedException
Deprecated.  

Since:
1.2

applyResourceBundle

public void applyResourceBundle(java.lang.String rbName)
Deprecated.  

Since:
1.2

getAccessibleContext

public javax.accessibility.AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this Window. The context is created, if necessary.

Specified by:
getAccessibleContext in interface javax.accessibility.Accessible
Overrides:
getAccessibleContext in class Component

getGraphicsConfiguration

public GraphicsConfiguration getGraphicsConfiguration()
Get graphics configuration. The implementation for Window will not ask any parent containers, since Window is a toplevel window and not actually embedded in the parent component.

Overrides:
getGraphicsConfiguration in class Component

processWindowFocusEvent

protected void processWindowFocusEvent(java.awt.event.WindowEvent event)

processWindowStateEvent

protected void processWindowStateEvent(java.awt.event.WindowEvent event)
Since:
1.4

isFocusableWindow

public final boolean isFocusableWindow()
Returns whether this Window can get the focus or not.

Since:
1.4

getFocusableWindowState

public boolean getFocusableWindowState()
Returns the value of the focusableWindowState property.

Since:
1.4

setFocusableWindowState

public void setFocusableWindowState(boolean focusableWindowState)
Sets the value of the focusableWindowState property.

Since:
1.4

isFocusCycleRoot

public final boolean isFocusCycleRoot()
Check whether this Container is a focus cycle root. Returns always true as Windows are the root of the focus cycle.

Overrides:
isFocusCycleRoot in class Container
Since:
1.4

setFocusCycleRoot

public final void setFocusCycleRoot(boolean focusCycleRoot)
Set whether or not this Container is the root of a focus traversal cycle. Windows are the root of the focus cycle and therefore this method does nothing.

Overrides:
setFocusCycleRoot in class Container
Since:
1.4

getFocusCycleRootAncestor

public final Container getFocusCycleRootAncestor()
Returns the root container that owns the focus cycle where this component resides. Windows have no ancestors and this method returns always null.

Overrides:
getFocusCycleRootAncestor in class Component
Since:
1.4

generateName

java.lang.String generateName()
Generate a unique name for this window.

Overrides:
generateName in class Component

getUniqueLong

private static long getUniqueLong()