Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There is a method getColor() in <a href="http://java.sun.com/javase/7/docs/api/javax/swing/JColorChooser.html" rel="nofollow noreferrer">http://java.sun.com/javase/7/docs/api/javax/swing/JColorChooser.html</a></p> <p>This returns a Color. A number of Colors have names (<a href="http://java.sun.com/javase/7/docs/api/java/awt/Color.html" rel="nofollow noreferrer">http://java.sun.com/javase/7/docs/api/java/awt/Color.html</a>) but most do not. As far as I know you will need to iteratre through the special names of colors to test whether the returned colour is one of those.</p> <p><strong>EDIT</strong> ColorChooser returns a java.awt.Color, not an RGB value. I do not know what the equals() contract for color is, but I suspect you could write:</p> <pre><code>Color c = chooser.getColor(); if (Color.BLACK.equals(c)) { // the color is black... } </code></pre> <p>The named colors are:</p> <pre><code> static Color black The color black. static Color BLACK The color black. static Color blue The color blue. static Color BLUE The color blue. static Color cyan The color cyan. static Color CYAN The color cyan. static Color DARK_GRAY The color dark gray. static Color darkGray The color dark gray. static Color gray The color gray. static Color GRAY The color gray. static Color green The color green. static Color GREEN The color green. static Color LIGHT_GRAY The color light gray. static Color lightGray The color light gray. static Color magenta The color magenta. static Color MAGENTA The color magenta. static Color orange The color orange. static Color ORANGE The color orange. static Color pink The color pink. static Color PINK The color pink. static Color red The color red. static Color RED The color red. static Color white The color white. static Color WHITE The color white. static Color yellow The color yellow. static Color YELLOW The color yellow. </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload