|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.PopupFactory
PopupFactory
, as the name implies, is used to obtain
instances of Popup
s. Popup
s are used to
display a Component
above all other Component
s
in a particular containment hierarchy. The general contract is that
once you have obtained a Popup
from a
PopupFactory
, you must invoke hide
on the
Popup
. The typical usage is:
PopupFactory factory = PopupFactory.getSharedInstance(); Popup popup = factory.getPopup(owner, contents, x, y); popup.show(); ... popup.hide();
PopupFactory.HeavyWeightPopup
Nested Class Summary | |
private static class |
PopupFactory.ContainerPopup
ContainerPopup consolidates the common code used in the light/medium weight implementations of Popup . |
private static class |
PopupFactory.HeadlessPopup
Popup implementation that is used in headless environment. |
private static class |
PopupFactory.HeavyWeightPopup
Popup implementation that uses a Window as the popup. |
private static class |
PopupFactory.LightWeightPopup
Popup implementation that uses a JPanel as the popup. |
private static class |
PopupFactory.MediumWeightPopup
Popup implementation that uses a Panel as the popup. |
Field Summary | |
(package private) static int |
HEAVY_WEIGHT_POPUP
|
(package private) static int |
LIGHT_WEIGHT_POPUP
Key used to indicate a light weight popup should be used. |
private static int |
MAX_CACHE_SIZE
Max number of items to store in any one particular cache. |
(package private) static int |
MEDIUM_WEIGHT_POPUP
Key used to indicate a medium weight Popup should be used. |
private int |
popupType
Default type of Popup to create. |
private static Object |
SharedInstanceKey
The shared instanceof PopupFactory is per
AppContext . |
Constructor Summary | |
PopupFactory()
|
Method Summary | |
private Popup |
getHeadlessPopup(Component owner,
Component contents,
int ownerX,
int ownerY)
Creates a headless popup |
private Popup |
getHeavyWeightPopup(Component owner,
Component contents,
int ownerX,
int ownerY)
Creates a heavy weight popup. |
private Popup |
getLightWeightPopup(Component owner,
Component contents,
int ownerX,
int ownerY)
Creates a light weight popup. |
private Popup |
getMediumWeightPopup(Component owner,
Component contents,
int ownerX,
int ownerY)
Creates a medium weight popup. |
Popup |
getPopup(Component owner,
Component contents,
int x,
int y)
Creates a Popup for the Component owner
containing the Component contents . |
private Popup |
getPopup(Component owner,
Component contents,
int ownerX,
int ownerY,
int popupType)
Obtains the appropriate Popup based on
popupType . |
(package private) int |
getPopupType()
Returns the preferred type of Popup to create. |
private int |
getPopupType(Component owner,
Component contents,
int ownerX,
int ownerY)
Returns the popup type to use for the specified parameters. |
static PopupFactory |
getSharedInstance()
Returns the shared PopupFactory which can be used
to obtain Popup s. |
private boolean |
invokerInHeavyWeightPopup(Component i)
Returns true if the Component i inside a heavy weight
Popup . |
(package private) void |
setPopupType(int type)
Provides a hint as to the type of Popup that should
be created. |
static void |
setSharedInstance(PopupFactory factory)
Sets the AppContext specific PopupFactory .
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final Object SharedInstanceKey
PopupFactory
is per
AppContext
. This is the key used in the
AppContext
to locate the PopupFactory
.
private static final int MAX_CACHE_SIZE
static final int LIGHT_WEIGHT_POPUP
static final int MEDIUM_WEIGHT_POPUP
static final int HEAVY_WEIGHT_POPUP
private int popupType
Constructor Detail |
public PopupFactory()
Method Detail |
public static void setSharedInstance(PopupFactory factory)
AppContext
specific PopupFactory
.
This will throw an IllegalArgumentException
if
factory
is null.
factory
- Shared PopupFactory
IllegalArgumentException
- if factory
is nullpublic static PopupFactory getSharedInstance()
PopupFactory
which can be used
to obtain Popup
s.
void setPopupType(int type)
Popup
that should
be created.
int getPopupType()
public Popup getPopup(Component owner, Component contents, int x, int y) throws IllegalArgumentException
Popup
for the Component owner
containing the Component contents
. owner
is used to determine which Window
the new
Popup
will parent the Component
the
Popup
creates to. A null owner
implies there
is no valid parent. x
and
y
specify the preferred initial location to place
the Popup
at. Based on screen size, or other paramaters,
the Popup
may not display at x
and
y
.
owner
- Component mouse coordinates are relative to, may be nullcontents
- Contents of the Popupx
- Initial x screen coordinatey
- Initial y screen coordinate
IllegalArgumentException
- if contents is nullprivate int getPopupType(Component owner, Component contents, int ownerX, int ownerY)
private Popup getPopup(Component owner, Component contents, int ownerX, int ownerY, int popupType)
Popup
based on
popupType
.
private Popup getHeadlessPopup(Component owner, Component contents, int ownerX, int ownerY)
private Popup getLightWeightPopup(Component owner, Component contents, int ownerX, int ownerY)
private Popup getMediumWeightPopup(Component owner, Component contents, int ownerX, int ownerY)
private Popup getHeavyWeightPopup(Component owner, Component contents, int ownerX, int ownerY)
private boolean invokerInHeavyWeightPopup(Component i)
i
inside a heavy weight
Popup
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |