- java.lang.Object
-
- javax.swing.Popup
-
public class Popup extends Object
Popups are used to display aComponent
to the user, typically on top of all the otherComponent
s in a particular containment hierarchy.Popup
s have a very small life cycle. Once you have obtained aPopup
, and hidden it (invoked thehide
method), you should no longer invoke any methods on it. This allows thePopupFactory
to cachePopup
s for later use.The general contract is that if you need to change the size of the
Component
, or location of thePopup
, you should obtain a newPopup
.Popup
does not descend fromComponent
, rather implementations ofPopup
are responsible for creating and maintaining their ownComponent
s to render the requestedComponent
to the user.You typically do not explicitly create an instance of
Popup
, instead obtain one from aPopupFactory
.- Since:
- 1.4
- See Also:
PopupFactory
-
-
Constructor Detail
-
Popup
protected Popup(Component owner, Component contents, int x, int y)
Creates aPopup
for the Componentowner
containing the Componentcontents
.owner
is used to determine whichWindow
the newPopup
will parent theComponent
thePopup
creates to. A nullowner
implies there is no valid parent.x
andy
specify the preferred initial location to place thePopup
at. Based on screen size, or other paramaters, thePopup
may not display atx
andy
.- Parameters:
owner
- Component mouse coordinates are relative to, may be nullcontents
- Contents of the Popupx
- Initial x screen coordinatey
- Initial y screen coordinate- Throws:
IllegalArgumentException
- if contents is null
-
Popup
protected Popup()
Creates aPopup
. This is provided for subclasses.
-
-
Method Detail
-
show
public void show()
Makes thePopup
visible. If thePopup
is currently visible, this has no effect.
-
hide
public void hide()
Hides and disposes of thePopup
. Once aPopup
has been disposed you should no longer invoke methods on it. Adispose
dPopup
may be reclaimed and later used based on thePopupFactory
. As such, if you invoke methods on adisposed
Popup
, indeterminate behavior will result.
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/swing/Popup.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.