Class DarkUIAwareIcon

    • Field Detail

      • darkKey

        protected final String darkKey
      • lightKey

        protected final String lightKey
      • w

        protected final int w
      • h

        protected final int h
      • parentClass

        protected final Class<?> parentClass
      • loaded

        protected transient boolean loaded
      • icon

        protected transient Icon icon
    • Constructor Detail

      • DarkUIAwareIcon

        public DarkUIAwareIcon​(String darkKey,
                               String lightKey,
                               int w,
                               int h,
                               Class<?> parentClass)
        Create new ui aware icon.
        Parameters:
        darkKey - key to load icon for dark mode.
        lightKey - key to load icon for light mode.
        w - width of icon.
        h - height of icon.
        parentClass - the class to resolve the path while lazy loading.
    • Method Detail

      • paintIcon

        public void paintIcon​(Component c,
                              Graphics g2,
                              int x,
                              int y,
                              double scale)
      • ensureLoaded

        protected void ensureLoaded()
      • updateStyle

        protected void updateStyle()
      • isLoaded

        protected boolean isLoaded()
      • isDark

        public boolean isDark()
      • loadIcon

        protected void loadIcon()
      • getIconWidth

        public int getIconWidth()
        Specified by:
        getIconWidth in interface Icon
      • getIconHeight

        public int getIconHeight()
        Specified by:
        getIconHeight in interface Icon
      • getDual

        public DarkUIAwareIcon getDual()
        Description copied from interface: UIAwareIcon
        Return the dual version of the icon. i.e. if the current icon is light then the dual version will be dark and vice versa. Implementations of this method should respect that the appearance of the icon after invoking this method twice should be the same.
        Specified by:
        getDual in interface UIAwareIcon
        Returns:
        the dual icon.