Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class java.awt.Window

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
Subclasses:
Frame

public class Window
extends Container
A Window object is a top-level window with no borders and no menubar. The default layout for a window is BorderLayout.

Windows are capable of generating the following window events: WindowOpened, WindowClosed.

Since:
JDK1.0
Version:
1.89, 06/15/98
See Also:
WindowEvent, addWindowListener, java.awt.BorderLayout, Serialized Form

Inner classes inherited from class java.awt.Component
Component.NativeInLightFixer
 
Field Summary
boolean active
           
static String base
           
FocusManager focusMgr
           
java.awt.im.InputContext inputContext
           
static int nameCounter
           
static int OPENED
           
java.util.Vector ownedWindowList
           
static long serialVersionUID
           
int state
           
String warningString
           
java.awt.event.WindowListener windowListener
           
int windowSerializedDataVersion
           
 
Fields inherited from class java.awt.Container
component, containerListener, containerSerializedDataVersion, dispatcher, layoutMgr, maxSize, ncomponents, serialVersionUID
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, assert, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, changeSupport, componentListener, componentListenerK, componentOrientation, componentSerializedDataVersion, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, name, nameExplicitlySet, newEventsOnly, parent, peer, popups, prefSize, RIGHT_ALIGNMENT, serialVersionUID, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
Window()
           
Window(Frame owner)
          Constructs a new invisible window.
Window(Window owner)
          Constructs a new invisible window with the specified window as its owner.
 
Method Summary
void addNotify()
          Creates the Window's peer.
Window addOwnedWindow(Window window)
           
void addWindowListener(java.awt.event.WindowListener l)
          Adds the specified window listener to receive window events from this window.
void applyResourceBundle(java.util.ResourceBundle rb)
          Apply the settings in the given ResourceBundle to this Window.
void applyResourceBundle(String rbName)
          Load the ResourceBundle with the given name using the default locale and apply its settings to this window.
void connectOwnedWindows()
           
String constructComponentName()
          Construct a name for this component.
void dispatchEventImpl(AWTEvent e)
           
void dispose()
          Disposes of this window.
boolean eventEnabled(AWTEvent e)
           
Component getFocusOwner()
          Returns the child component of this Window which has focus if and only if this Window is active.
java.awt.im.InputContext getInputContext()
          Gets the input context for this window.
java.util.Locale getLocale()
          Gets the Locale object that is associated with this window, if the locale has been set.
Window[] getOwnedWindows()
          Return an array containing all the windows this window currently owns.
Window getOwner()
          Returns the owner of this window.
java.awt.Toolkit getToolkit()
          Returns the toolkit of this frame.
String getWarningString()
          Gets the warning string that is displayed with this window.
boolean isActive()
           
boolean isShowing()
          Checks if this Window is showing on screen.
void nextFocus(Component base)
          Deprecated.  
void pack()
          Causes subcomponents of this window to be laid out at their preferred size.
boolean postEvent(Event e)
          Deprecated.  
void postProcessKeyEvent(java.awt.event.KeyEvent e)
           
void postWindowEvent(int id)
           
void preProcessKeyEvent(java.awt.event.KeyEvent e)
           
void processEvent(AWTEvent e)
          Processes events on this window.
void processWindowEvent(WindowEvent e)
          Processes window events occurring on this window by dispatching them to any registered WindowListener objects.
void readObject(java.io.ObjectInputStream s)
           
void removeOwnedWindow(Window window)
           
void removeWindowListener(java.awt.event.WindowListener l)
          Removes the specified window listener so that it no longer receives window events from this window.
void setFocusOwner(Component c)
           
void setWarningString()
           
void show()
          Shows this window, and brings it to the front.
void toBack()
          Sends this window to the back.
void toFront()
          Brings this window to the front.
void transferFocus(Component base)
           
