Package com.ribs.plus

Class RJColorDock

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

public class RJColorDock extends RJColorWell
A ColorWell subclass that handle a whole grid of color swatches, including drag and drop support.
See Also:
  • Constructor Details

    • RJColorDock

      public RJColorDock()
      Creates a new color dock.
  • Method Details

    • isPersistent

      public boolean isPersistent()
      Returns whether this doc writes itself out to preferences.
    • setPersistent

      public void setPersistent(boolean aFlag)
      Sets whether this dock writes itself out to preferences.
    • getSwatchSize

      public Dimension getSwatchSize()
      Returns the size of individual color swatches.
    • setSwatchSize

      public void setSwatchSize(Dimension aSize)
      Sets the size of the individual color swatches.
    • getColor

      public Color getColor(int aRow, int aCol)
      Returns the color at the given row & column.
    • setColor

      public void setColor(Color aColor, int anIndex)
      Sets the color at the given swatch index.
    • setColor

      public void setColor(Color aColor, int aRow, int aCol)
      Sets the color at the given row & column.
    • getColor

      public Color getColor(Point aPoint)
      Returns the color at the mouse location within the component.
    • resetColors

      public void resetColors()
      Resets the colors in colordock to white.
    • getRow

      public int getRow(Point aPoint)
      Returns the row for the given y coordinate.
    • getColumn

      public int getColumn(Point aPoint)
      Returns the column for the given x coordinate.
    • getRowCount

      public int getRowCount()
      Returns the number of rows in this color dock.
    • getColumnCount

      public int getColumnCount()
      Returns the number of columns in this color dock.
    • getSwatchCount

      public int getSwatchCount()
      Returns the total number of visible swatches.
    • getSelectedIndex

      public int getSelectedIndex()
      Returns the selected index.
    • getSwatchIndex

      public int getSwatchIndex(Point aPoint)
      Returns the swatch index for given point.
    • setSelectedPoint

      public void setSelectedPoint(Point aPoint)
      Sets the selected point.
    • setSelected

      public void setSelected(boolean select)
      Overrides colorwell to reset selected point.
      Overrides:
      setSelected in class RJColorWell
    • resetBorder

      public void resetBorder()
      Overridden from colorwell to use a lowered-bevel border.
      Overrides:
      resetBorder in class RJColorWell
    • paintComponent

      public void paintComponent(Graphics g)
      Paints this color dock component.
      Overrides:
      paintComponent in class RJColorWell
    • saveToPreferences

      public void saveToPreferences(String aName, int aRow, int aColumn)
      Update an individual color at {row,column} in the preferences
    • readFromPreferences

      public void readFromPreferences(String aName)
      Read color well color from preferences.
    • dragEnter

      public void dragEnter(DropTargetDragEvent dtde)
      DropTargetListener method.
      Specified by:
      dragEnter in interface DropTargetListener
      Overrides:
      dragEnter in class RJColorWell
    • dragOver

      public void dragOver(DropTargetDragEvent dtde)
      DropTargetListener method.
      Specified by:
      dragOver in interface DropTargetListener
      Overrides:
      dragOver in class RJColorWell
    • dragExit

      public void dragExit(DropTargetEvent dte)
      DropTargetListener method.
      Specified by:
      dragExit in interface DropTargetListener
      Overrides:
      dragExit in class RJColorWell
    • drop

      public void drop(DropTargetDropEvent dtde)
      DropTargetListener method.
      Specified by:
      drop in interface DropTargetListener
      Overrides:
      drop in class RJColorWell
    • dropColor

      public void dropColor(Color aColor, Point aPoint)
      DropTargetListener method.
      Overrides:
      dropColor in class RJColorWell