Top Description Inners Fields Constructors Methods
javax.swing

public Class Popup

extends Object
Class Inheritance
Known Direct Subclasses
javax.swing.PopupFactory.HeavyWeightPopup, javax.swing.PopupFactory.ContainerPopup
Imports
java.awt.BorderLayout, .Component, .Frame, .Graphics, .GraphicsEnvironment, .Window, sun.awt.ModalExclude

Popups are used to display a Component to the user, typically on top of all the other Components in a particular containment hierarchy. Popups have a very small life cycle. Once you have obtained a Popup, and hidden it (invoked the hide method), you should no longer invoke any methods on it. This allows the PopupFactory to cache Popups for later use.

The general contract is that if you need to change the size of the Component, or location of the Popup, you should obtain a new Popup.

Popup does not descend from Component, rather implementations of Popup are responsible for creating and maintaining their own Components to render the requested Component to the user.

You typically do not explicitly create an instance of Popup, instead obtain one from a PopupFactory.

Since
1.4
See Also
PopupFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
Popup.DefaultFrame

Used if no valid Window ancestor of the supplied owner is found.

pack-priv static class
Popup.HeavyWeightWindow

Component used to house window.

Field Summary

Modifier and TypeField and Description
private Component
component

The Component representing the Popup.

Constructor Summary

AccessConstructor and Description

Method Summary

Modifier and TypeMethod and Description
pack-priv Component
createComponent(Component owner)

Creates the Component to use as the parent of the Popup.

pack-priv void
dispose()

Frees any resources the Popup may be holding onto.

pack-priv Component
getComponent()

Returns the Component returned from createComponent that will hold the Popup.

private Window
getParentWindow(Component owner)

Returns the Window to use as the parent of the Window created for the Popup.

public void
hide()

Hides and disposes of the Popup.

pack-priv void
pack()

Causes the Popup to be sized to fit the preferred size of the Component it contains.

pack-priv void
reset(Component owner, Component contents, int ownerX, int ownerY)

Resets the Popup to an initial state.

public void
show()

Makes the Popup visible.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

componentback to summary
private Component component

The Component representing the Popup.

Constructor Detail

Method Detail

createComponentback to summary
pack-priv Component createComponent(Component owner)

Creates the Component to use as the parent of the Popup. The default implementation creates a Window, subclasses should override.

disposeback to summary
pack-priv void dispose()

Frees any resources the Popup may be holding onto.

getComponentback to summary
pack-priv Component getComponent()

Returns the Component returned from createComponent that will hold the Popup.

getParentWindowback to summary
private Window getParentWindow(Component owner)

Returns the Window to use as the parent of the Window created for the Popup. This creates a new DefaultFrame, if necessary.

hideback to summary
public void hide()

Hides and disposes of the Popup. Once a Popup has been disposed you should no longer invoke methods on it. A disposed Popup may be reclaimed and later used based on the PopupFactory. As such, if you invoke methods on a disposed Popup, indeterminate behavior will result.

Annotations
@SuppressWarnings:deprecation
packback to summary
pack-priv void pack()

Causes the Popup to be sized to fit the preferred size of the Component it contains.

resetback to summary
pack-priv void reset(Component owner, Component contents, int ownerX, int ownerY)

Resets the Popup to an initial state.

showback to summary
public void show()

Makes the Popup visible. If the Popup is currently visible, this has no effect.

Annotations
@SuppressWarnings:deprecation
javax.swing back to summary

pack-priv Class Popup.DefaultFrame

extends Frame
Class Inheritance
Annotations
@SuppressWarnings:serial

Used if no valid Window ancestor of the supplied owner is found.

PopupFactory uses this as a way to know when the Popup shouldn't be cached based on the Window.

Field Summary

Inherited from java.awt.Frame:
CROSSHAIR_CURSORDEFAULT_CURSORE_RESIZE_CURSORHAND_CURSORICONIFIEDMAXIMIZED_BOTHMAXIMIZED_HORIZMAXIMIZED_VERTMOVE_CURSORN_RESIZE_CURSORNE_RESIZE_CURSORNORMALNW_RESIZE_CURSORS_RESIZE_CURSORSE_RESIZE_CURSORSW_RESIZE_CURSORTEXT_CURSORW_RESIZE_CURSORWAIT_CURSOR

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Inherited from java.awt.Frame:
addNotifygetAccessibleContextgetCursorTypegetExtendedStategetFramesgetIconImagegetMaximizedBoundsgetMenuBargetStategetTitleisResizableisUndecoratedparamStringremoveremoveNotifysetBackgroundsetCursorsetExtendedStatesetIconImagesetMaximizedBoundssetMenuBarsetOpacitysetResizablesetShapesetStatesetTitlesetUndecorated

Constructor Detail

DefaultFrameback to summary
pack-priv DefaultFrame()
javax.swing back to summary

pack-priv Class Popup.HeavyWeightWindow

extends JWindow
implements ModalExclude
Class Inheritance
All Implemented Interfaces
sun.awt.ModalExclude
Annotations
@SuppressWarnings:serial

Component used to house window.

Field Summary

Inherited from javax.swing.JWindow:
accessibleContextrootPanerootPaneCheckingEnabled

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public void
show()

Overrides java.awt.Window.show.

Makes the Window visible.
public void
update(Graphics
the Graphics context in which to paint
g
)

Overrides javax.swing.JWindow.update.

Calls paint(g).
Inherited from javax.swing.JWindow:
addImplcreateRootPanegetAccessibleContextgetContentPanegetGlassPanegetGraphicsgetLayeredPanegetRootPanegetTransferHandlerisRootPaneCheckingEnabledparamStringremoverepaintsetContentPanesetGlassPanesetLayeredPanesetLayoutsetRootPanesetRootPaneCheckingEnabledsetTransferHandlerwindowInit

Constructor Detail

HeavyWeightWindowback to summary
pack-priv HeavyWeightWindow(Window parent)

Method Detail

showback to summary
public void show()

Overrides java.awt.Window.show.

Doc from java.awt.Window.show.

Makes the Window visible. If the Window and/or its owner are not yet displayable, both are made displayable. The Window will be validated prior to being made visible. If the Window is already visible, this will bring the Window to the front.

Annotations
@SuppressWarnings:deprecation
updateback to summary
public void update(Graphics g)

Overrides javax.swing.JWindow.update.

Doc from javax.swing.JWindow.update.

Calls paint(g). This method was overridden to prevent an unnecessary call to clear the background.

Parameters
g:Graphics

the Graphics context in which to paint