void writeObject(java.io.ObjectOutputStream s)
           
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, applyOrientation, countComponents, deliverEvent, dispatchEventImpl, doLayout, eventEnabled, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponentAt, getComponentAt, getComponent, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, nextFocus, paintComponents, paint, paramString, postProcessKeyEvent, postsOldMouseEvents, preferredSize, preProcessKeyEvent, printComponents, print, processContainerEvent, processEvent, proxyEnableEvents, proxyRequestFocus, readObject, removeAll, remove, remove, removeContainerListener, removeNotify, setFocusOwner, setLayout, transferFocus, update, validate, validateTree, writeObject
 
Methods inherited from class java.awt.Component
, action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, constructComponentName, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, dispatchEventImpl, doLayout, enable, enable, enableEvents, enableInputMethods, ensureWindowActivation, eventEnabled, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getNativeContainer, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getWindowForObject, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, initIDs, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paint, paramString, postEvent, postsOldMouseEvents, preferredSize, prepareImage, prepareImage, printAll, print, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, readObject, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate, writeObject
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notifyAll, notify, registerNatives, toString, wait, wait, wait
 

Field Detail

warningString

String warningString

OPENED

static final int OPENED

state

int state

ownedWindowList

java.util.Vector ownedWindowList

windowListener

transient java.awt.event.WindowListener windowListener

active

private transient boolean active

inputContext

transient java.awt.im.InputContext inputContext

focusMgr

private FocusManager focusMgr

base

private static final String base

nameCounter

private static int nameCounter

serialVersionUID

private static final long serialVersionUID

windowSerializedDataVersion

private int windowSerializedDataVersion
Constructor Detail

Window

Window()

Window

public Window(Frame owner)
Constructs a new invisible window.

The window is not initially visible. Call the show method to cause the window to become visible.

Parameters:
owner - the main application frame.
Throws:
java.lang.IllegalArgumentException - if owner is null
See Also:
show, setSize


Window

public Window(Window owner)
Constructs a new invisible window with the specified window as its owner.
Parameters:
owner - the window to act as owner
Throws:
java.lang.IllegalArgumentException - if owner is null
Method Detail

constructComponentName

String constructComponentName()
Construct a name for this component. Called by getName() when the name is null.
Overrides:
constructComponentName in class Component

addNotify

public void addNotify()
Creates the Window's peer. The peer allows us to modify the appearance of the Window without changing its functionality.
Overrides:
addNotify in class Container

pack

public void pack()
Causes subcomponents of this window to be laid out at their preferred size.

show

public void show()
Shows this window, and brings it to the front.

If this window is not yet visible, show makes it visible. If this window is already visible, then this method brings it to the front.

Overrides:
show in class Component
See Also:
toFront, setVisible


postWindowEvent

void postWindowEvent(int id)

dispose

public void dispose()
Disposes of this window. This method must be called to release the resources that are used for the window. This method will automatically dispose any Windows which this window currently owns.

Invoking this method will also dispose of any InputContext associated with the Window.


toFront

public void toFront()
Brings this window to the front. Places this window at the top of the stacking order and shows it in front of any other windows.
See Also:
toBack

toBack

public void toBack()
Sends this window to the back. Places this window at the bottom of the stacking order and makes the corresponding adjustment to other visible windows.
See Also:
toFront

getToolkit

public java.awt.Toolkit getToolkit()
Returns the toolkit of this frame.
Returns:
the toolkit of this window.
Overrides:
getToolkit in class Component
See Also:
java.awt.Toolkit, getDefaultToolkit(), getToolkit()

getWarningString

public final String getWarningString()
Gets the warning string that is displayed with this window. If this window is insecure, the warning string is displayed somewhere in the visible area of the window. A window is insecure if there is a security manager, and the security manager's checkTopLevelWindow method returns false when this window is passed to it as an argument.

If the window is secure, then getWarningString returns null. If the window is insecure, this method checks for the system property awt.appletWarning and returns the string value of that property.

Returns:
the warning string for this window.
See Also:
checkTopLevelWindow(java.lang.Object)


setWarningString

private void setWarningString()

getLocale

