Class PainterIcon

java.lang.Object
org.jdesktop.swingx.icon.PainterIcon
All Implemented Interfaces:
Icon, SwingConstants, JXIcon, SizingConstants

public class PainterIcon extends Object implements JXIcon
Impelmentation of JXIcon interface
Author:
EUG https://github.com/homebeaver (rotation + point/axis reflection)
  • Constructor Details

    • PainterIcon

      public PainterIcon(int width, int height)
    • PainterIcon

      public PainterIcon(Dimension size)
  • Method Details

    • setReflection

      public void setReflection(boolean horizontal, boolean vertical)
      A hint for point/axis reflection (mirroring) the icon when painting.

      setReflection(true, true) means point reflection

      Specified by:
      setReflection in interface JXIcon
      Parameters:
      horizontal - will mirror the icon horizontal (X axis)
      vertical - will mirror the icon vertical (Y axis)
    • isReflection

      public boolean isReflection()
      override the default defined in JXIcon (no reflection)
      Specified by:
      isReflection in interface JXIcon
      Returns:
      true if there is any reflection, point reflection or mirroring
    • setRotation

      public void setRotation(double theta)
      A hint to rotate the icon when painting
      Specified by:
      setRotation in interface JXIcon
      Parameters:
      theta - the angle of rotation in radians, zero means no rotation
    • getRotation

      public double getRotation()
      override the constant default (no rotation) defined in JXIcon
      Specified by:
      getRotation in interface JXIcon
      Returns:
      the angle of rotation in radians
    • getPainter

      public Painter<? extends Component> getPainter()
    • setPainter

      public void setPainter(Painter<? extends Component> painter)
    • paintIcon

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

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

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