public class PopupWindowManager
extends java.lang.Object
PopupWindowManager
helps to manage popup windows
for a given component. Specifically, it helps to position
popups so that they are completely visible without obscuring other
popups if possible.Modifier and Type | Field and Description |
---|---|
static int |
EAST
The constant indicating the west of a given rectangle location (when
positining relative to location) or popup window (when positioning
relative to popup).
|
static int |
NORTH
The constant indicating the west of a given rectangle location (when
positining relative to location) or popup window (when positioning
relative to popup).
|
static int |
SOUTH
The constant indicating the west of a given rectangle location (when
positining relative to location) or popup window (when positioning
relative to popup).
|
static int |
WEST
The constant indicating the west of a given rectangle location (when
positining relative to location) or popup window (when positioning
relative to popup).
|
Modifier and Type | Method and Description |
---|---|
static void |
dismissPopup(PopupWindow popup)
Dismisses the popup window and any associated resources.
|
static java.util.List<PopupWindow> |
getPopupWindows(javax.swing.JComponent parent)
Utility routine to fetch the current list of popup windows for a parent.
|
void |
propertyChange(java.beans.PropertyChangeEvent event)
This method gets called when a bound property is changed.
|
static PopupWindow |
showPopup(javax.swing.JComponent parentComponent,
javax.swing.JComponent content,
boolean focusable,
java.awt.Rectangle relativeToLocation,
int[] preferredLocations,
boolean center)
Create and show a new
PopupWindow with the given content. |
public static final int WEST
public static final int EAST
public static final int NORTH
public static final int SOUTH
public void propertyChange(java.beans.PropertyChangeEvent event)
event
- the property change eventpublic static PopupWindow showPopup(javax.swing.JComponent parentComponent, javax.swing.JComponent content, boolean focusable, java.awt.Rectangle relativeToLocation, int[] preferredLocations, boolean center)
PopupWindow
with the given content. The
focusable parameter indicates whether the popup should be allowed
to have focus at any time. If not, then if the popup window is
brought to the front (i.e., user clicked on it), focus will be
automatically moved back to the associated parent component. The size of the
popup window is automatically based on the size of the content provided.parentComponent
- the parent component that the popup floats in front of.content
- the content to display in the popupfocusable
- whether the content is allowed to have focus or notPopupWindow
. The listener provided will be
notified if the popup is closed, or if focus was lost.public static void dismissPopup(PopupWindow popup)
popup
- the popup windowpublic static java.util.List<PopupWindow> getPopupWindows(javax.swing.JComponent parent)