public java.util.Locale getLocale()
Gets the Locale object that is associated with this window, if the locale has been set. If no locale has been set, then the default locale is returned.
Returns:
the locale that is set for this window.
Overrides:
getLocale in class Component
See Also:
java.util.Locale

getInputContext

public java.awt.im.InputContext getInputContext()
Gets the input context for this window. A window always has an input context, which is shared by subcomponents unless they create and set their own.
Overrides:
getInputContext in class Component
See Also:
getInputContext

getOwner

public Window getOwner()
Returns the owner of this window.

getOwnedWindows

public Window[] getOwnedWindows()
Return an array containing all the windows this window currently owns.

addWindowListener

public void addWindowListener(java.awt.event.WindowListener l)
Adds the specified window listener to receive window events from this window.
Parameters:
l - the window listener

removeWindowListener

public void removeWindowListener(java.awt.event.WindowListener l)
Removes the specified window listener so that it no longer receives window events from this window.
Parameters:
l - the window listener

eventEnabled

boolean eventEnabled(AWTEvent e)
Overrides:
eventEnabled in class Container

isActive

boolean isActive()

processEvent

protected void processEvent(AWTEvent e)
Processes events on this window. If the event is an WindowEvent, it invokes the processWindowEvent method, else it invokes its superclass's processEvent.
Parameters:
e - the event
Overrides:
processEvent in class Container

processWindowEvent

protected void processWindowEvent(WindowEvent e)
Processes window events occurring on this window by dispatching them to any registered WindowListener objects. NOTE: This method will not be called unless window events are enabled for this component; this happens when one of the following occurs: a) A WindowListener object is registered via addWindowListener() b) Window events are enabled via enableEvents()
Parameters:
e - the window event
See Also:
enableEvents

preProcessKeyEvent

void preProcessKeyEvent(java.awt.event.KeyEvent e)
Overrides:
preProcessKeyEvent in class Container

postProcessKeyEvent

void postProcessKeyEvent(java.awt.event.KeyEvent e)
Overrides:
postProcessKeyEvent in class Container

setFocusOwner

void setFocusOwner(Component c)
Overrides:
setFocusOwner in class Container

transferFocus

void transferFocus(Component base)
Overrides:
transferFocus in class Container

getFocusOwner

public Component getFocusOwner()
Returns the child component of this Window which has focus if and only if this Window is active.
Returns:
the component with focus, or null if no children have focus assigned to them.

nextFocus

void nextFocus(Component base)
Deprecated. As of JDK version 1.1, replaced by transferFocus(Component).
Overrides:
nextFocus in class Container

dispatchEventImpl

void dispatchEventImpl(AWTEvent e)
Overrides:
dispatchEventImpl in class Container

postEvent

public boolean postEvent(Event e)
Deprecated. As of JDK version 1.1 replaced by dispatchEvent(AWTEvent).
Overrides:
postEvent in class Component

isShowing

public boolean isShowing()
Checks if this Window is showing on screen.
Overrides:
isShowing in class Component
See Also:
setVisible(boolean)

applyResourceBundle

public void applyResourceBundle(java.util.ResourceBundle rb)
Apply the settings in the given ResourceBundle to this Window. Currently, this applies the ResourceBundle's ComponentOrientation to this Window and all components contained within it.
See Also:
java.awt.ComponentOrientation

applyResourceBundle

public void applyResourceBundle(String rbName)
Load the ResourceBundle with the given name using the default locale and apply its settings to this window. Currently, this applies the ResourceBundle's ComponentOrientation to this Window and all components contained within it.
See Also:
java.awt.ComponentOrientation

addOwnedWindow

Window addOwnedWindow(Window window)

removeOwnedWindow

void removeOwnedWindow(Window window)

connectOwnedWindows

void connectOwnedWindows()

writeObject

private void writeObject(java.io.ObjectOutputStream s)
                 throws java.io.IOException
Overrides:
writeObject in class Container

readObject

private void readObject(java.io.ObjectInputStream s)
                throws java.lang.ClassNotFoundException,
                       java.io.IOException
Overrides:
readObject in class Container

Class | Tree | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD