java.awt

Class Window

Implemented Interfaces:
Accessible, ImageObserver, MenuContainer, Serializable
Known Direct Subclasses:
BasicToolBarUI.DragWindow, Dialog, Frame, JWindow

public class Window
extends Container
implements Accessible

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

A window must have either a frame, dialog, or another window defined as its owner when it's constructed.

In a multi-screen environment, you can create a Window on a different screen device by constructing the Window with Window(Window,GraphicsConfiguration). The GraphicsConfiguration object is one of the GraphicsConfiguration objects of the target screen device.

In a virtual device multi-screen environment in which the desktop area could span multiple physical screen devices, the bounds of all configurations are relative to the virtual device coordinate system. The origin of the virtual-coordinate system is at the upper left-hand corner of the primary physical screen. Depending on the location of the primary screen in the virtual device, negative coordinates are possible, as shown in the following figure.

Diagram shows virtual device containing 4 physical screens. Primary physical screen shows coords (0,0), other screen shows (-80,-100).

setLocationgetLocationOnScreenWindowgetBoundsGraphicsConfiguration

WindowGraphicsConfigurationGraphicsConfigurationWindowGraphicsConfiguration

	Window w = new Window(Window owner, GraphicsConfiguration gc);
	Rectangle bounds = gc.getBounds();
	w.setLocation(10 + bounds.x, 10 + bounds.y);
 

WindowFrameDialogsetLocationsetSizesetBoundsWindowgetBoundsgetLocationgetLocationOnScreengetSize

Since:
JDK1.0
See Also:
WindowEvent, addWindowListener(WindowListener), BorderLayout, Serialized Form

Nested Class Summary

protected class
Window.AccessibleAWTWindow
This class implements accessibility support for the Window class.

Nested classes/interfaces inherited from class java.awt.Container

Container.AccessibleAWTContainer

Nested classes/interfaces inherited from class java.awt.Component

Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy

Field Summary

Fields inherited from class java.awt.Component

BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT

Fields inherited from interface java.awt.image.ImageObserver

ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH

Constructor Summary

Window(Frame owner)
Constructs a new invisible window with the specified Frame as its owner.
Window(Window owner)
Constructs a new invisible window with the specified Window as its owner.
Window(Window owner, GraphicsConfiguration gc)
Constructs a new invisible window with the specified window as its owner and a GraphicsConfiguration of a screen device.

Method Summary

void
addNotify()
Makes this Window displayable by creating the connection to its native screen resource.
void
addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list.
void
addPropertyChangeListener(String propertyName, PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property.
void
addWindowFocusListener(WindowFocusListener l)
Adds the specified window focus listener to receive window events from this window.
void
addWindowListener(WindowListener l)
Adds the specified window listener to receive window events from this window.
void
addWindowStateListener(WindowStateListener l)
Adds the specified window state listener to receive window events from this window.
@Deprecated
boolean postEvent(Event e)
Deprecated. As of JDK version 1.1 replaced by dispatchEvent(AWTEvent).
void
createBufferStrategy(int numBuffers)
Creates a new strategy for multi-buffering on this component.
void
createBufferStrategy(int numBuffers, BufferCapabilities caps)
Creates a new strategy for multi-buffering on this component with the required buffer capabilities.
void
dispose()
Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children.
extends EventListener> T[] getListeners(Class listenerType)
Returns an array of all the objects currently registered as FooListeners upon this Window.
protected void
finalize()
Disposes of the input methods and context, and removes this Window from the GUI hierarchy.
AccessibleContext
getAccessibleContext()
Gets the AccessibleContext associated with this Window.
BufferStrategy
getBufferStrategy()
Container
getFocusCycleRootAncestor()
Always returns null because Windows have no ancestors; they represent the top of the Component hierarchy.
Component
getFocusOwner()
Returns the child Component of this Window that has focus if this Window is focused; returns null otherwise.
Set
getFocusTraversalKeys(int id)
Gets a focus traversal key for this Window.
boolean
getFocusableWindowState()
Returns whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow.
GraphicsConfiguration
getGraphicsConfiguration()
This method returns the GraphicsConfiguration used by this Window.
InputContext
getInputContext()
Gets the input context for this window.
Locale
getLocale()
Gets the Locale object that is associated with this window, if the locale has been set.
Component
getMostRecentFocusOwner()
Returns the child Component of this Window that will receive the focus when this Window is focused.
Window[]
getOwnedWindows()
Return an array containing all the windows this window currently owns.
Window
getOwner()
Returns the owner of this window.
Toolkit
getToolkit()
Returns the toolkit of this frame.
String
getWarningString()
Gets the warning string that is displayed with this window.
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.
boolean
isActive()
Returns whether this Window is active.
boolean
isAlwaysOnTop()
Returns whether this window is an always-on-top window.
boolean
isFocusCycleRoot()
Always returns true because all Windows must be roots of a focus traversal cycle.
boolean
isFocusableWindow()
Returns whether this Window can become the focused Window, that is, whether this Window or any of its subcomponents can become the focus owner.
boolean
isFocused()
Returns whether this Window is focused.
boolean
isLocationByPlatform()
Returns true if this Window will appear at the default location for the native windowing system the next time this Window is made visible.
boolean
isShowing()
Checks if this Window is showing on screen.
void
pack()
Causes this Window to be sized to fit the preferred size and layouts of its subcomponents.
protected void
processEvent(AWTEvent e)
Processes events on this window.
protected void
processWindowEvent(WindowEvent e)
Processes window events occurring on this window by dispatching them to any registered WindowListener objects.
protected void
processWindowFocusEvent(WindowEvent e)
Processes window focus event occuring on this window by dispatching them to any registered WindowFocusListener objects.
protected void
processWindowStateEvent(WindowEvent e)
Processes window state event occuring on this window by dispatching them to any registered WindowStateListener objects.
void
removeWindowFocusListener(WindowFocusListener l)
Removes the specified window focus listener so that it no longer receives window events from this window.
void
removeWindowListener(WindowListener l)
Removes the specified window listener so that it no longer receives window events from this window.
void
removeWindowStateListener(WindowStateListener l)
Removes the specified window state listener so that it no longer receives window events from this window.
void
setAlwaysOnTop(boolean alwaysOnTop)
Changes the always-on-top window state.
void
setBounds(int x, int y, int width, int height)
void
setCursor(Cursor cursor)
Set the cursor image to a specified cursor.
void
setFocusCycleRoot(boolean focusCycleRoot)
Does nothing because Windows must always be roots of a focus traversal cycle.
void
setFocusableWindowState(boolean focusableWindowState)
Sets whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow.
void
setLocationByPlatform(boolean locationByPlatform)
Sets whether this Window should appear at the default location for the native windowing system or at the current location (returned by getLocation) the next time the Window is made visible.
void
setLocationRelativeTo(Component c)
Sets the location of the window relative to the specified component.
void
toBack()
If this Window is visible, sends this Window to the back and may cause it to lose focus or activation if it is the focused or active Window.
void
toFront()
If this Window is visible, brings this Window to the front and may make it the focused Window.
@Deprecated
void applyResourceBundle(String rbName)
Deprecated. As of J2SE 1.4, replaced by Component.applyComponentOrientation.
@Deprecated
void applyResourceBundle(ResourceBundle rb)
Deprecated. As of J2SE 1.4, replaced by Component.applyComponentOrientation.
@Deprecated
void hide()
Deprecated. As of JDK 5, replaced by Component.setVisible(boolean).
@Deprecated
void show()
Deprecated. As of JDK 5, replaced by Component.setVisible(boolean).

Methods inherited from class java.awt.Container

Component locate, Dimension minimumSize, Dimension preferredSize, Insets insets, add, add, add, add, add, addContainerListener, addImpl, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, doLayout, extends EventListener> T[] getListeners, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponentZOrder, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, int countComponents, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, list, list, paint, paintComponents, paramString, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate, validateTree, void deliverEvent, void layout

Methods inherited from class java.awt.Component

Component locate, ComponentPeer getPeer, Dimension minimumSize, Dimension preferredSize, Dimension size, Point location, Rectangle bounds, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, boolean action, boolean gotFocus, boolean handleEvent, boolean inside, boolean isFocusTraversable, boolean keyDown, boolean keyUp, boolean lostFocus, boolean mouseDown, boolean mouseDrag, boolean mouseEnter, boolean mouseExit, boolean mouseMove, boolean mouseUp, boolean postEvent, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, doLayout, enableEvents, enableInputMethods, extends EventListener> T[] getListeners, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAccessibleContext, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPreferredSize, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, hasFocus, imageUpdate, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusCycleRoot, isFocusOwner, isFocusable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, list, list, list, list, list, paint, paintAll, paramString, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFocusable, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, update, validate, void deliverEvent, void disable, void enable, void enable, void hide, void layout, void move, void nextFocus, void reshape, void resize, void resize, void show, void show

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

Window

public Window(Frame owner)
Constructs a new invisible window with the specified Frame as its owner. The Window will not be focusable unless its owner is showing on the screen.

If there is a security manager, this method first calls the security manager's checkTopLevelWindow method with this as its argument to determine whether or not the window must be displayed with a warning banner.

Parameters:
owner - the Frame to act as owner
Throws:
IllegalArgumentException - if the owner's GraphicsConfiguration is not from a screen device
IllegalArgumentException - if owner is null; this exception is always thrown when GraphicsEnvironment.isHeadless returns true
Usages and Demos :

View More Examples of Window(Frame owner)
   1: 
   2:       Window w1 = new Window(f);
   3:       w1.setName ("Window 1");
   4:         ...
   5: 
   6:       Window w2 = new Window(null);
   7:       w2.setName ("Window 2");
   8: 

View Full Code Here
   1:         ImagePane pnlImage=new ImagePane( imgSplash );
   2:         Window splashWindow=new Window(this);
   3:         splashWindow.add(pnlImage,BorderLayout.CENTER);
   4:         Dimension scmSize=Toolkit.getDefaultToolkit().getScreenSize();
   5:         int nImageWidth=imgSplash.getWidth(this);

View Full Code Here
   1:     
   2:     win = new Window(frame);
   3:     image_holder = new JLabel(DISPLAYING_ICON);
   4:     image_holder.setBackground(Color.BLACK);
   5:     image_holder.addMouseListener(new ShowMouseListener());

View Full Code Here
   1:     }
   2:     return new Window(getFrame(component));
   3:     }
   4: 
   5:     public static Frame getFrame(Component component) {

View Full Code Here
   1:           if (USE_FRAME) { win = new Frame(gconfig); }
   2:           else { win = new Window(IGB.getSingletonIGB().getFrame(), gconfig); }
   3:         }
   4:         win.setLocation(win_bounds.x, win_bounds.y);
   5:         win.setSize(win_bounds.width, win_bounds.height);

