Class DefaultUIAwareIcon

java.lang.Object
com.github.weisj.darklaf.icons.DefaultUIAwareIcon
All Implemented Interfaces:
DynamicIcon, UIAwareIcon, Icon
Direct Known Subclasses:
LazyUIAwareIcon, SimpleUIAwareIcon

public abstract class DefaultUIAwareIcon extends Object implements UIAwareIcon
Default base implementation for UIAwareIcon. The specific loading mechanism needs to be implemented in the subclass.
  • Field Details

    • light

      protected Icon light
    • dark

      protected Icon dark
  • Constructor Details

    • DefaultUIAwareIcon

      public DefaultUIAwareIcon()
    • DefaultUIAwareIcon

      protected DefaultUIAwareIcon(DefaultUIAwareIcon dual)
  • Method Details

    • createDual

      protected abstract UIAwareIcon createDual()
    • getDual

      public UIAwareIcon 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.
    • loadLightIcon

      protected abstract Icon loadLightIcon()
      Load the light version of the icon. This method should never return a null value.
      Returns:
      the light icon.
    • loadDarkIcon

      protected abstract Icon loadDarkIcon()
      Load the dark version of the icon. This method should never return a null value.
      Returns:
      the dark icon.
    • paintIcon

      public void paintIcon(Component c, Graphics g, int x, int y)
      Specified by:
      paintIcon in interface Icon
    • getIconWidth

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

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