public class GuiUtilities extends Object
Multiple instances of this class may exist. One of these instances is the default instance managed by this class.
| Modifier and Type | Field and Description |
|---|---|
protected int |
mPopupAdjustmentStrategy
Current adjustment strategy for popup menus.
|
static int |
POPUP_ADJUSTMENT_STRATEGY_FLIP
Flip the popup menu to the other side of the mouse coursor.
|
static int |
POPUP_ADJUSTMENT_STRATEGY_MOVE
Move the popup menu a little bit to keep it on the screen.
|
| Constructor and Description |
|---|
GuiUtilities() |
| Modifier and Type | Method and Description |
|---|---|
Point |
adjustPopupPosition(JPopupMenu popup,
Component pInvoker,
Point pPosition)
Adjust the position of a popup so that it will be displayed in the visible screen area.
|
protected Rectangle |
determineVisibleScreenArea()
Determine the visible screen area.
|
static GuiUtilities |
getDefault()
Get the default instance.
|
int |
getPopupAdjustmentStrategy()
Get the popup adjustment strategy.
|
protected static void |
setDefault(GuiUtilities pInstance)
Install a new default instance.
|
void |
setPopupAdjustmentStrategy(int pStrategy)
Set the popup adjustment strategy.
|
void |
showPopupAdjusted(JPopupMenu popup,
Component pInvoker,
Point pPosition)
Adjust the position of a popup and show it.
|
public static final int POPUP_ADJUSTMENT_STRATEGY_MOVE
public static final int POPUP_ADJUSTMENT_STRATEGY_FLIP
protected int mPopupAdjustmentStrategy
POPUP_ADJUSTMENT_STRATEGY_MOVE (default) and
POPUP_ADJUSTMENT_STRATEGY_FLIP.public static GuiUtilities getDefault()
protected static void setDefault(GuiUtilities pInstance)
pInstance - new default instance, may be nullpublic int getPopupAdjustmentStrategy()
public void setPopupAdjustmentStrategy(int pStrategy)
pStrategy - POPUP_ADJUSTMENT_STRATEGY_MOVE or POPUP_ADJUSTMENT_STRATEGY_FLIPIllegalArgumentException - if the value strategy is not supportedpublic Point adjustPopupPosition(JPopupMenu popup, Component pInvoker, Point pPosition)
popup - popup whose position has to be adjustedpInvoker - "invoker" of popuppPosition - proposed position for popup relative to invoker (should be the mouse cursor position)invokerpublic void showPopupAdjusted(JPopupMenu popup, Component pInvoker, Point pPosition)
popup - popup whose position has to be adjustedpInvoker - "invoker" of popuppPosition - proposed position for popup relative to invoker (should be the mouse cursor position)protected Rectangle determineVisibleScreenArea()
Copyright © 2017 Jürgen Zeller (privat). All rights reserved.