Home » openjdk-7 » javax » swing » [javadoc | source]
javax.swing
public class: JWindow [javadoc | source]
java.lang.Object
   java.awt.Component
      java.awt.Container
         java.awt.Window
            javax.swing.JWindow

All Implemented Interfaces:
    HasGetTransferHandler, Accessible, RootPaneContainer, MenuContainer, Serializable, ImageObserver

Direct Known Subclasses:
    HeavyWeightWindow, JWait

A JWindow is a container that can be displayed anywhere on the user's desktop. It does not have the title bar, window-management buttons, or other trimmings associated with a JFrame, but it is still a "first-class citizen" of the user's desktop, and can exist anywhere on it.

The JWindow component contains a JRootPane as its only child. The contentPane should be the parent of any children of the JWindow. As a conveniance add and its variants, remove and setLayout have been overridden to forward to the contentPane as necessary. This means you can write:

      window.add(child);
And the child will be added to the contentPane. The contentPane will always be non-null. Attempting to set it to null will cause the JWindow to throw an exception. The default contentPane will have a BorderLayout manager set on it. Refer to javax.swing.RootPaneContainer for details on adding, removing and setting the LayoutManager of a JWindow.

Please see the JRootPane documentation for a complete description of the contentPane, glassPane, and layeredPane components.

In a multi-screen environment, you can create a JWindow on a different screen device. See java.awt.Window for more information.

Warning: Swing is not thread safe. For more information see Swing's Threading Policy.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. As of 1.4, support for long term storage of all JavaBeansTM has been added to the java.beans package. Please see java.beans.XMLEncoder .