View Full Code Here

Window

public Window(Window owner)
Constructs a new invisible window with the specified Window as its owner. The Window will not be focusable unless its nearest owning Frame or Dialog is showing on the screen.

If there is a security manager, this method first calls the security manager's checkTopLevelWindow method with this as its argument to determine whether or not the window must be displayed with a warning banner.

Parameters:
owner - the Window to act as owner
Throws:
IllegalArgumentException - if the owner's GraphicsConfiguration is not from a screen device
IllegalArgumentException - if owner is null. This exception is always thrown when GraphicsEnvironment.isHeadless() returns true.
Since:
1.2
Usages and Demos :

View More Examples of Window(Window owner)
   1: 
   2:       Window w1 = new Window(f);
   3:       w1.setName ("Window 1");
   4:         ...
   5: 
   6:       Window w2 = new Window(null);
   7:       w2.setName ("Window 2");
   8: 

View Full Code Here
   1:         ImagePane pnlImage=new ImagePane( imgSplash );
   2:         Window splashWindow=new Window(this);
   3:         splashWindow.add(pnlImage,BorderLayout.CENTER);
   4:         Dimension scmSize=Toolkit.getDefaultToolkit().getScreenSize();
   5:         int nImageWidth=imgSplash.getWidth(this);

View Full Code Here
   1:     
   2:     win = new Window(frame);
   3:     image_holder = new JLabel(DISPLAYING_ICON);
   4:     image_holder.setBackground(Color.BLACK);
   5:     image_holder.addMouseListener(new ShowMouseListener());

View Full Code Here
   1:     }
   2:     return new Window(getFrame(component));
   3:     }
   4: 
   5:     public static Frame getFrame(Component component) {

View Full Code Here
   1:           if (USE_FRAME) { win = new Frame(gconfig); }
   2:           else { win = new Window(IGB.getSingletonIGB().getFrame(), gconfig); }
   3:         }
   4:         win.setLocation(win_bounds.x, win_bounds.y);
   5:         win.setSize(win_bounds.width, win_bounds.height);

View Full Code Here

Window

public Window(Window owner,
              GraphicsConfiguration gc)
Constructs a new invisible window with the specified window as its owner and a GraphicsConfiguration of a screen device. The Window will not be focusable unless its nearest owning Frame or Dialog is showing on the screen.

If there is a security manager, this method first calls the security manager's checkTopLevelWindow method with this as its argument to determine whether or not the window must be displayed with a warning banner.

Parameters:
owner - the window to act as owner
gc - the GraphicsConfiguration of the target screen device; if gc is null, the system default GraphicsConfiguration is assumed
Throws:
IllegalArgumentException - if owner is null
IllegalArgumentException - if gc is not from a screen device; this exception is always thrown when GraphicsEnvironment.isHeadless returns true
Since:
1.3
Usages and Demos :

View More Examples of Window(Window owner,GraphicsConfiguration gc)
   1:             fmsg.setTitle(tl);
   2:             Window wnd = new Window(Window.DIALOG_MODAL,parentForm);
   3:             wnd.setDefaultCloseOperation(Window.HIDE_ON_CLOSE);
   4:         ...
   5:             fmsg.setTitle(tl);
   6:             Window wnd = new Window(Window.DIALOG_MODAL,parentForm);
   7:             wnd.setDefaultCloseOperation(Window.HIDE_ON_CLOSE);
   8:         ...
   9:             fmsg.setTitle(tl);
  10:             Window wnd = new Window(Window.DIALOG_MODAL,parentForm);
  11:             wnd.setDefaultCloseOperation(Window.HIDE_ON_CLOSE);

View Full Code Here
   1:         GraphicsConfiguration leftGc = leftDevice.getDefaultConfiguration();
   2:         leftWindow = new Window(owner, leftGc);
   3:         leftWindow.setBounds(leftGc.getBounds());
   4:         ...
   5:         GraphicsConfiguration rightGc = rightDevice.getDefaultConfiguration();
   6:         rightWindow = new Window(owner, rightGc);
   7:         rightWindow.setBounds(rightGc.getBounds());
   8:         ...
   9:         GraphicsConfiguration gc = leftDevice.getDefaultConfiguration();
  10:         leftWindow = new Window(owner, gc);
  11:         leftWindow.setBounds(gc.getBounds());

View Full Code Here

Method Details

addNotify

public void addNotify()
Makes this Window displayable by creating the connection to its native screen resource. This method is called internally by the toolkit and should not be called directly by programs.
Overrides:
addNotify in interface Container
Since:
JDK1.0
Usages and Demos :

