Class RJColorWell

All Implemented Interfaces:
DropTargetListener, ImageObserver, MenuContainer, Serializable, EventListener, Accessible
Direct Known Subclasses:
RJColorDock

public class RJColorWell extends JPanel implements DropTargetListener
This Swing control class displays a color value and kicks off the ColorPanel when clicked.
See Also:
  • Constructor Details

    • RJColorWell

      public RJColorWell()
      Creates a new color well for editing a specific color attribute (fill, stroke, text).
  • Method Details

    • getColor

      public Color getColor()
      Returns the color represented by this color well.
    • setColor

      public void setColor(Color aColor)
      Sets the color represented by this color well.
    • isSelected

      public boolean isSelected()
      Returns whether color well is selected.
    • setSelected

      public void setSelected(boolean aValue)
      Sets whether color well is selected.
    • isSelectable

      public boolean isSelectable()
      Returns whether or not the well can be selected.
    • setSelectable

      public void setSelectable(boolean flag)
      Sets whether or not the well can be selected.
    • setEnabled

      public void setEnabled(boolean enableIt)
      This just makes sure that any colorwell that is disabled is also deselected
      Overrides:
      setEnabled in class JComponent
    • resetBorder

      public void resetBorder()
      Set the border given the current selection state.
    • paintComponent

      public void paintComponent(Graphics g)
      Paints the color well.
      Overrides:
      paintComponent in class JComponent
    • paintSwatch

      public static void paintSwatch(Graphics g, Color c, int x, int y, int w, int h)
      Paints a color swatch in a standard way. Used to paint color wells, drag images, and color docks.
    • processMouseEvent

      protected void processMouseEvent(MouseEvent e)
      Calls mouse methods.
      Overrides:
      processMouseEvent in class JComponent
    • mousePressed

      protected void mousePressed(MouseEvent e)
      Mouse pressed.
    • mouseReleased

      protected void mouseReleased(MouseEvent e)
      Mouse released.
    • mouseClicked

      protected void mouseClicked(MouseEvent e)
      Mouse clicked.
    • getColorTransfer

      public Transferable getColorTransfer()
      Returns a transferable with this well's color.
    • getDragImage

      public Image getDragImage(Dimension d)
      Returns an image with a swatch of this well's color.
    • addChangeListener

      public void addChangeListener(ChangeListener l)
      Adds an action listener to the color well.
    • removeActionListener

      public void removeActionListener(ActionListener l)
      Removes given action listener from the color well.
    • getColorDataFlavor

      public static DataFlavor getColorDataFlavor()
      Returns a DataFlavor object which represents colors for Drag & Drop.
    • dragEnter

      public void dragEnter(DropTargetDragEvent dtde)
      DropTargetListener method.
      Specified by:
      dragEnter in interface DropTargetListener
    • 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
    • dropColor

      public void dropColor(Color aColor, Point aPoint)
      Called when a valid color has been dropped.