1. /*
  2. * @(#)ColorSelectionModel.java 1.10 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.colorchooser;
  8. import javax.swing.*;
  9. import javax.swing.event.*;
  10. import java.awt.Color;
  11. /**
  12. * A model that supports selecting a <code>Color</code>.
  13. *
  14. * @version 1.10 01/23/03
  15. * @author Steve Wilson
  16. *
  17. * @see java.awt.Color
  18. */
  19. public interface ColorSelectionModel {
  20. /**
  21. * Returns the selected <code>Color</code> which should be
  22. * non-<code>null</code>.
  23. *
  24. * @return the selected <code>Color</code>
  25. * @see #setSelectedColor
  26. */
  27. Color getSelectedColor();
  28. /**
  29. * Sets the selected color to <code>color</code>.
  30. * Note that setting the color to <code>null</code>
  31. * is undefined and may have unpredictable results.
  32. * This method fires a state changed event if it sets the
  33. * current color to a new non-<code>null</code> color.
  34. *
  35. * @param color the new <code>Color</code>
  36. * @see #getSelectedColor
  37. * @see #addChangeListener
  38. */
  39. void setSelectedColor(Color color);
  40. /**
  41. * Adds <code>listener</code> as a listener to changes in the model.
  42. * @param listener the <code>ChangeListener</code> to be added
  43. */
  44. void addChangeListener(ChangeListener listener);
  45. /**
  46. * Removes <code>listener</code> as a listener to changes in the model.
  47. * @param listener the <code>ChangeListener</code> to be removed
  48. */
  49. void removeChangeListener(ChangeListener listener);
  50. }