View More Examples of addNotify()
   1: import java.awt.Image;
   2: import java.awt.Window;
   3: import java.awt.geom.AffineTransform;
   4:         ...
   5: 
   6:     if (comp instanceof Window)
   7:     {
   8:         ...
   9:       Window window = (Window) comp;

View Full Code Here
   1:   
   2:   public void setWindowTransparency(Window window, int transparency) {
   3:         ...
   4:     setWindowTransparency0(getHWND(window), transparency);
   5:   }
   6:         ...
   7:     if (window.getPeer() == null) {
   8:       window.addNotify();
   9:     }

View Full Code Here

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list. The listener is registered for all bound properties of this class, including the following:
  • this Window's font ("font")
  • this Window's background color ("background")
  • this Window's foreground color ("foreground")
  • this Window's focusability ("focusable")
  • this Window's focus traversal keys enabled state ("focusTraversalKeysEnabled")
  • this Window's Set of FORWARD_TRAVERSAL_KEYS ("forwardFocusTraversalKeys")
  • this Window's Set of BACKWARD_TRAVERSAL_KEYS ("backwardFocusTraversalKeys")
  • this Window's Set of UP_CYCLE_TRAVERSAL_KEYS ("upCycleFocusTraversalKeys")
  • this Window's Set of DOWN_CYCLE_TRAVERSAL_KEYS ("downCycleFocusTraversalKeys")
  • this Window's focus traversal policy ("focusTraversalPolicy")
  • this Window's focusable Window state ("focusableWindowState")
  • this Window's always-on-top state("alwaysOnTop")
Note that if this Window is inheriting a bound property, then no event will be fired in response to a change in the inherited property.

If listener is null, no exception is thrown and no action is performed.

Overrides:
addPropertyChangeListener in interface Container
Parameters:
listener - the PropertyChangeListener to be added
See Also:
Component.removePropertyChangeListener, addPropertyChangeListener(String,PropertyChangeListener)
Usages and Demos :

View More Examples of addPropertyChangeListener(PropertyChangeListener listener)
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: import java.awt.event.ActionEvent;
   4:         ...
   5:     {
   6:         if (window != null)
   7:         {
   8:         ...
   9:             windowListener = createWindowListener();
  10:             window.addWindowListener(windowListener);
  11:             windowPropertyChangeListener = createWindowPropertyChangeListener();
  12:         ...
  13:             window.addPropertyChangeListener(windowPropertyChangeListener);

View Full Code Here

addPropertyChangeListener

public void addPropertyChangeListener(String propertyName,
                                      PropertyChangeListener listener)
Adds a PropertyChangeListener to the listener list for a specific property. The specified property may be user-defined, or one of the following:
  • this Window's font ("font")
  • this Window's background color ("background")
  • this Window's foreground color ("foreground")
  • this Window's focusability ("focusable")
  • this Window's focus traversal keys enabled state ("focusTraversalKeysEnabled")
  • this Window's Set of FORWARD_TRAVERSAL_KEYS ("forwardFocusTraversalKeys")
  • this Window's Set of BACKWARD_TRAVERSAL_KEYS ("backwardFocusTraversalKeys")
  • this Window's Set of UP_CYCLE_TRAVERSAL_KEYS ("upCycleFocusTraversalKeys")
  • this Window's Set of DOWN_CYCLE_TRAVERSAL_KEYS ("downCycleFocusTraversalKeys")
  • this Window's focus traversal policy ("focusTraversalPolicy")
  • this Window's focusable Window state ("focusableWindowState")
  • this Window's always-on-top state("alwaysOnTop")
Note that if this Window is inheriting a bound property, then no event will be fired in response to a change in the inherited property.

If listener is null, no exception is thrown and no action is performed.

Overrides:
addPropertyChangeListener in interface Container
Parameters:
propertyName - one of the property names listed above
listener - the PropertyChangeListener to be added
See Also:
addPropertyChangeListener(PropertyChangeListener), Component.removePropertyChangeListener

addWindowFocusListener

public void addWindowFocusListener(WindowFocusListener l)
Adds the specified window focus listener to receive window events from this window. If l is null, no exception is thrown and no action is performed.
Parameters:
l - the window focus listener
Usages and Demos :

View More Examples of addWindowFocusListener(WindowFocusListener l)
   1: import java.awt.event.WindowFocusListener;
   2: import java.awt.Window;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:         log.debug("register listener for WindowFocusEvents");
   6:         if(getParent() instanceof Window){
   7:         ...
   8:             Window parent = (Window) getParent();
   9:         ...
  10:             parent.addWindowFocusListener(this);

View Full Code Here

addWindowListener

public void addWindowListener(WindowListener l)
Adds the specified window listener to receive window events from this window. If l is null, no exception is thrown and no action is performed.
Parameters:
l - the window listener
Usages and Demos :

View More Examples of addWindowListener(WindowListener l)
   1: {
   2:   public AutoRequestFocus(Window parent,
   3:               Component child)
   4:         ...
   5:       m_child = child;
   6:       parent.addWindowListener(this);
   7:     }
   8: 
   9:   public void windowOpened(WindowEvent ev)

View Full Code Here
   1: {
   2:     public AWindowListener (Window win, WindowStateListener l)
   3:     {
   4:         ...
   5:         m_listener = l;
   6:         win.addWindowListener(this);
   7: 
   8:     private WindowStateListener m_listener;

View Full Code Here
   1: 
   2:     public static void center( Window window )
   3:     {
   4:         ...
   5:         window.setLocation( getCenterLocation( window.getSize() ));
   6:     }
   7:         ...
   8:             spool.add( listenerR );
   9:             window.addWindowListener( listenerW );
  10:             return SpoolTie.this;

View Full Code Here
   1: import jp.ujihara.java.awt.Rectangle;
   2: import jp.ujihara.java.awt.Window;
   3: import jp.ujihara.java.awt.event.ContainerEvent;
   4:         ...
   5: 
   6:   private transient Window floatFrame;
   7: 
   8:         ...
   9:   {
  10:     floatFrame = (Window) createFloatingWindow(toolBar);
  11: 
  12:         ...
  13:     windowListener = createFrameListener();
  14:     floatFrame.addWindowListener(windowListener);

View Full Code Here
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: import java.awt.event.ActionEvent;
   4:         ...
   5:     {
   6:         if (window != null)
   7:         {
   8:         ...
   9:             windowListener = createWindowListener();
  10:             window.addWindowListener(windowListener);
  11:             windowPropertyChangeListener = createWindowPropertyChangeListener();
  12:         ...
  13:             window.addPropertyChangeListener(windowPropertyChangeListener);

View Full Code Here

addWindowStateListener

public void addWindowStateListener(WindowStateListener l)
Adds the specified window state listener to receive window events from this window. If l is null, no exception is thrown and no action is performed.
Parameters:
l - the window state listener
Since:
1.4
Usages and Demos :

View More Examples of addWindowStateListener(WindowStateListener l)
   1: import java.awt.event.WindowStateListener;
   2: import java.awt.Window;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:         log.debug("register listener for WindowStateEvents");
   6:         if(getParent() instanceof Window){
   7:         ...
   8:             Window parent = (Window) getParent();
   9:         ...
  10:             parent.addWindowStateListener(this);

View Full Code Here

boolean postEvent

public @Deprecated boolean postEvent(Event e)

Deprecated. As of JDK version 1.1 replaced by dispatchEvent(AWTEvent).

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

createBufferStrategy

public void createBufferStrategy(int numBuffers)
Creates a new strategy for multi-buffering on this component. Multi-buffering is useful for rendering performance. This method attempts to create the best strategy available with the number of buffers supplied. It will always create a BufferStrategy with that number of buffers. A page-flipping strategy is attempted first, then a blitting strategy using accelerated buffers. Finally, an unaccelerated blitting strategy is used.

Each time this method is called, the existing buffer strategy for this component is discarded.

Parameters:
numBuffers - number of buffers to create
Throws:
IllegalArgumentException - if numBuffers is less than 1.
IllegalStateException - if the component is not displayable
Since:
1.4
See Also:
Window, getBufferStrategy()
Usages and Demos :

View More Examples of createBufferStrategy(int numBuffers)
   1: 
   2:     private Window leftWindow, rightWindow;
   3: 
   4:         ...
   5:         leftWindow.setLayout(null);
   6:         leftWindow.addFocusListener(new DebugFocusListener("Left window"));
   7:         leftWindow.setIgnoreRepaint(true);
   8:         ...
   9:         rightWindow.setLayout(null);
  10:         rightWindow.addFocusListener(new DebugFocusListener("Right window"));
  11:         rightWindow.setIgnoreRepaint(true);
  12:         ...
  13:     if (displayDeviceType == EMBEDDED) {
  14:         embeddedCanvas.createBufferStrategy(2);

View Full Code Here

createBufferStrategy

public void createBufferStrategy(int numBuffers,
                                 BufferCapabilities caps)
            throws AWTException
Creates a new strategy for multi-buffering on this component with the required buffer capabilities. This is useful, for example, if only accelerated memory or page flipping is desired (as specified by the buffer capabilities).

Each time this method is called, the existing buffer strategy for this component is discarded.

Parameters:
numBuffers - number of buffers to create, including the front buffer
caps - the required capabilities for creating the buffer strategy; cannot be null
Throws:
AWTException - if the capabilities supplied could not be supported or met; this may happen, for example, if there is not enough accelerated memory currently available, or if page flipping is specified but not possible.
IllegalArgumentException - if numBuffers is less than 1, or if caps is null
Since:
1.4

dispose

public void dispose()
Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. That is, the resources for these Components will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable.

The Window and its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call to pack or show. The states of the recreated Window and its subcomponents will be identical to the states of these objects at the point where the Window was disposed (not accounting for additional modifications between those actions).

Note: When the last displayable window within the Java virtual machine (VM) is disposed of, the VM may terminate. See AWT Threading Issues for more information.

Usages and Demos :

View More Examples of dispose()
   1: import java.awt.event.*;
   2: import java.awt.Window;
   3: 
   4:         ...
   5:   public void windowClosing(WindowEvent e) {
   6:     Window w = e.getWindow();
   7:     w.setVisible(false);
   8:         ...
   9:     w.dispose();
  10:     System.exit(0);

View Full Code Here
   1:   {
   2:     Window window = (Window) e.getSource();
   3:         ...
   4:     window.dispose();
   5:   }
   6: }

View Full Code Here
   1:     public void windowClosing(WindowEvent e){
   2:         Window w = e.getWindow();
   3:         w.setVisible(false);
   4:         ...
   5:         w.dispose();
   6:         if(exitOnClose()){
   7:             System.exit(0);
   8:         }

View Full Code Here
   1:             {
   2:                 Window window = windowevent.getWindow();
   3:         ...
   4:                 window.dispose();
   5:                 System.exit(0);
   6:             }
   7:     });

View Full Code Here
   1:     public void windowClosing(WindowEvent e){
   2:         Window w = e.getWindow();
   3:         w.setVisible(false);
   4:         ...
   5:         w.dispose();
   6:         if(exitOnClose()){
   7:             System.exit(0);
   8:         }

View Full Code Here

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.

You can specify the listenerType argument with a class literal, such as FooListener.class. For example, you can query a Window w for its window listeners with the following code:

WindowListener[] wls = (WindowListener[])(w.getListeners(WindowListener.class));
If no such listeners exist, this method returns an empty array.
Overrides:
extends EventListener> T[] getListeners in interface Container
Parameters:
listenerType - the type of listeners requested; this parameter should specify an interface that descends from java.util.EventListener
Returns:
an array of all objects registered as FooListeners on this window, or an empty array if no such listeners have been added
Throws:
ClassCastException - if listenerType doesn't specify a class or interface that implements java.util.EventListener
Since:
1.3

finalize

protected void finalize()
            throws Throwable
Disposes of the input methods and context, and removes this Window from the GUI hierarchy. Subclasses that override this method should call super.finalize().
Overrides:
finalize in interface Object

getAccessibleContext

public AccessibleContext getAccessibleContext()
Gets the AccessibleContext associated with this Window. For windows, the AccessibleContext takes the form of an AccessibleAWTWindow. A new AccessibleAWTWindow instance is created if necessary.
Specified by:
getAccessibleContext in interface Accessible
Overrides:
getAccessibleContext in interface Component
Returns:
an AccessibleAWTWindow that serves as the AccessibleContext of this Window

getBufferStrategy

public BufferStrategy getBufferStrategy()
Returns:
the buffer strategy used by this component
Since:
1.4
See Also:
createBufferStrategy
Usages and Demos :

View More Examples of getBufferStrategy()
   1:     public Graphics2D getGraphics() {
   2:         Window window = device.getFullScreenWindow();
   3:         ...
   4:         if (window != null) {
   5:         ...
   6:             BufferStrategy strategy = window.getBufferStrategy();
   7:             return (Graphics2D)strategy.getDrawGraphics();
   8:         ...
   9:         if (window != null) {
  10:             BufferStrategy strategy = window.getBufferStrategy();

View Full Code Here
   1:     public Graphics2D getGraphics() {
   2:         Window window = device.getFullScreenWindow();
   3:         ...
   4:         if (window != null) {
   5:         ...
   6:             BufferStrategy strategy = window.getBufferStrategy();
   7:             return (Graphics2D)strategy.getDrawGraphics();
   8:         ...
   9:         if (window != null) {
  10:             BufferStrategy strategy = window.getBufferStrategy();

View Full Code Here
   1: 
   2:     private Window leftWindow, rightWindow;
   3: 
   4:         ...
   5:         leftWindow.setLayout(null);
   6:         leftWindow.addFocusListener(new DebugFocusListener("Left window"));
   7:         leftWindow.setIgnoreRepaint(true);
   8:         ...
   9:         rightWindow.setLayout(null);
  10:         rightWindow.addFocusListener(new DebugFocusListener("Right window"));
  11:         rightWindow.setIgnoreRepaint(true);
  12:         ...
  13:         embeddedCanvas.createBufferStrategy(2);
  14:         leftBufferStrategy = embeddedCanvas.getBufferStrategy();

View Full Code Here

getFocusCycleRootAncestor

public final Container getFocusCycleRootAncestor()
Always returns null because Windows have no ancestors; they represent the top of the Component hierarchy.
Overrides:
getFocusCycleRootAncestor in interface Component
Returns:
null
Since:
1.4

getFocusOwner

public Component getFocusOwner()
Returns the child Component of this Window that has focus if this Window is focused; returns null otherwise.
Returns:
the child Component with focus, or null if this Window is not focused

getFocusTraversalKeys

public Set getFocusTraversalKeys(int id)
Gets a focus traversal key for this Window. (See setFocusTraversalKeys for a full description of each key.)

If the traversal key has not been explicitly set for this Window, then this Window's parent's traversal key is returned. If the traversal key has not been explicitly set for any of this Window's ancestors, then the current KeyboardFocusManager's default traversal key is returned.

Overrides:
getFocusTraversalKeys in interface Container
Parameters:
id - one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS
Returns:
the AWTKeyStroke for the specified key
Throws:
IllegalArgumentException - if id is not one of KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, KeyboardFocusManager.UP_CYCLE_TRAVERSAL_KEYS, or KeyboardFocusManager.DOWN_CYCLE_TRAVERSAL_KEYS
Since:
1.4

getFocusableWindowState

public boolean getFocusableWindowState()
Returns whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow. If this method returns false, then isFocusableWindow will return false as well. If this method returns true, then isFocusableWindow may return true or false depending upon the other requirements which must be met in order for a Window to be focusable.

By default, all Windows have a focusable Window state of true.

Returns:
whether this Window can be the focused Window
Since:
1.4

getGraphicsConfiguration

public GraphicsConfiguration getGraphicsConfiguration()
This method returns the GraphicsConfiguration used by this Window.
Overrides:
getGraphicsConfiguration in interface Component
Usages and Demos :

View More Examples of getGraphicsConfiguration()
   1:     public Graphics2D getGraphics() {
   2:         Window window = device.getFullScreenWindow();
   3:         ...
   4:         if (window != null) {
   5:             BufferStrategy strategy = window.getBufferStrategy();
   6:         ...
   7:             GraphicsConfiguration gc =
   8:                 window.getGraphicsConfiguration();
   9:             return gc.createCompatibleImage(w, h, transparancy);

View Full Code Here
   1:     public Graphics2D getGraphics() {
   2:         Window window = device.getFullScreenWindow();
   3:         ...
   4:         if (window != null) {
   5:             BufferStrategy strategy = window.getBufferStrategy();
   6:         ...
   7:             GraphicsConfiguration gc =
   8:                 window.getGraphicsConfiguration();
   9:             return gc.createCompatibleImage(w, h, transparancy);

View Full Code Here
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: import java.awt.event.KeyEvent;
   4:         ...
   5:         if (focusOwner != null) {
   6:             Window w = SwingUtilities.getWindowAncestor(focusOwner);
   7:             if (w != null) {
   8:         ...
   9:                 return w.getGraphicsConfiguration();
  10:             }

View Full Code Here

getInputContext

public 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 interface Component
Since:
1.2

getLocale

public 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.
Overrides:
getLocale in interface Component
Returns:
the locale that is set for this window.
Since:
JDK1.1
See Also:
Locale

getMostRecentFocusOwner

public Component getMostRecentFocusOwner()
Returns the child Component of this Window that will receive the focus when this Window is focused. If this Window is currently focused, this method returns the same Component as getFocusOwner(). If this Window is not focused, then the child Component that most recently requested focus will be returned. If no child Component has ever requested focus, and this is a focusable Window, then this Window's initial focusable Component is returned. If no child Component has ever requested focus, and this is a non-focusable Window, null is returned.
Returns:
the child Component that will receive focus when this Window is focused
Since:
1.4

getOwnedWindows

public Window[] getOwnedWindows()
Return an array containing all the windows this window currently owns.
Since:
1.2
Usages and Demos :

View More Examples of getOwnedWindows()
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: import java.util.Arrays;
   4:         ...
   5:         {
   6:             Window window = (Window) windowsIterator.next();
   7:             Point location = window.getLocation();
   8:         ...
   9:         Vector allChildren = new Vector();
  10:         Window[] windowChildren = owner.getOwnedWindows();
  11:         allChildren.addAll(Arrays.asList(windowChildren));
  12:         ...
  13:         }
  14:         Window[] children = window.getOwnedWindows();

View Full Code Here
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: 
   4:         ...
   5:     public void afterInstall(ViewSupport viewSupport, View view, ViewOptions viewOptions) {
   6:         Window window = SwingUtilities.getWindowAncestor((Component) view);
   7:         window.setVisible(true);
   8:         ...
   9: 
  10:         Window[] children = window.getOwnedWindows();

View Full Code Here
   1: import java.awt.Insets;
   2: import java.awt.Window;
   3: import java.awt.event.ActionEvent;
   4:         ...
   5: 
   6:     private static void updateLookAndFeelOfChildWindows(Window[] windows) {
   7:         for (int i = 0; i < windows.length; i++) {
   8:         ...
   9: 
  10:     private static void updateLookAndFeelOfChildWindows(Window window) {
  11:         Assert.assertNotNull(window);
  12:         ...
  13: 
  14:         updateLookAndFeelOfChildWindows(window.getOwnedWindows());

View Full Code Here
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: import java.awt.event.WindowAdapter;
   4:         ...
   5: 
   6:                 assert (w instanceof Window) : "not Window: " + w.getClass();
   7: 
   8:         ...
   9: 
  10:         Window[] children = window.getOwnedWindows();

View Full Code Here

getOwner

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

getToolkit

public Toolkit getToolkit()
Returns the toolkit of this frame.
Overrides:
getToolkit in interface Component
Returns:
the toolkit of this window.
Usages and Demos :

View More Examples of getToolkit()
   1: import java.awt.Point;
   2: import java.awt.Window;
   3: 
   4:         ...
   5: 
   6:   public static void requestFocus(final Window win, final Component comp)
   7:   {
   8:         ...
   9: 
  10:   public static void saveGeometry(Window win, String name)
  11:   {
  12:         ...
  13:     } catch (NumberFormatException nf) {
  14:       Dimension screen = win.getToolkit().getScreenSize();

View Full Code Here
   1: 
   2:     public static void setWindowLocationRelativeTo( Window window,
   3:         ...
   4:         Window relativeWindow )
   5:     {
   6:         ...
   7:         int dy = rwLoc.y + (( rwSize.height - windowBounds.height ) >> 1 );
   8:         Dimension ss = window.getToolkit().getScreenSize();

View Full Code Here
   1:     protected Object getOnBody(String key) {
   2:         Window win = (Window)body;
   3:         
   4:         ...
   5:     protected void setOnBody(String key, Object value) {
   6:         Window win = (Window)body;
   7:         
   8:         ...
   9:         
  10:         win.getToolkit().sync();
  11:     }
  12:         ...
  13:     private Dimension getScreenSize(Window win) {
  14:         Dimension d = win.getToolkit().getScreenSize();

View Full Code Here

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.

getWindowFocusListeners

public WindowFocusListener[] getWindowFocusListeners()
Returns an array of all the window focus listeners registered on this window.
Returns:
all of this window's WindowFocusListeners or an empty array if no window focus listeners are currently registered
Since:
1.4

getWindowListeners

public WindowListener[] getWindowListeners()
Returns an array of all the window listeners registered on this window.
Returns:
all of this window's WindowListeners or an empty array if no window listeners are currently registered
Since:
1.4
Usages and Demos :

View More Examples of getWindowListeners()
   1: 
   2:   private void removeWindowListeners(Window frame){
   3:         ...
   4:      WindowListener[] wl = frame.getWindowListeners();
   5:         mainFrame.removeWindowListener(wl[i]);
   6: }

View Full Code Here

getWindowStateListeners

public WindowStateListener[] getWindowStateListeners()
Returns an array of all the window state listeners registered on this window.
Returns:
all of this window's WindowStateListeners or an empty array if no window state listeners are currently registered
Since:
1.4

isActive

public boolean isActive()
Returns whether this Window is active. Only a Frame or a Dialog may be active. The native windowing system may denote the active Window or its children with special decorations, such as a highlighted title bar. The active Window is always either the focused Window, or the first Frame or Dialog that is an owner of the focused Window.
Returns:
whether this is the active Window.
Since:
1.4
See Also:
isFocused()
Usages and Demos :

View More Examples of isActive()
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: import java.awt.event.ActionEvent;
   4:         ...
   5:     {
   6:         if (window != null)
   7:         {
   8:         ...
   9:             windowListener = createWindowListener();
  10:             window.addWindowListener(windowListener);
  11:             windowPropertyChangeListener = createWindowPropertyChangeListener();
  12:         ...
  13:             }
  14:             setActive(window.isActive());

View Full Code Here

isAlwaysOnTop

public final boolean isAlwaysOnTop()
Returns whether this window is an always-on-top window.
Returns:
true, if the window is in always-on-top state, false otherwise
Since:
1.5

isFocusCycleRoot

public final boolean isFocusCycleRoot()
Always returns true because all Windows must be roots of a focus traversal cycle.
Overrides:
isFocusCycleRoot in interface Container
Returns:
true
Since:
1.4

isFocusableWindow

public final boolean isFocusableWindow()
Returns whether this Window can become the focused Window, that is, whether this Window or any of its subcomponents can become the focus owner. For a Frame or Dialog to be focusable, its focusable Window state must be set to true. For a Window which is not a Frame or Dialog to be focusable, its focusable Window state must be set to true, its nearest owning Frame or Dialog must be showing on the screen, and it must contain at least one Component in its focus traversal cycle. If any of these conditions is not met, then neither this Window nor any of its subcomponents can become the focus owner.
Returns:
true if this Window can be the focused Window; false otherwise
Since:
1.4

isFocused

public boolean isFocused()
Returns whether this Window is focused. If there exists a focus owner, the focused Window is the Window that is, or contains, that focus owner. If there is no focus owner, then no Window is focused.

If the focused Window is a Frame or a Dialog it is also the active Window. Otherwise, the active Window is the first Frame or Dialog that is an owner of the focused Window.

Returns:
whether this is the focused Window.
Since:
1.4
See Also:
isActive()

isLocationByPlatform

public boolean isLocationByPlatform()
Returns true if this Window will appear at the default location for the native windowing system the next time this Window is made visible. This method always returns false if the Window is showing on the screen.
Returns:
whether this Window will appear at the default location
Since:
1.5

isShowing

public boolean isShowing()
Checks if this Window is showing on screen.
Overrides:
isShowing in interface Component
Usages and Demos :

View More Examples of isShowing()
   1: 
   2: package de.jose.window;
   3: 
   4:         ...
   5: 
   6:     protected Window frame;
   7: 
   8:         ...
   9: 
  10:     public boolean isShowing()                      { return frame.isShowing(); }
  11: 
  12:         ...
  13:     {
  14:         if (owner==null || !owner.isShowing() ) owner = JoFrame.getActiveFrame();

View Full Code Here

pack

public void pack()
Causes this Window to be sized to fit the preferred size and layouts of its subcomponents. If the window and/or its owner are not yet displayable, both are made displayable before calculating the preferred size. The Window will be validated after the preferredSize is calculated.
Usages and Demos :

View More Examples of pack()
   1: import java.awt.GridBagLayout;
   2: import java.awt.Window;
   3: import java.awt.event.ActionEvent;
   4:         ...
   5: 
   6:         Window parent = FormUtils.getWindowForComponent(this);
   7:         ...
   8:         parent.pack();
   9:     }

View Full Code Here
   1: import java.awt.GridBagLayout;
   2: import java.awt.Window;
   3: import java.awt.event.ActionEvent;
   4:         ...
   5: 
   6:         Window parent = FormUtils.getWindowForComponent(this);
   7:         ...
   8:         parent.pack();
   9:     }

View Full Code Here
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: import javax.swing.JDialog;
   4:         ...
   5: 
   6:     public static Dimension packFixed(final Window window) {
   7:         ...
   8:         window.pack();
   9:         if (window instanceof JDialog)
  10:         ...
  11:         window.setMinimumSize(size);
  12:         window.pack();

View Full Code Here
   1: public class SimpleInputMethod implements InputMethod {
   2:   private static Window statusWindow;
   3:   private InputMethodContext inputMethodContext;
   4:         ...
   5:       statusWindow.add(label);
   6:       statusWindow.pack();
   7: 
   8:       Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
   9:       statusWindow.setLocation(d.width - statusWindow.getWidth(),

View Full Code Here
   1: 
   2: import java.awt.Window;
   3: import java.awt.event.ActionEvent;
   4:         ...
   5:     private int finalDelay;
   6:     private Window application;
   7: 
   8:         ...
   9: 
  10:     public Window getApplication ()
  11:     {
  12:         ...
  13:         application = createApplication(args);
  14:         application.pack();

View Full Code Here

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.

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Overrides:
processEvent in interface Container
Parameters:
e - the event

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 WindowListener object is registered via addWindowListener
  • Window events are enabled via enableEvents

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters:
e - the window event

processWindowFocusEvent

protected void processWindowFocusEvent(WindowEvent e)
Processes window focus event occuring on this window by dispatching them to any registered WindowFocusListener objects. NOTE: this method will not be called unless window focus events are enabled for this window. This happens when one of the following occurs:
  • a WindowFocusListener is registered via addWindowFocusListener
  • Window focus events are enabled via enableEvents

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters:
e - the window focus event

processWindowStateEvent

protected void processWindowStateEvent(WindowEvent e)
Processes window state event occuring on this window by dispatching them to any registered WindowStateListener objects. NOTE: this method will not be called unless window state events are enabled for this window. This happens when one of the following occurs:
  • a WindowStateListener is registered via addWindowStateListener
  • window state events are enabled via enableEvents

Note that if the event parameter is null the behavior is unspecified and may result in an exception.

Parameters:
e - the window state event
Since:
1.4

removeWindowFocusListener

public void removeWindowFocusListener(WindowFocusListener l)
Removes the specified window focus listener so that it no longer receives window events from this window. If l is null, no exception is thrown and no action is performed.
Parameters:
l - the window focus listener

removeWindowListener

public void removeWindowListener(WindowListener l)
Removes the specified window listener so that it no longer receives window events from this window. If l is null, no exception is thrown and no action is performed.
Parameters:
l - the window listener
Usages and Demos :

View More Examples of removeWindowListener(WindowListener l)
   1: 
   2:     public static void center( Window window )
   3:     {
   4:         ...
   5:         window.setLocation( getCenterLocation( window.getSize() ));
   6:     }
   7:         ...
   8:             spool.remove( listenerR );
   9:             window.removeWindowListener( listenerW );
  10:         }

View Full Code Here
   1: import java.awt.Point;
   2: import java.awt.Window;
   3: 
   4:         ...
   5: 
   6:   public static void requestFocus(final Window win, final Component comp)
   7:   {
   8:         ...
   9:         comp.requestFocus();
  10:         win.removeWindowListener(this);
  11:       }
  12:         ...
  13: 
  14:   public static void saveGeometry(Window win, String name)

View Full Code Here
   1: import java.awt.Point;
   2: import java.awt.Window;
   3: import java.awt.event.ActionEvent;
   4:         ...
   5:             return;
   6:         Window oldWindow = unregisterView();
   7:         this.richView = view;
   8:         ...
   9:         Window newWindow = registerView();
  10:         setEnabled(view != null);
  11:         ...
  12:             if (oldWindow != null)
  13:                 oldWindow.removeWindowListener(windowListener);

View Full Code Here
   1: import jp.ujihara.java.awt.Rectangle;
   2: import jp.ujihara.java.awt.Window;
   3: import jp.ujihara.java.awt.event.ContainerEvent;
   4:         ...
   5: 
   6:   private transient Window floatFrame;
   7: 
   8:         ...
   9:   {
  10:     floatFrame = (Window) createFloatingWindow(toolBar);
  11: 
  12:         ...
  13: 
  14:     floatFrame.removeWindowListener(windowListener);

View Full Code Here
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: import java.awt.event.ActionEvent;
   4:         ...
   5:     {
   6:         if (window != null)
   7:         {
   8:         ...
   9:             windowListener = createWindowListener();
  10:             window.addWindowListener(windowListener);
  11:             windowPropertyChangeListener = createWindowPropertyChangeListener();
  12:         ...
  13:         {
  14:             window.removeWindowListener(windowListener);

View Full Code Here

removeWindowStateListener

public void removeWindowStateListener(WindowStateListener l)
Removes the specified window state listener so that it no longer receives window events from this window. If l is null, no exception is thrown and no action is performed.
Parameters:
l - the window state listener
Since:
1.4

setAlwaysOnTop

public final void setAlwaysOnTop(boolean alwaysOnTop)
            throws SecurityException
Changes the always-on-top window state. An always-on-top window is a window that stays above all other windows except maybe other always-on-top windows. If there are several always-on-top windows the order in which they stay relative to each other is not specified and is platform dependent.

If some other window already is always-on-top then the relative order between these windows is unspecified (depends on platform). No window can be brought to be over always-on-top window except maybe another always-on-top window.

All owned windows of an always-on-top window automatically become always-on-top windows. If a window ceases to be always-on-top its owned windows cease to be always-on-top.

When an always-on-top window is sent toBack its always-on-top state is set to false.

This method makes the window always-on-top if alwaysOnTop is true. If the window is visible, this includes bringing window toFront, then "sticking" it to the top-most position. If the window is not visible it does nothing other than setting the always-on-top property. If later the window is shown, it will be always-on-top. If the Window is already always-on-top, this call does nothing.

If alwaysOnTop is false this method changes the state from always-on-top to normal. The window remains top-most but its z-order can be changed in the normal way as for any other window. Does nothing if this Window is not always-on-top. Has no effect on relative z-order of windows if there are no other always-on-top windows.

Note: some platforms might not support always-on-top windows. There is no public API to detect if the platform supports always-on-top at runtime.

If a SecurityManager is installed, the calling thread must be granted the AWTPermission "setWindowAlwaysOnTop" in order to set the value of this property. If this permission is not granted, this method will throw a SecurityException, and the current value of the property will be left unchanged.

Parameters:
alwaysOnTop - new value of always-on-top state of the window
Throws:
SecurityException - if the calling thread does not have permission to set the value of always-on-top property
Since:
1.5

setBounds

public void setBounds(int x,
                      int y,
                      int width,
                      int height)
Overrides:
setBounds in interface Component
Since:
1.5
Usages and Demos :

View More Examples of setBounds(int x,int y,int width,int height)
   1: package org.jitterbit.ui.widget.window;
   2: 
   3:         ...
   4: import java.awt.Rectangle;
   5: import java.awt.Window;
   6: 
   7:         ...
   8: 
   9:     private final Window    m_window;
  10:     private final Cursor    m_cursor;
  11:         ...
  12:     protected final void setBounds(int x, int y, int w, int h) {
  13:         m_window.setBounds(x, y, w, h);

View Full Code Here
   1: import java.awt.GraphicsDevice;
   2: import java.awt.Window;
   3: 
   4:         ...
   5:   private ImageIcon DISPLAYING_ICON = null;
   6:   private Window win = null;
   7:   private JFrame frame = null;
   8:         ...
   9:     
  10:     win = new Window(frame);
  11:     image_holder = new JLabel(DISPLAYING_ICON);
  12:         ...
  13:       Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
  14:       win.setBounds(0,0,dim.width, dim.height);

View Full Code Here
   1: 
   2:   private transient Window ghostWindow = null;
   3:   public final static String SHADE_BOUNDS_PROPERTY = "windowshadeBounds";
   4:         ...
   5:     boolean didResize = (dim.width != newWidth || dim.height != newHeight);
   6:     f.setBounds(newX, newY, newWidth, newHeight);
   7:     if (didResize) {
   8:         ...
   9:     if (dragMode == FASTER_DRAG_MODE) {
  10:       ghostWindow.setBounds(newX, newY, newWidth, newHeight);
  11:     }
  12:         ...
  13:   private void setupDragMode(SkinWindow f) {
  14:     String mode = (String) f.getClientProperty("Window.dragMode");

View Full Code Here
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: import java.awt.font.FontRenderContext;
   4:         ...
   5: 
   6:     public static void centerFrameOnScreen(final Window frame) {
   7:         positionFrameOnScreen(frame, 0.5, 0.5);
   8:         ...
   9: 
  10:     public static void positionFrameOnScreen(final Window frame,
  11:                                              final double horizontalPercent,
  12:         ...
  13:         final int y = (int) (verticalPercent * h);
  14:         frame.setBounds(x, y, f.width, f.height);

View Full Code Here
   1: 
   2: package de.jose.window;
   3: 
   4:         ...
   5: 
   6:     protected Window frame;
   7: 
   8:         ...
   9: 
  10:         frame.setBounds(x,y,width,height);
  11:     }

View Full Code Here

setCursor

public void setCursor(Cursor cursor)
Set the cursor image to a specified cursor.
Overrides:
setCursor in interface Component
Parameters:
cursor - One of the constants defined by the Cursor class. If this parameter is null then the cursor for this window will be set to the type Cursor.DEFAULT_CURSOR.
Since:
JDK1.1
Usages and Demos :

View More Examples of setCursor(Cursor cursor)
   1: package org.jitterbit.ui.widget.window;
   2: 
   3:         ...
   4: import java.awt.Rectangle;
   5: import java.awt.Window;
   6: 
   7:         ...
   8: 
   9:     private final Window    m_window;
  10:     private final Cursor    m_cursor;
  11:         ...
  12:     public final void updateCursor() {
  13:         m_window.setCursor(m_cursor);

View Full Code Here
   1: import java.awt.LayoutManager;
   2: import java.awt.Window;
   3: import java.beans.PropertyChangeEvent;
   4:         ...
   5: {
   6:     Window window;
   7:     private MouseInputListener mouseInputListener;
   8:         ...
   9:         {
  10:             window.setCursor(Cursor.getDefaultCursor());
  11:         }

View Full Code Here
   1: import java.awt.Toolkit;
   2: import java.awt.Window;
   3: import java.awt.event.MouseEvent;
   4:         ...
   5: 
   6:     public Window getWindow ()
   7:     {
   8:         ...
   9:         return ((ConcertRootPaneUI) getRootPane().getUI()).window;
  10:     }
  11:         ...
  12:         {
  13:             w.setCursor(Cursor.getPredefinedCursor(cursor));

View Full Code Here
   1:   private Skin skin = SkinLookAndFeel.getSkin();
   2:   private Window.FrameWindow title = null;
   3: 
   4:         ...
   5: 
   6:   private java.awt.Window window;
   7:  
   8:         ...
   9:     if (window != null) {
  10:       window.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
  11:     }
  12:         ...
  13:         && !getFrameWindow().isMaximum()) {
  14:             w.setCursor(Cursor.getPredefinedCursor(cursor));

View Full Code Here
   1: 
   2:     private Window leftWindow, rightWindow;
   3: 
   4:         ...
   5:         leftWindow.setLayout(null);
   6:         leftWindow.addFocusListener(new DebugFocusListener("Left window"));
   7:         leftWindow.setIgnoreRepaint(true);
   8:         ...
   9:         rightWindow.setLayout(null);
  10:         rightWindow.addFocusListener(new DebugFocusListener("Right window"));
  11:         rightWindow.setIgnoreRepaint(true);
  12:         ...
  13:         if (leftWindow != null) {
  14:         leftWindow.setCursor(hiddenCursor? invisibleCursor: Cursor.getDefaultCursor());

View Full Code Here

setFocusCycleRoot

public final void setFocusCycleRoot(boolean focusCycleRoot)
Does nothing because Windows must always be roots of a focus traversal cycle. The passed-in value is ignored.
Overrides:
setFocusCycleRoot in interface Container
Parameters:
focusCycleRoot - this value is ignored
Since:
1.4

setFocusableWindowState

public void setFocusableWindowState(boolean focusableWindowState)
Sets whether this Window can become the focused Window if it meets the other requirements outlined in isFocusableWindow. If this Window's focusable Window state is set to false, then isFocusableWindow will return false. If this Window's focusable Window state is set to true, then isFocusableWindow may return true or false depending upon the other requirements which must be met in order for a Window to be focusable.

Setting a Window's focusability state to false is the standard mechanism for an application to identify to the AWT a Window which will be used as a floating palette or toolbar, and thus should be a non-focusable Window. Setting the focusability state on a visible Window can have a delayed effect on some platforms — the actual change may happen only when the Window becomes hidden and then visible again. To ensure consistent behavior across platforms, set the Window's focusable state when the WIndow is invisible and then show it.

Parameters:
focusableWindowState - whether this Window can be the focused Window
Since:
1.4

setLocationByPlatform

public void setLocationByPlatform(boolean locationByPlatform)
Sets whether this Window should appear at the default location for the native windowing system or at the current location (returned by getLocation) the next time the Window is made visible. This behavior resembles a native window shown without programmatically setting its location. Most windowing systems cascade windows if their locations are not explicitly set. The actual location is determined once the window is shown on the screen.

This behavior can also be enabled by setting the System Property "java.awt.Window.locationByPlatform" to "true", though calls to this method take precedence.

Calls to setVisible, setLocation and setBounds after calling setLocationByPlatform clear this property of the Window.

For example, after the following code is executed:

setLocationByPlatform(true); setVisible(true); boolean flag = isLocationByPlatform();
The window will be shown at platform's default location and flag will be false.

In the following sample:

setLocationByPlatform(true); setLocation(10, 10); boolean flag = isLocationByPlatform(); setVisible(true);
The window will be shown at (10, 10) and flag will be false.
Parameters:
locationByPlatform - true if this Window should appear at the default location, false if at the current location
Since:
1.5

setLocationRelativeTo

public void setLocationRelativeTo(Component c)
Sets the location of the window relative to the specified component. If the component is not currently showing, or c is null, the window is centered on the screen. If the bottom of the component is offscreen, the window is placed to the side of the Component that is closest to the center of the screen. So if the Component is on the right part of the screen, the Window is placed to its left, and visa versa.
Parameters:
c - the component in relation to which the window's location is determined
Since:
1.4
Usages and Demos :

View More Examples of setLocationRelativeTo(Component c)
   1: import java.awt.Container;
   2: import java.awt.Window;
   3: import java.awt.event.ComponentAdapter;
   4:         ...
   5: 
   6:     private String sessionFilename(Window window) {
   7:     if (window == null) {
   8:         return null; 
   9:     }

View Full Code Here
   1: import java.awt.GridLayout;
   2: import java.awt.Window;
   3: import java.awt.Dimension;
   4:         ...
   5:     BeanChoicePanel bcp;
   6:     private Window propertyLinkDialog, capabilityDialog;
   7:     private Properties settings = new Properties();
   8:         ...
   9:     }
  10:     propertyLinkDialog.setLocationRelativeTo(this);
  11:     propertyLinkDialog.show();
  12:         ...
  13:     SettingsDialog sd = new SettingsDialog();
  14:     sd.setLocationRelativeTo(this);

View Full Code Here

toBack

public void toBack()
If this Window is visible, sends this Window to the back and may cause it to lose focus or activation if it is the focused or active Window.

Places this Window at the bottom of the stacking order and shows it behind any other Windows in this VM. No action will take place is this Window is not visible. Some platforms do not allow Windows which are owned by other Windows to appear below their owners. Every attempt will be made to move this Window as low as possible in the stacking order; however, developers should not assume that this method will move this Window below all other windows in every situation.

Because of variations in native windowing systems, no guarantees about changes to the focused and active Windows can be made. Developers must never assume that this Window is no longer the focused or active Window until this Window receives a WINDOW_LOST_FOCUS or WINDOW_DEACTIVATED event. On platforms where the top-most window is the focused window, this method will probably cause this Window to lose focus. In that case, the next highest, focusable Window in this VM will receive focus. On platforms where the stacking order does not typically affect the focused window, this method will probably leave the focused and active Windows unchanged.

See Also:
toFront()

toFront

public void toFront()
If this Window is visible, brings this Window to the front and may make it the focused Window.

Places this Window at the top of the stacking order and shows it in front of any other Windows in this VM. No action will take place if this Window is not visible. Some platforms do not allow Windows which own other Windows to appear on top of those owned Windows. Some platforms may not permit this VM to place its Windows above windows of native applications, or Windows of other VMs. This permission may depend on whether a Window in this VM is already focused. Every attempt will be made to move this Window as high as possible in the stacking order; however, developers should not assume that this method will move this Window above all other windows in every situation.

Because of variations in native windowing systems, no guarantees about changes to the focused and active Windows can be made. Developers must never assume that this Window is the focused or active Window until this Window receives a WINDOW_GAINED_FOCUS or WINDOW_ACTIVATED event. On platforms where the top-most window is the focused window, this method will probably focus this Window, if it is not already focused. On platforms where the stacking order does not typically affect the focused window, this method will probably leave the focused and active Windows unchanged.

If this method causes this Window to be focused, and this Window is a Frame or a Dialog, it will also become activated. If this Window is focused, but it is not a Frame or a Dialog, then the first Frame or Dialog that is an owner of this Window will be activated.

See Also:
toBack()
Usages and Demos :

View More Examples of toFront()
   1:   private class MenuActionListener implements ActionListener {
   2:     Window w;
   3: 
   4:         ...
   5:     public MenuActionListener(Window w) {
   6:       this.w = w;
   7:         ...
   8:     public void actionPerformed(ActionEvent e) {
   9:       w.toFront();
  10:     }
  11:         ...
  12:   public WindowMenu(ApolloFrame frame) {
  13:     super("Window");

View Full Code Here
   1:         ImagePane pnlImage=new ImagePane( imgSplash );
   2:         Window splashWindow=new Window(this);
   3:         splashWindow.add(pnlImage,BorderLayout.CENTER);
   4:         ...
   5:         splashWindow.show();
   6:         splashWindow.toFront();
   7:         
   8:         try
   9:         {

View Full Code Here
   1: import java.awt.Component;
   2: import java.awt.Window;
   3: import java.awt.event.MouseAdapter;
   4:         ...
   5:     public static void changeFocusAcrossWindows(final Component target, final int delay) {
   6:         final Window window = SwingUtilities.getWindowAncestor(target);
   7:         DelayedJob job = new DelayedJob(delay, new Runnable() {
   8:         ...
   9:                 if (window != null) {
  10:                     window.toFront();
  11:                     window.requestFocus();

View Full Code Here
   1: 
   2: import java.awt.Window;
   3: import java.awt.Rectangle;
   4:         ...
   5: 
   6:   public static void snap(Window snap, int position) {
   7:     sharedSnap.snaps.addElement(new Snap(snap, position));
   8:         ...
   9: 
  10:   public static void snap(Window snap, int position, Window target) {
  11:     SnapListener l = new SnapListener();
  12:         ...
  13:         target.requestFocus();
  14:         target.toFront();

View Full Code Here
   1:     private JPanel m_buttons = new JPanel();
   2:     private final Window m_owner;
   3:     
   4:         ...
   5:                 setVisible(false);
   6:                 m_owner.toFront();
   7:             }
   8:         
   9:         });

View Full Code Here

void applyResourceBundle

public @Deprecated void applyResourceBundle(String rbName)

Deprecated. As of J2SE 1.4, replaced by Component.applyComponentOrientation.


void applyResourceBundle

public @Deprecated void applyResourceBundle(ResourceBundle rb)

Deprecated. As of J2SE 1.4, replaced by Component.applyComponentOrientation.


void hide

public @Deprecated void hide()

Deprecated. As of JDK 5, replaced by Component.setVisible(boolean).

Overrides:
void hide in interface Component

void show

public @Deprecated void show()

Deprecated. As of JDK 5, replaced by Component.setVisible(boolean).

Overrides:
void show in interface Component