public class GUI
extends java.lang.Object
Constructor and Description |
---|
GUI() |
Modifier and Type | Method and Description |
---|---|
static void |
center(java.awt.Window win) |
static void |
center(java.awt.Window win,
java.awt.Component target)
Positions the specified window in the center of the screen that contains target.
|
static void |
centerOnImageJScreen(java.awt.Window win)
Positions the specified window in the center of the
screen containing the "ImageJ" window.
|
static java.awt.Image |
createBlankImage(int width,
int height)
Obsolete
|
static void |
fix(java.awt.Scrollbar sb)
Lightens overly dark scrollbar background on Windows 8.
|
static void |
fixScrollbar(java.awt.Scrollbar sb)
Works around an OpenJDK bug on Windows that
causes the scrollbar thumb color and background
color to be almost identical.
|
static java.awt.Rectangle |
getMaxWindowBounds() |
static java.awt.Rectangle |
getMaxWindowBounds(java.awt.Component component) |
static java.awt.Rectangle |
getMaxWindowBounds(java.awt.Point point) |
static java.awt.Rectangle |
getScreenBounds() |
static java.awt.Rectangle |
getScreenBounds(java.awt.Component component) |
static java.awt.Rectangle |
getScreenBounds(java.awt.Component component,
boolean accountForInsets)
Get maximum bounds for the screen that contains a given component.
|
static java.awt.Rectangle |
getScreenBounds(java.awt.Point point) |
static java.awt.Rectangle |
getScreenBounds(java.awt.Point point,
boolean accountForInsets)
Get maximum bounds for the screen that contains a given point.
|
static java.awt.Rectangle |
getUnionOfBounds() |
static java.awt.Rectangle |
getZeroBasedMaxBounds() |
static void |
scale(java.awt.Component component)
Scales an AWT component according to
Prefs.getGuiScale() . |
static boolean |
scale(javax.swing.JComponent component)
Tries to detect if a Swing component is unscaled and scales it it according
to
#getGuiScale() . |
static void |
scalePopupMenu(java.awt.PopupMenu popup) |
static boolean |
showCompositeAdvisory(ImagePlus imp,
java.lang.String title) |
public static void center(java.awt.Window win, java.awt.Component target)
public static void centerOnImageJScreen(java.awt.Window win)
public static void center(java.awt.Window win)
public static java.awt.Rectangle getScreenBounds(java.awt.Point point, boolean accountForInsets)
point
- Coordinates of point.accountForInsets
- Deduct the space taken up by menu and status bars, etc. (after point is found to be inside bonds)null
if point not inside of any screen.public static java.awt.Rectangle getScreenBounds(java.awt.Component component, boolean accountForInsets)
component
- An AWT component located on the desired screen.
If null
is provided, the default screen is used.accountForInsets
- Deduct the space taken up by menu and status bars, etc.public static java.awt.Rectangle getScreenBounds(java.awt.Point point)
public static java.awt.Rectangle getScreenBounds(java.awt.Component component)
public static java.awt.Rectangle getScreenBounds()
public static java.awt.Rectangle getMaxWindowBounds(java.awt.Point point)
public static java.awt.Rectangle getMaxWindowBounds(java.awt.Component component)
public static java.awt.Rectangle getMaxWindowBounds()
public static java.awt.Rectangle getZeroBasedMaxBounds()
public static java.awt.Rectangle getUnionOfBounds()
public static java.awt.Image createBlankImage(int width, int height)
public static void fix(java.awt.Scrollbar sb)
public static boolean showCompositeAdvisory(ImagePlus imp, java.lang.String title)
public static void scale(java.awt.Component component)
Prefs.getGuiScale()
.component
- the AWT component to be scaled. If a container, scaling is applied to all its child componentspublic static void scalePopupMenu(java.awt.PopupMenu popup)
public static boolean scale(javax.swing.JComponent component)
#getGuiScale()
.
This is mainly relevant to linux: Swing components scale automatically on most platforms, specially since Java 8. However there are still exceptions to this on linux: e.g., In Ubuntu, Swing components do scale, but only under the GTK L&F. (On the other hand AWT components do not scale at all on hiDPI screens on linux).
This method tries to avoid exaggerated font sizes by detecting if a component
has been already scaled by the UIManager, applying only
#getGuiScale()
to the component's font if not.
component
- the component to be scaledpublic static final void fixScrollbar(java.awt.Scrollbar sb)