public class Window extends Container implements Accessible
Modifier and Type | Class and Description |
---|---|
protected class |
Window.AccessibleAWTWindow |
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
Window(Frame owner)
Initializes a new instance of
Window with the specified
parent. |
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. |
Modifier and Type | Method and Description |
---|---|
void |
addNotify()
Creates the native peer for this window.
|
void |
addWindowFocusListener(WindowFocusListener wfl)
Adds the specified listener to this window.
|
void |
addWindowListener(WindowListener listener)
Adds the specified listener to the list of
WindowListeners
that will receive events for this window. |
void |
addWindowStateListener(WindowStateListener wsl)
Adds the specified listener to this window.
|
void |
applyResourceBundle(ResourceBundle rb)
Deprecated.
replaced by Component.applyComponentOrientation.
|
void |
applyResourceBundle(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.
|
void |
dispose()
Destroys any resources associated with this window.
|
AccessibleContext |
getAccessibleContext()
Gets the AccessibleContext associated with this
Window . |
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.
|
<T extends EventListener> |
getListeners(Class<T> listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this Window.
|
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.
|
String |
getWarningString()
Returns the warning string that will be displayed if this window is
popped up by an unsecure applet or application.
|
WindowFocusListener[] |
getWindowFocusListeners()
Returns an array of all the window focus listeners registered on this
window.
|
WindowListener[] |
getWindowListeners()
Returns an array of all the window listeners registered on this window.
|
WindowStateListener[] |
getWindowStateListeners()
Returns an array of all the window state listeners registered on this
window.
|
void |
hide()
Deprecated.
|
boolean |
isActive()
Identifies if this window is active.
|
boolean |
isAlwaysOnTop()
Returns whether the Windows is an always-on-top window,
meaning whether the window can be obscured by other windows or not.
|
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(WindowEvent evt)
Dispatches this event to any listeners that are listening for
WindowEvents on this window. |
protected void |
processWindowFocusEvent(WindowEvent event) |
protected void |
processWindowStateEvent(WindowEvent event) |
void |
removeWindowFocusListener(WindowFocusListener wfl)
Removes the specified listener from this window.
|
void |
removeWindowListener(WindowListener listener)
Removes the specified listener from the list of
WindowListeners that will receive events for this window. |
void |
removeWindowStateListener(WindowStateListener wsl)
Removes the specified listener from this window.
|
void |
setAlwaysOnTop(boolean alwaysOnTop)
Sets the always-on-top state of this window (if supported).
|
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.
|
void |
setLocationRelativeTo(Component c) |
void |
show()
Deprecated.
|
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.
|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, paramString, preferredSize, print, printComponents, processContainerEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusDownCycle, update, validate, validateTree
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, getMousePosition, 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, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, 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, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
public Window(Frame owner)
Window
with the specified
parent. The window will initially be invisible.owner
- The owning Frame
of this window.IllegalArgumentException
- If the owner's GraphicsConfiguration
is not from a screen device, or if owner is null; this exception is always
thrown when GraphicsEnvironment.isHeadless returns true.public Window(Window owner)
Window
with the specified
parent. The window will initially be invisible.IllegalArgumentException
- If the owner's GraphicsConfiguration
is not from a screen device, or if owner is null; this exception is always
thrown when GraphicsEnvironment.isHeadless returns true.public Window(Window owner, GraphicsConfiguration gc)
Window
with the specified
parent. The window will initially be invisible.IllegalArgumentException
- If owner is null or if gc is not from a
screen device; this exception is always thrown when
GraphicsEnvironment.isHeadless returns true.public void addNotify()
addNotify
in class Container
Component.isDisplayable()
,
Component.removeNotify()
public void pack()
@Deprecated public void show()
@Deprecated public void hide()
Component
public void dispose()
public void toBack()
public void toFront()
public Toolkit getToolkit()
getToolkit
in class Component
public final String getWarningString()
public Locale getLocale()
getLocale
in class Component
Component.setLocale(Locale)
public void setCursor(Cursor cursor)
setCursor
in class Component
cursor
- The new cursor for this window.Component.isEnabled()
,
Component.isShowing()
,
Component.getCursor()
,
Component.contains(int, int)
,
Toolkit.createCustomCursor(Image, Point, String)
public Window[] getOwnedWindows()
public void addWindowListener(WindowListener listener)
WindowListeners
that will receive events for this window.listener
- The WindowListener
to add.public void removeWindowListener(WindowListener listener)
WindowListeners
that will receive events for this window.listener
- The WindowListener
to remove.public WindowListener[] getWindowListeners()
public WindowFocusListener[] getWindowFocusListeners()
public WindowStateListener[] getWindowStateListeners()
public void addWindowFocusListener(WindowFocusListener wfl)
public void addWindowStateListener(WindowStateListener wsl)
public void removeWindowFocusListener(WindowFocusListener wfl)
public void removeWindowStateListener(WindowStateListener wsl)
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
getListeners
in class Container
listenerType
- the class of listeners to filter (null
not permitted).ClassCastException
- If listenerType doesn't specify a class or
interface that implements java.util.EventListener.Container.getContainerListeners()
protected void processEvent(AWTEvent evt)
WindowEvent
, then
processWindowEvent()
is called to process the event,
otherwise the superclass version of this method is invoked.processEvent
in class Container
evt
- The event to process.Component.processComponentEvent(ComponentEvent)
,
Component.processFocusEvent(FocusEvent)
,
Component.processKeyEvent(KeyEvent)
,
Component.processMouseEvent(MouseEvent)
,
Component.processMouseMotionEvent(MouseEvent)
,
Component.processInputMethodEvent(InputMethodEvent)
,
Component.processHierarchyEvent(HierarchyEvent)
,
Component.processMouseWheelEvent(MouseWheelEvent)
protected void processWindowEvent(WindowEvent evt)
WindowEvents
on this window. This method only gets
invoked if it is enabled via enableEvents()
or if
a listener has been added.evt
- The event to process.public boolean isActive()
public boolean isFocused()
public Component getFocusOwner()
null
if this window is not active
or no children have focus.null
if no
component has focus.public Component getMostRecentFocusOwner()
null
public boolean postEvent(Event e)
postEvent
in interface MenuContainer
postEvent
in class Component
e
- The event to post.public boolean isShowing()
isShowing
in class Component
true
if this window is visible, false
otherwise.Component.setVisible(boolean)
public void setLocationRelativeTo(Component c)
public void createBufferStrategy(int numBuffers)
numBuffers
- the number of buffers in this strategyIllegalArgumentException
- if requested number of buffers
is less than oneIllegalStateException
- if this window is not displayablepublic void createBufferStrategy(int numBuffers, BufferCapabilities caps) throws AWTException
numBuffers
- the number of buffers in this strategycaps
- the requested buffering capabilitiesAWTException
- if the requested capabilities are not
supportedIllegalArgumentException
- if requested number of buffers
is less than one or if caps is nullpublic BufferStrategy getBufferStrategy()
public void applyResourceBundle(ResourceBundle rb)
public void applyResourceBundle(String rbName)
public AccessibleContext getAccessibleContext()
Window
.
The context is created, if necessary.getAccessibleContext
in interface Accessible
getAccessibleContext
in class Component
public GraphicsConfiguration getGraphicsConfiguration()
getGraphicsConfiguration
in class Component
protected void processWindowFocusEvent(WindowEvent event)
protected void processWindowStateEvent(WindowEvent event)
public final boolean isFocusableWindow()
Window
can get the focus or not.public boolean getFocusableWindowState()
public void setFocusableWindowState(boolean focusableWindowState)
public final boolean isFocusCycleRoot()
true
as Windows are the
root of the focus cycle.isFocusCycleRoot
in class Container
true
.public final void setFocusCycleRoot(boolean focusCycleRoot)
setFocusCycleRoot
in class Container
focusCycleRoot
- ignored.public final Container getFocusCycleRootAncestor()
null
.getFocusCycleRootAncestor
in class Component
null
.public final boolean isAlwaysOnTop()
true
if the windows is always-on-top,
false
otherwise.public final void setAlwaysOnTop(boolean alwaysOnTop)