Class ShapeIcon

java.lang.Object
org.opensourcephysics.cabrillo.tracker.ShapeIcon
All Implemented Interfaces:
Icon

public class ShapeIcon extends Object implements Icon
This Icon centers and fills the shape specified in its constructor.
Author:
Douglas Brown
  • Constructor Details

    • ShapeIcon

      public ShapeIcon(org.opensourcephysics.cabrillo.tracker.MultiShape shape, org.opensourcephysics.cabrillo.tracker.MultiShape decoration, int width, int height)
      Constructs a ShapeIcon.
      Parameters:
      shape - the shape to draw
      decoration - a decorating shape to draw
      width - width of the icon
      height - height of the icon
    • ShapeIcon

      public ShapeIcon(org.opensourcephysics.cabrillo.tracker.MultiShape shape, int width, int height)
      Constructs a ShapeIcon.
      Parameters:
      shape - the shape to draw
      width - width of the icon
      height - height of the icon
  • Method Details

    • setColor

      public void setColor(Color color)
      Sets the color.
      Parameters:
      color - the desired color
    • setColor

      public void setColor(Color color, Color decorationColor)
      Sets the colors.
      Parameters:
      color - the desired color
      decorationColor - the desired decoration color
    • setStroke

      public void setStroke(BasicStroke stroke)
      Sets the stroke.
      Parameters:
      stroke -
    • getIconWidth

      public int getIconWidth()
      Gets the icon width.
      Specified by:
      getIconWidth in interface Icon
      Returns:
      the icon width
    • getIconHeight

      public int getIconHeight()
      Gets the icon height.
      Specified by:
      getIconHeight in interface Icon
      Returns:
      the icon height
    • paintIcon

      public void paintIcon(Component c, Graphics _g, int x, int y)
      Paints the icon.
      Specified by:
      paintIcon in interface Icon
      Parameters:
      c - the component on which it is painted
      _g - the graphics context
      x - the x coordinate of the icon
      y - the y coordinate of the icon