This class represents a top-level window with no decorations.
addWindowListener
public void addWindowListener(WindowListener listener)
Adds the specified listener to the list of WindowListeners
that will receive events for this window.
listener
- The WindowListener
to add.
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.
numBuffers
- the number of buffers in this strategy
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.
numBuffers
- the number of buffers in this strategycaps
- the requested buffering capabilities
dispose
public void dispose()
Destroys any resources associated with this window. This includes
all components in the window and all owned top-level windows.
extends EventListener> T[] getListeners
public extends EventListener> T[] getListeners(Class listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this Window. FooListeners are registered using the addFooListener
method.
- extends EventListener> T[] getListeners in interface Container
ClassCastException
- If listenerType doesn't specify a class or
interface that implements java.util.EventListener.
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.
- The component that has focus, or
null
if no
component has focus.
getFocusableWindowState
public boolean getFocusableWindowState()
Returns the value of the focusableWindowState property.
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.
- the child component of this window that most recently had
the focus, or
null
getWarningString
public final String getWarningString()
Returns the warning string that will be displayed if this window is
popped up by an unsecure applet or application.
- The unsecure window warning message.
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.
- true if active, else false.
isAlwaysOnTop
public final boolean isAlwaysOnTop()
Returns whether the Windows is an always-on-top window,
meaning whether the window can be obscured by other windows or not.
true
if the windows is always-on-top,
false
otherwise.
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.
- isFocusCycleRoot in interface Container
isFocusableWindow
public final boolean isFocusableWindow()
Returns whether this Window
can get the focus or not.
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.
- true if focused, else false.
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.
- isShowing in interface Component
true
if this window is visible, false
otherwise.
pack
public void pack()
Relays out this window's child components at their preferred size.
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.
- processEvent in interface Container
evt
- The event to process.
processWindowEvent
protected void processWindowEvent(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.
evt
- The event to process.
removeWindowListener
public void removeWindowListener(WindowListener listener)
Removes the specified listener from the list of
WindowListeners
that will receive events for this window.
listener
- The WindowListener
to remove.
setAlwaysOnTop
public final void setAlwaysOnTop(boolean alwaysOnTop)
Sets the always-on-top state of this window (if supported).
Setting a window to always-on-top means it will not be obscured
by any other windows (with the exception of other always-on-top
windows). Not all platforms may support this.
If an window's always-on-top status is changed to false, the window
will remain at the front but not be anchored there.
Calling toBack() on an always-on-top window will change its
always-on-top status to false.
setCursor
public void setCursor(Cursor cursor)
Sets the cursor for this window to the specifiec cursor.
- setCursor in interface Component
cursor
- The new cursor for this window.
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.
- setFocusCycleRoot in interface Container
focusCycleRoot
- ignored.
setFocusableWindowState
public void setFocusableWindowState(boolean focusableWindowState)
Sets the value of the focusableWindowState property.
toBack
public void toBack()
Sends this window to the back so that all other windows display in
front of it.
If the window is set to be always-on-top, this will remove its
always-on-top status.
toFront
public void toFront()
Brings this window to the front so that it displays in front of
any other windows.
void show
public @Deprecated void show()
Shows on-screen this window and any of its owned windows for whom
isVisible returns true.
Window.java --
Copyright (C) 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2, or (at your option)
any later version.
GNU Classpath is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version.