Class UiUtil


  • public class UiUtil
    extends java.lang.Object
    This class contains methods that deal with global properties of the installer application GUI.

    When running in console or unattended mode, these methods can still be called, although they may not have any effect or return any helpful information.

    • Constructor Summary

      Constructors 
      Constructor Description
      UiUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static LookAndFeelEnhancer getLookAndFeelEnhancer()
      Returns the currently active look and feel info.
      static java.awt.Window getParentWindow()
      Get the window of the installer application.
      static boolean isDarkDesktop()
      Returns if the desktop environment is in dark mode or not.
      static boolean isDarkUi()
      Returns if the installer application is running in dark mode or not.
      static void setDarkUi​(boolean dark)
      Switch between dark and light mode and update all windows with the new mode.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • UiUtil

        public UiUtil()
    • Method Detail

      • isDarkDesktop

        public static boolean isDarkDesktop()
        Returns if the desktop environment is in dark mode or not.

        To check whether the installer application is running with a dark look and feel, you should call isDarkUi() instead. If you have selected the FlatLaf look and feel for installer applications with dark mode auto-detection enabled, both methods will return the same value.

      • isDarkUi

        public static boolean isDarkUi()
        Returns if the installer application is running in dark mode or not.

        This is a convenience method for calling

        
          LookAndFeelEnhancer.getInstance().isDark()
        
        See Also:
        LookAndFeelEnhancer.isDark()
      • setDarkUi

        public static void setDarkUi​(boolean dark)
        Switch between dark and light mode and update all windows with the new mode.

        This will only have an effect if LookAndFeelEnhancer.isDarkModeSwitchingSupported() returns true and if the installer application is running in GUI mode.

        Parameters:
        dark - true for dark mode
      • getLookAndFeelEnhancer

        @NotNull
        public static LookAndFeelEnhancer getLookAndFeelEnhancer()
        Returns the currently active look and feel info.
      • getParentWindow

        public static java.awt.Window getParentWindow()
        Get the window of the installer application.
        Returns:
        the window or null if the installer application is running in console or unattended mode.