Names for JavaFX Standard Colors : Color « JavaFX « Java

Home
Java
1.2D Graphics GUI
2.3D
3.Advanced Graphics
4.Ant
5.Apache Common
6.Chart
7.Class
8.Collections Data Structure
9.Data Type
10.Database SQL JDBC
11.Design Pattern
12.Development Class
13.EJB3
14.Email
15.Event
16.File Input Output
17.Game
18.Generics
19.GWT
20.Hibernate
21.I18N
22.J2EE
23.J2ME
24.JavaFX
25.JDK 6
26.JNDI LDAP
27.JPA
28.JSP
29.JSTL
30.Language Basics
31.Network Protocol
32.PDF RTF
33.Reflection
34.Regular Expressions
35.Scripting
36.Security
37.Servlets
38.Spring
39.Swing Components
40.Swing JFC
41.SWT JFace Eclipse
42.Threads
43.Tiny Application
44.Velocity
45.Web Services SOA
46.XML
Java » JavaFX » Color 
Names for JavaFX Standard Colors
 

import java.lang.reflect.Field;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.ScrollPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class Main extends Application {
  @Override
  public void start(final Stage stagethrows Exception {
    final Group rootGroup = new Group();
    final Scene scene = new Scene(rootGroup, 700725, Color.WHITE);
    final ScrollPane scrollPane = new ScrollPane();
    scrollPane.setPrefWidth(scene.getWidth());
    scrollPane.setPrefHeight(scene.getHeight());

    final Field[] fields = Color.class.getFields()// only want public
    for (final Field field : fields) {
      if (field.getType() == Color.class) {
        try {
          final Color color = (Colorfield.get(null);
          final String colorName = field.getName();
          System.out.println(colorName);
        catch (IllegalAccessException illegalAccessEx) {
          System.out.println("Securty Manager does not allow access of field '"
              + field.getName() "'.");
        }
      }
    }
    rootGroup.getChildren().add(scrollPane);
    stage.setScene(scene);
    stage.show();
  }

  public static void main(final String[] arguments) {
    Application.launch(arguments);
  }
}

   
  
Related examples in the same category
1.Create Color from R G B value
2.Color.DARKBLUE
3.Create color from web value
4.Color.TRANSPARENT
5.Set Rectangle Stroke to Color.BLACK
6.Using Color constant
7.standard constructor, use 0->1.0 values, explicit alpha of 1.0
8.use 0->1.0 values. implicit alpha of 1.0
9.use 0->1.0 values, explicit alpha of 1.0
10.use 0->255 integers, implict alpha of 1.0
11.use 0->255 integers, explict alpha of 1.0
12.hue = 270, saturation & value = 1.0. inplict alpha of 1.0
13.hue = 270, saturation & value = 1.0, explict alpha of 1.0
14.blue as a hex web value, explict alpha
15.blue as a hex web value, implict alpha
16.Color as hex web value
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.