|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.swing.PopupFactory org.fife.jgoodies.looks.common.ShadowPopupFactory
public final class ShadowPopupFactory
The JGoodies Looks implementation of PopupFactory
.
Adds a drop shadow border to all popups except ComboBox popups.
It is installed by the JGoodies Plastic L&F, as well as by
the JGoodies Windows L&F during the Look&Feel initialization,
see com.jgoodies.looks.plastic.PlasticLookAndFeel#initialize
com.jgoodies.looks.windows.WindowsLookAndFeel#initialize
.
This factory shall not be used on platforms that provide native drop shadows,
such as the Mac OS X. Therefore the invocation of the install()
method will have no effect on such platforms.
Note: To be used in a sandbox environment, this PopupFactory
requires two AWT permissions: createRobot
and
readDisplayPixels
. The reason for it is, that in the case of
the heavy weight popups this PopupFactory uses a Robot to snapshot
the screen background to simulate the drop shadow effect.
AWTPermission
,
Robot
,
Popup
Method Summary | |
---|---|
javax.swing.Popup |
getPopup(java.awt.Component owner,
java.awt.Component contents,
int x,
int y)
Creates a Popup for the Component owner
containing the Component contents . |
static void |
install()
Installs the ShadowPopupFactory as the shared popup factory on non-Mac platforms. |
static void |
uninstall()
Uninstalls the ShadowPopupFactory and restores the original popup factory as the new shared popup factory. |
Methods inherited from class javax.swing.PopupFactory |
---|
getSharedInstance, setSharedInstance |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void install()
#uninstall
.
In some Mac Java environments the popup factory throws
a NullPointerException when we call #getPopup
.
TODO: The Mac case shows that we may have problems replacing non PopupFactory instances. Therefore we should consider replacing only instances of PopupFactory.
uninstall()
public static void uninstall()
install()
public javax.swing.Popup getPopup(java.awt.Component owner, java.awt.Component contents, int x, int y) throws java.lang.IllegalArgumentException
Popup
for the Component owner
containing the Component contents
. In addition to
the superclass behavior, we try to return a Popup that has a drop shadow,
if popup drop shadows are active - as returned by
Options#isPopupDropShadowActive
.
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
.
We invoke the super #getPopup
, not the one in the
stored factory, because the popup type is set in this instance,
not in the stored one.
getPopup
in class javax.swing.PopupFactory
owner
- Component mouse coordinates are relative to, may be nullcontents
- Contents of the Popupx
- Initial x screen coordinatey
- Initial y screen coordinate
java.lang.IllegalArgumentException
- if contents is nullOptions.isPopupDropShadowActive()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |