Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>In my opinion there is no native way to obtain that. I just check <a href="http://docs.oracle.com/javafx/2/api/javafx/scene/paint/Color.html" rel="nofollow">the Color API</a> and seems there isn't any function that gives you the default colors. But you can get them obtaining all the fields through reflection. Here I show you a sample:</p> <pre><code>private static List&lt;Color&gt; allColors() throws ClassNotFoundException, IllegalAccessException { List&lt;Color&gt; colors = new ArrayList&lt;&gt;(); Class clazz = Class.forName("javafx.scene.paint.Color"); if (clazz != null) { Field[] field = clazz.getFields(); for (int i = 0; i &lt; field.length; i++) { Field f = field[i]; Object obj = f.get(null); if(obj instanceof Color){ colors.add((Color) obj); } } } return colors; } </code></pre> <p>Also if you want the name of the color you could retrieve it from the Field information in the moment of the extraction. And for example you can return a map with the information of the name and the color as shown above:</p> <pre><code>private static Map&lt;String, Color&gt; allColorsWithName() throws ClassNotFoundException, IllegalAccessException { Map&lt;String, Color&gt; map = new HashMap&lt;&gt;(); Class clazz = Class.forName("javafx.scene.paint.Color"); if (clazz != null) { Field[] field = clazz.getFields(); for (int i = 0; i &lt; field.length; i++) { Field f = field[i]; Object obj = f.get(null); if(obj instanceof Color){ map.put(f.getName(), (Color) obj); } } } return map; } </code></pre> <p>Hope it helps.</p>
    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.
    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