Class RMColorStopPicker

All Implemented Interfaces:
DropTargetListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible

public class RMColorStopPicker extends JPanel implements DropTargetListener
A multi-stop gradient inspector.
See Also:
  • Field Details

  • Constructor Details

    • RMColorStopPicker

      public RMColorStopPicker()
      Creates new RMColorStopPicker.
  • Method Details

    • getGradient

      public RMGradientFill getGradient()
      Return picker gradient.
    • setGradient

      public void setGradient(RMGradientFill aGradient)
      Set picker gradient.
    • getKnobImage

      public Image getKnobImage(boolean isHilighted)
    • findKnobIndex

      public int findKnobIndex(Point pt)
    • selectStop

      public void selectStop(int index)
    • getStopPosition

      public float getStopPosition(Point pt)
      Given a mouse point within gradient rectangle, returns corresponding position in gradient (0 at left of gradient, 1 at right).
    • getGradientCoordinate

      public float getGradientCoordinate(int stopIndex)
      Given a stop index, returns the corresponding x coordinate in the gradient rectangle.
    • addColorStop

      public int addColorStop(Point pt)
      create an explicit stop at the corresponding gradient position.
    • adjustColorStop

      public void adjustColorStop(int index, Point pt)
      Move the selected stop to the new position.
    • resetComponents

      public void resetComponents()
      Called whenever the gradient is reset or a stop is added or removed. Lays out all the color wells, the knob images, and the gradient rect.
    • colorWellChanged

      protected void colorWellChanged(RJColorWell aWell)
      Called when a color well changes.
    • deleteColorStop

      public void deleteColorStop()
      Called when a ColorStop is deleted.
    • paintComponent

      public void paintComponent(Graphics g)
      Paint Component.
      Overrides:
      paintComponent in class JComponent
    • getBackgroundTexture

      public TexturePaint getBackgroundTexture()
      Creates & returns a texture to be used for the background of transparent gradients
    • getCustomCursor

      public Cursor getCustomCursor(boolean inGradientRect)
    • dragEnter

      public void dragEnter(DropTargetDragEvent dtde)
      DropTargetListener method.
      Specified by:
      dragEnter in interface DropTargetListener
    • checkDrag

      public void checkDrag(Point pt)
    • dragExit

      public void dragExit(DropTargetEvent dte)
      DropTargetListener method.
      Specified by:
      dragExit in interface DropTargetListener
    • dragOver

      public void dragOver(DropTargetDragEvent dtde)
      DropTargetListener method.
      Specified by:
      dragOver in interface DropTargetListener
    • dropActionChanged

      public void dropActionChanged(DropTargetDragEvent dtde)
      DropTargetListener method.
      Specified by:
      dropActionChanged in interface DropTargetListener
    • drop

      public void drop(DropTargetDropEvent dtde)
      DropTargetListener method.
      Specified by:
      drop in interface DropTargetListener