Package ij.gui

Class GUI


  • public class GUI
    extends Object
    This class consists of static GUI utility methods.
    • Constructor Detail

      • GUI

        public GUI()
    • Method Detail

      • center

        public static void center​(Window win)
        Positions the specified window in the center of the screen.
      • getMaxWindowBounds

        public static Rectangle getMaxWindowBounds()
      • getZeroBasedMaxBounds

        public static Rectangle getZeroBasedMaxBounds()
      • getUnionOfBounds

        public static Rectangle getUnionOfBounds()
      • createBlankImage

        public static Image createBlankImage​(int width,
                                             int height)
        Creates a white AWT Image image of the specified size.
      • fix

        public static void fix​(Scrollbar sb)
        Lightens overly dark scrollbar background on Windows 8.
      • showCompositeAdvisory

        public static boolean showCompositeAdvisory​(ImagePlus imp,
                                                    String title)
      • scale

        public static void scale​(Component component)
        Scales an AWT component according to Prefs.getGuiScale().
        Parameters:
        component - the AWT component to be scaled. If a container, scaling is applied to all its child components
      • scalePopupMenu

        public static void scalePopupMenu​(PopupMenu popup)
      • scale

        public static boolean scale​(JComponent component)
        Tries to detect if a Swing component is unscaled and scales it it according to #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.

        Parameters:
        component - the component to be scaled
        Returns:
        true, if component's font was resized