This class represents a top-level window with no decorations.
addNotify
public void addNotify()
Creates the native peer for this window.
- addNotify in interface Container
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
IllegalArgumentException
- if requested number of buffers
is less than oneIllegalStateException
- if this window is not displayable
- 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.
numBuffers
- the number of buffers in this strategycaps
- the requested buffering capabilities
AWTException
- if the requested capabilities are not
supportedIllegalArgumentException
- if requested number of buffers
is less than one or if caps is null
- 1.4
dispose
public void dispose()
Destroys any resources associated with this window. This includes
all components in the window and all owned top-level windows.
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.
- 1.4
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.
- getGraphicsConfiguration in interface Component
getListeners
public EventListener[] getListeners(Class listenerType)
Returns an array of all the objects currently registered as FooListeners
upon this Window. FooListeners are registered using the addFooListener
method.
- getListeners in interface Container
ClassCastException
- If listenerType doesn't specify a class or
interface that implements java.util.EventListener.
- 1.3
getLocale
public Locale getLocale()
Returns the locale that this window is configured for.
- getLocale in interface Component
- The locale this window is configured for.
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
- 1.4
getToolkit
public Toolkit getToolkit()
Returns the toolkit used to create this window.
- getToolkit in interface Component
- The toolkit used to create this window.
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.
- 1.4
isFocusableWindow
public final boolean isFocusableWindow()
Returns whether this Window
can get the focus or not.
- 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.
- true if focused, else false.
- 1.4
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.
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.
setFocusableWindowState
public void setFocusableWindowState(boolean focusableWindowState)
Sets the value of the focusableWindowState property.
- 1.4
show
public void show()
Shows on-screen this window and any of its owned windows for whom
isVisible returns true.
- show in interface Component
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.
Window.java --
Copyright (C) 1999, 2000, 2002, 2003, 2004 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.