Nested Class Summary:
protected class  JWindow.AccessibleJWindow  This class implements accessibility support for the JWindow class. It provides an implementation of the Java Accessibility API appropriate to window user-interface elements. 
Field Summary
protected  JRootPane rootPane    The JRootPane instance that manages the contentPane and optional menuBar for this frame, as well as the glassPane. 
protected  boolean rootPaneCheckingEnabled    If true then calls to add and setLayout will be forwarded to the contentPane. This is initially false, but is set to true when the JWindow is constructed. 
protected  AccessibleContext accessibleContext    The accessible context property. 
Fields inherited from java.awt.Window:
warningString,  icons,  systemSyncLWRequests,  syncLWRequests,  beforeFirstShow,  OPENED,  state,  ownedWindowList,  showWithParent,  modalBlocker,  modalExclusionType,  windowListener,  windowStateListener,  windowFocusListener,  inputContext,  isInShow,  isTrayIconWindow,  anchor
Fields inherited from java.awt.Container:
layoutMgr,  containerListener,  listeningChildren,  listeningBoundsChildren,  descendantsCount,  preserveBackgroundColor,  INCLUDE_SELF,  SEARCH_HEAVYWEIGHTS,  modalComp,  modalAppContext
Fields inherited from java.awt.Component:
peer,  parent,  appContext,  x,  y,  width,  height,  foreground,  background,  font,  peerFont,  cursor,  locale,  bufferStrategy,  ignoreRepaint,  visible,  enabled,  dropTarget,  popups,  focusTraversalKeys,  LOCK,  minSize,  minSizeSet,  prefSize,  prefSizeSet,  maxSize,  maxSizeSet,  componentOrientation,  newEventsOnly,  componentListener,  focusListener,  hierarchyListener,  hierarchyBoundsListener,  keyListener,  mouseListener,  mouseMotionListener,  mouseWheelListener,  inputMethodListener,  windowClosingException,  actionListenerK,  adjustmentListenerK,  componentListenerK,  containerListenerK,  focusListenerK,  itemListenerK,  keyListenerK,  mouseListenerK,  mouseMotionListenerK,  mouseWheelListenerK,  textListenerK,  ownedWindowK,  windowListenerK,  inputMethodListenerK,  hierarchyListenerK,  hierarchyBoundsListenerK,  windowStateListenerK,  windowFocusListenerK,  eventMask,  isInc,  incRate,  TOP_ALIGNMENT,  CENTER_ALIGNMENT,  BOTTOM_ALIGNMENT,  LEFT_ALIGNMENT,  RIGHT_ALIGNMENT,  isPacked,  backgroundEraseDisabled,  eventCache,  accessibleContext
Constructor:
 public JWindow() 
 public JWindow(GraphicsConfiguration gc) 
    Creates a window with the specified GraphicsConfiguration of a screen device. This window will not be focusable.

    This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale.

    Parameters:
    gc - the GraphicsConfiguration that is used to construct the new window with; if gc is null, the system default GraphicsConfiguration is assumed
    Throws:
    HeadlessException - If GraphicsEnvironment.isHeadless() returns true.
    IllegalArgumentException - if gc is not from a screen device.
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    isFocusableWindow
    JComponent#getDefaultLocale
    since: 1.3 -
 public JWindow(Frame owner) 
    Creates a window with the specified owner frame. If owner is null, the shared owner will be used and this window will not be focusable. Also, this window will not be focusable unless its owner is showing on the screen.

    This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale.

    Parameters:
    owner - the frame from which the window is displayed
    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    isFocusableWindow
    JComponent#getDefaultLocale
 public JWindow(Window owner) 
    Creates a window with the specified owner window. This window will not be focusable unless its owner is showing on the screen. If owner is null, the shared owner will be used and this window will not be focusable.

    This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale.

    Parameters:
    owner - the window from which the window is displayed
    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    isFocusableWindow
    JComponent#getDefaultLocale
 public JWindow(Window owner,
    GraphicsConfiguration gc) 
    Creates a window with the specified owner window and GraphicsConfiguration of a screen device. If owner is null, the shared owner will be used and this window will not be focusable.

    This constructor sets the component's locale property to the value returned by JComponent.getDefaultLocale.

    Parameters:
    owner - the window from which the window is displayed
    gc - the GraphicsConfiguration that is used to construct the new window with; if gc is null, the system default GraphicsConfiguration is assumed, unless owner is also null, in which case the GraphicsConfiguration from the shared owner frame will be used.
    Throws:
    HeadlessException - if GraphicsEnvironment.isHeadless() returns true.
    IllegalArgumentException - if gc is not from a screen device.
    Also see:
    java.awt.GraphicsEnvironment#isHeadless
    isFocusableWindow
    JComponent#getDefaultLocale
    since: 1.3 -
Method from javax.swing.JWindow Summary:
addImpl,   createRootPane,   getAccessibleContext,   getContentPane,   getGlassPane,   getGraphics,   getLayeredPane,   getRootPane,   getTransferHandler,   isRootPaneCheckingEnabled,   paramString,   remove,   repaint,   setContentPane,   setGlassPane,   setLayeredPane,   setLayout,   setRootPane,   setRootPaneCheckingEnabled,   setTransferHandler,   update,   windowInit
Methods from java.awt.Window:
addNotify,   addOwnedWindow,   addPropertyChangeListener,   addPropertyChangeListener,   addWindowFocusListener,   addWindowListener,   addWindowStateListener,   adjustDecendantsOnParent,   adjustListeningChildrenOnParent,   applyCompoundShape,   applyCurrentShape,   applyResourceBundle,   applyResourceBundle,   canContainFocusOwner,   clearMostRecentFocusOwnerOnHide,   closeSplashScreen,   connectOwnedWindow,   constructComponentName,   createBufferStrategy,   createBufferStrategy,   deliverMouseWheelToAncestor,   dispatchEventImpl,   dispatchMouseWheelToAncestor,   dispose,   disposeImpl,   doDispose,   eventEnabled,   getAccessibleContext,   getAllUnblockedWindows,   getAllWindows,   getBackground,   getBufferStrategy,   getContainer,   getDocumentRoot,   getFocusCycleRootAncestor,   getFocusOwner,   getFocusTraversalKeys,   getFocusableWindowState,   getIconImages,   getInputContext,   getListeners,   getLocale,   getLocationOnWindow,   getModalBlocker,   getModalExclusionType,   getMostRecentFocusOwner,   getOpacity,   getOwnedWindows,   getOwnedWindows_NoClientCode,   getOwner,   getOwner_NoClientCode,   getOwnerlessWindows,   getShape,   getTemporaryLostComponent,   getToolkit,   getType,   getWarningString,   getWindowFocusListeners,   getWindowListeners,   getWindowStateListeners,   getWindows,   hide,   isActive,   isAlwaysOnTop,   isAlwaysOnTopSupported,   isAutoRequestFocus,   isFocusCycleRoot,   isFocusableWindow,   isFocused,   isLocationByPlatform,   isModalBlocked,   isModalExcluded,   isOpaque,   isRecursivelyVisible,   isShowing,   isValidateRoot,   mixOnReshaping,   pack,   paint,   postEvent,   postProcessKeyEvent,   postWindowEvent,   preProcessKeyEvent,   processEvent,   processWindowEvent,   processWindowFocusEvent,   processWindowStateEvent,   removeNotify,   removeOwnedWindow,   removeWindowFocusListener,   removeWindowListener,   removeWindowStateListener,   reshape,   setAlwaysOnTop,   setAutoRequestFocus,   setBackground,   setBounds,   setBounds,   setClientSize,   setCursor,   setFocusCycleRoot,   setFocusableWindowState,   setGraphicsConfiguration,   setIconImage,   setIconImages,   setLocation,   setLocation,   setLocationByPlatform,   setLocationRelativeTo,   setMinimumSize,   setModalBlocked,   setModalExclusionType,   setOpacity,   setShape,   setSize,   setSize,   setTemporaryLostComponent,   setType,   setVisible,   show,   toBack,   toBack_NoClientCode,   toFront,   toFront_NoClientCode,   updateChildFocusableWindowState,   updateChildrenBlocking,   updateZOrder
Methods from java.awt.Container:
add,   add,   add,   add,   add,   addContainerListener,   addImpl,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   adjustDecendantsOnParent,   adjustDescendants,   adjustListeningChildren,   applyComponentOrientation,   areFocusTraversalKeysSet,   canContainFocusOwner,   checkGD,   clearCurrentFocusCycleRootOnHide,   clearMostRecentFocusOwnerOnHide,   containsFocus,   countComponents,   countHierarchyMembers,   createChildHierarchyEvents,   createHierarchyEvents,   decreaseComponentCount,   deliverEvent,   dispatchEventImpl,   dispatchEventToSelf,   doLayout,   eventEnabled,   findComponentAt,   findComponentAt,   findComponentAt,   findComponentAtImpl,   getAccessibleAt,   getAccessibleChild,   getAccessibleChildrenCount,   getAlignmentX,   getAlignmentY,   getComponent,   getComponentAt,   getComponentAt,   getComponentCount,   getComponentZOrder,   getComponents,   getComponentsSync,   getComponents_NoClientCode,   getContainerListeners,   getDropTargetEventTarget,   getFocusTraversalKeys,   getFocusTraversalPolicy,   getHeavyweightContainer,   getInsets,   getLayout,   getListeners,   getMaximumSize,   getMinimumSize,   getMouseEventTarget,   getMousePosition,   getOpaqueShape,   getPreferredSize,   getTraversalRoot,   hasHeavyweightDescendants,   hasLightweightDescendants,   increaseComponentCount,   initializeFocusTraversalKeys,   insets,   invalidate,   invalidateParent,   invalidateTree,   isAncestorOf,   isFocusCycleRoot,   isFocusCycleRoot,   isFocusTraversalPolicyProvider,   isFocusTraversalPolicySet,   isRecursivelyVisibleUpToHeavyweightContainer,   isSameOrAncestorOf,   isValidateRoot,   layout,   lightweightPaint,   lightweightPrint,   list,   list,   locate,   minimumSize,   mixOnHiding,   mixOnReshaping,   mixOnShowing,   mixOnValidating,   mixOnZOrderChanging,   numListening,   paint,   paintComponents,   paintHeavyweightComponents,   paramString,   postProcessKeyEvent,   postsOldMouseEvents,   preProcessKeyEvent,   preferredSize,   print,   printComponents,   printHeavyweightComponents,   processContainerEvent,   processEvent,   proxyEnableEvents,   recursiveApplyCurrentShape,   recursiveApplyCurrentShape,   recursiveApplyCurrentShape,   recursiveSubtractAndApplyShape,   recursiveSubtractAndApplyShape,   recursiveSubtractAndApplyShape,   remove,   remove,   removeAll,   removeContainerListener,   removeNotify,   setComponentZOrder,   setFocusCycleRoot,   setFocusTraversalKeys,   setFocusTraversalPolicy,   setFocusTraversalPolicyProvider,   setFont,   setLayout,   transferFocusDownCycle,   update,   updateGraphicsData,   validate,   validateTree,   validateUnconditionally
Methods from java.awt.Component:
action,   add,   addComponentListener,   addFocusListener,   addHierarchyBoundsListener,   addHierarchyListener,   addInputMethodListener,   addKeyListener,   addMouseListener,   addMouseMotionListener,   addMouseWheelListener,   addNotify,   addPropertyChangeListener,   addPropertyChangeListener,   adjustListeningChildrenOnParent,   applyComponentOrientation,   applyCompoundShape,   applyCurrentShape,   areBoundsValid,   areFocusTraversalKeysSet,   areInputMethodsEnabled,   autoProcessMouseWheel,   bounds,   canBeFocusOwner,   canBeFocusOwnerRecursively,   checkGD,   checkImage,   checkImage,   checkTreeLock,   checkWindowClosingException,   clearCurrentFocusCycleRootOnHide,   clearMostRecentFocusOwnerOnHide,   coalesceEvents,   constructComponentName,   contains,   contains,   containsFocus,   countHierarchyMembers,   createBufferStrategy,   createBufferStrategy,   createHierarchyEvents,   createImage,   createImage,   createVolatileImage,   createVolatileImage,   deliverEvent,   disable,   disableEvents,   dispatchEvent,   dispatchEventImpl,   dispatchMouseWheelToAncestor,   doLayout,   enable,   enable,   enableEvents,   enableInputMethods,   eventEnabled,   eventTypeEnabled,   findUnderMouseInWindow,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   firePropertyChange,   getAccessControlContext,   getAccessibleContext,   getAccessibleIndexInParent,   getAccessibleStateSet,   getAlignmentX,   getAlignmentY,   getBackBuffer,   getBackground,   getBaseline,   getBaselineResizeBehavior,   getBounds,   getBounds,   getBoundsOp,   getBufferStrategy,   getColorModel,   getComponentAt,   getComponentAt,   getComponentListeners,   getComponentOrientation,   getContainer,   getContainingWindow,   getCursor,   getCursor_NoClientCode,   getDropTarget,   getFocusCycleRootAncestor,   getFocusListeners,   getFocusTraversalKeys,   getFocusTraversalKeysEnabled,   getFocusTraversalKeys_NoIDCheck,   getFont,   getFontMetrics,   getFont_NoClientCode,   getForeground,   getGraphics,   getGraphicsConfiguration,   getGraphicsConfiguration_NoClientCode,   getGraphics_NoClientCode,   getHWPeerAboveMe,   getHeight,   getHierarchyBoundsListeners,   getHierarchyListeners,   getIgnoreRepaint,   getInputContext,   getInputMethodListeners,   getInputMethodRequests,   getKeyListeners,   getListeners,   getLocale,   getLocation,   getLocation,   getLocationOnScreen,   getLocationOnScreen_NoTreeLock,   getLocationOnWindow,   getMaximumSize,   getMinimumSize,   getMouseListeners,   getMouseMotionListeners,   getMousePosition,   getMouseWheelListeners,   getName,   getNativeContainer,   getNextFocusCandidate,   getNormalShape,   getObjectLock,   getOpaqueShape,   getParent,   getParent_NoClientCode,   getPeer,   getPreferredSize,   getPropertyChangeListeners,   getPropertyChangeListeners,   getSiblingIndexAbove,   getSiblingIndexBelow,   getSize,   getSize,   getToolkit,   getToolkitImpl,   getTraversalRoot,   getTreeLock,   getWidth,   getX,   getY,   gotFocus,   handleEvent,   hasFocus,   hide,   imageUpdate,   initializeFocusTraversalKeys,   inside,   invalidate,   invalidateIfValid,   invalidateParent,   isAutoFocusTransferOnDisposal,   isBackgroundSet,   isCoalescingEnabled,   isCursorSet,   isDisplayable,   isDoubleBuffered,   isEnabled,   isEnabledImpl,   isFocusCycleRoot,   isFocusOwner,   isFocusTraversable,   isFocusTraversableOverridden,   isFocusable,   isFontSet,   isForegroundSet,   isInstanceOf,   isLightweight,   isMaximumSizeSet,   isMinimumSizeSet,   isMixingNeeded,   isNonOpaqueForMixing,   isOpaque,   isPreferredSizeSet,   isRecursivelyVisible,   isSameOrAncestorOf,   isShowing,   isValid,   isVisible,   isVisible_NoClientCode,   keyDown,   keyUp,   layout,   lightweightPaint,   lightweightPrint,   list,   list,   list,   list,   list,   locate,   location,   lostFocus,   minimumSize,   mixOnHiding,   mixOnReshaping,   mixOnShowing,   mixOnValidating,   mixOnZOrderChanging,   mouseDown,   mouseDrag,   mouseEnter,   mouseExit,   mouseMove,   mouseUp,   move,   nextFocus,   numListening,   paint,   paintAll,   paintHeavyweightComponents,   paramString,   pointRelativeToComponent,   postEvent,   postsOldMouseEvents,   preferredSize,   prepareImage,   prepareImage,   print,   printAll,   printHeavyweightComponents,   processComponentEvent,   processEvent,   processFocusEvent,   processHierarchyBoundsEvent,   processHierarchyEvent,   processInputMethodEvent,   processKeyEvent,   processMouseEvent,   processMouseMotionEvent,   processMouseWheelEvent,   relocateComponent,   remove,   removeComponentListener,   removeFocusListener,   removeHierarchyBoundsListener,   removeHierarchyListener,   removeInputMethodListener,   removeKeyListener,   removeMouseListener,   removeMouseMotionListener,   removeMouseWheelListener,   removeNotify,   removePropertyChangeListener,   removePropertyChangeListener,   repaint,   repaint,   repaint,   repaint,   requestFocus,   requestFocus,   requestFocus,   requestFocus,   requestFocusHelper,   requestFocusHelper,   requestFocusInWindow,   requestFocusInWindow,   requestFocusInWindow,   requestFocusInWindow,   reshape,   resize,   resize,   revalidate,   setAutoFocusTransferOnDisposal,   setBackground,   setBounds,   setBounds,   setBoundsOp,   setComponentOrientation,   setCursor,   setDropTarget,   setEnabled,   setFocusTraversalKeys,   setFocusTraversalKeysEnabled,   setFocusTraversalKeys_NoIDCheck,   setFocusable,   setFont,   setForeground,   setGraphicsConfiguration,   setIgnoreRepaint,   setLocale,   setLocation,   setLocation,   setMaximumSize,   setMinimumSize,   setName,   setPreferredSize,   setRequestFocusController,   setSize,   setSize,   setVisible,   show,   show,   size,   subtractAndApplyShape,   subtractAndApplyShapeBelowMe,   toString,   transferFocus,   transferFocus,   transferFocusBackward,   transferFocusBackward,   transferFocusUpCycle,   update,   updateCursorImmediately,   updateGraphicsData,   updateZOrder,   validate
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from javax.swing.JWindow Detail:
 protected  void addImpl(Component comp,
    Object constraints,
    int index) 
    Adds the specified child Component. This method is overridden to conditionally forward calls to the contentPane. By default, children are added to the contentPane instead of the frame, refer to javax.swing.RootPaneContainer for details.
 protected JRootPane createRootPane() 
    Called by the constructor methods to create the default rootPane.
 public AccessibleContext getAccessibleContext() 
    Gets the AccessibleContext associated with this JWindow. For JWindows, the AccessibleContext takes the form of an AccessibleJWindow. A new AccessibleJWindow instance is created if necessary.
 public Container getContentPane() 
    Returns the Container which is the contentPane for this window.
 public Component getGlassPane() 
    Returns the glassPane Component for this window.
 public Graphics getGraphics() 
    {@inheritDoc}
 public JLayeredPane getLayeredPane() 
    Returns the layeredPane object for this window.
 public JRootPane getRootPane() 
    Returns the rootPane object for this window.
 public TransferHandler getTransferHandler() 
    Gets the transferHandler property.
 protected boolean isRootPaneCheckingEnabled() 
    Returns whether calls to add and setLayout are forwarded to the contentPane.
 protected String paramString() 
    Returns a string representation of this JWindow. This method is intended to be used only for debugging purposes, and the content and format of the returned string may vary between implementations. The returned string may be empty but may not be null.
 public  void remove(Component comp) 
    Removes the specified component from the container. If comp is not the rootPane, this will forward the call to the contentPane. This will do nothing if comp is not a child of the JWindow or contentPane.
 public  void repaint(long time,
    int x,
    int y,
    int width,
    int height) 
    Repaints the specified rectangle of this component within time milliseconds. Refer to RepaintManager for details on how the repaint is handled.
 public  void setContentPane(Container contentPane) 
    Sets the contentPane property for this window. This method is called by the constructor.
 public  void setGlassPane(Component glassPane) 
    Sets the glassPane property. This method is called by the constructor.
 public  void setLayeredPane(JLayeredPane layeredPane) 
    Sets the layeredPane property. This method is called by the constructor.
 public  void setLayout(LayoutManager manager) 
    Sets the LayoutManager. Overridden to conditionally forward the call to the contentPane. Refer to javax.swing.RootPaneContainer for more information.
 protected  void setRootPane(JRootPane root) 
    Sets the new rootPane object for this window. This method is called by the constructor.
 protected  void setRootPaneCheckingEnabled(boolean enabled) 
    Sets whether calls to add and setLayout are forwarded to the contentPane.
 public  void setTransferHandler(TransferHandler newHandler) 
    Sets the {@code transferHandler} property, which is a mechanism to support transfer of data into this component. Use {@code null} if the component does not support data transfer operations.

    If the system property {@code suppressSwingDropSupport} is {@code false} (the default) and the current drop target on this component is either {@code null} or not a user-set drop target, this method will change the drop target as follows: If {@code newHandler} is {@code null} it will clear the drop target. If not {@code null} it will install a new {@code DropTarget}.

    Note: When used with {@code JWindow}, {@code TransferHandler} only provides data import capability, as the data export related methods are currently typed to {@code JComponent}.

    Please see How to Use Drag and Drop and Data Transfer, a section in The Java Tutorial, for more information.

 public  void update(Graphics g) 
    Calls paint(g). This method was overridden to prevent an unnecessary call to clear the background.
 protected  void windowInit() 
    Called by the constructors to init the JWindow properly.