Java Code Examples for javafx.scene.paint.Color#valueOf()

The following examples show how to use javafx.scene.paint.Color#valueOf() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ConfigParser.java    From LogFX with GNU General Public License v3.0 6 votes vote down vote up
private void parseStandardLogColors( Iterator<String> lines ) {
    while ( lines.hasNext() ) {
        String line = lines.next();
        if ( line.startsWith( " " ) ) {
            String[] components = line.trim().split( " " );
            if ( components.length == 2 ) {
                try {
                    Color bkg = Color.valueOf( components[ 0 ] );
                    Color fill = Color.valueOf( components[ 1 ] );
                    properties.standardLogColors.set( new LogLineColors( bkg, fill ) );
                } catch ( IllegalArgumentException e ) {
                    logInvalidProperty( "standard-log-colors", "color", line, e.toString() );
                }
            } else {
                logInvalidProperty( "standard-log-colors", "number of colors", line, null );
            }
        } else if ( !line.trim().isEmpty() ) {
            parseConfigFile( line, lines );
            break;
        }
    }
}
 
Example 2
Source File: TopicInfoPublicationSubscription.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
 public void load(SubProperties properties) {
     name.setValue(properties.getProperty(".name"));
     page = properties.getProperty(".page", null);
     topic = properties.getProperty(".topic", null);
     topicpub = properties.getProperty(".topicpub", null);
     format = EditNodeFormat.valueOf(properties.getProperty(".format", EditNodeFormat.STRING.name()));
     jsonpath = properties.getProperty(".jsonpath", null);
     multiline = Boolean.parseBoolean(properties.getProperty(".multiline", "false"));
     String c = properties.getProperty(".color", null);
     color = c == null ? null : Color.valueOf(c);
     c = properties.getProperty(".background", null);
     background = c == null ? null : Color.valueOf(c);    
     qos = Integer.parseInt(properties.getProperty(".qos", "0"));
     retained = Boolean.parseBoolean(properties.getProperty(".retained", "false"));
}
 
Example 3
Source File: TopicInfoGauge.java    From helloiot with GNU General Public License v3.0 6 votes vote down vote up
@Override
 public void load(SubProperties properties) {
     name.setValue(properties.getProperty(".name"));
     page = properties.getProperty(".page", null);
     topic = properties.getProperty(".topic", null);
     jsonpath = properties.getProperty(".jsonpath", null);
     format = GaugeNodeFormat.valueOf(properties.getProperty(".format", GaugeNodeFormat.LONG.name()));
     gaugetype = GaugeType.valueOf(properties.getProperty(".gaugetype", GaugeType.BASIC.name()));
     min = properties.getProperty(".min", "0");
     max = properties.getProperty(".max", "100");
     String bc = properties.getProperty(".barcolor", null);
     barcolor = bc == null ? null : Color.valueOf(bc);
     String c = properties.getProperty(".color", null);
     color = c == null ? null : Color.valueOf(c);
     c = properties.getProperty(".background", null);
     background = c == null ? null : Color.valueOf(c);    
     qos = Integer.parseInt(properties.getProperty(".qos", "0"));
     retained = Boolean.parseBoolean(properties.getProperty(".retained", "false"));
}
 
Example 4
Source File: TextTreeItem.java    From PDF4Teachers with Apache License 2.0 5 votes vote down vote up
public static TreeItem<String> readYAMLDataAndGive(HashMap<String, Object> data, int type){

		double fontSize = Config.getDouble(data, "size");
		boolean isBold = Config.getBoolean(data, "bold");
		boolean isItalic = Config.getBoolean(data, "italic");
		String fontName = Config.getString(data, "font");
		Color color = Color.valueOf(Config.getString(data, "color"));
		long uses = Config.getLong(data, "uses");
		long creationDate = Config.getLong(data, "date");
		String text = Config.getString(data, "text");

		Font font = FontUtils.getFont(fontName, isItalic, isBold, (int) fontSize);

		return new TextTreeItem(font, text, color, type, uses, creationDate);
	}
 
Example 5
Source File: UIPropertyContext.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Color getColor(String key)
{
	String prop = getProperty(key);
	if (prop == null)
	{
		Logging.debugPrint("null color for " + key);
		return null;
	}

	Logging.debugPrint("color for " + key + " = " + prop);
	return Color.valueOf(prop);
}
 
Example 6
Source File: ToggleButtonDemo.java    From JFoenix with Apache License 2.0 5 votes vote down vote up
@Override
public void start(Stage stage) throws Exception {

    final VBox pane = new VBox();
    pane.setSpacing(30);
    pane.setStyle("-fx-background-color:#EEE; -fx-padding: 40;");

    ToggleButton button = new ToggleButton("JavaFx Toggle");
    pane.getChildren().add(button);

    JFXToggleButton toggleButton = new JFXToggleButton();
    toggleButton.setText("New Skin");
    pane.getChildren().add(toggleButton);

    JFXToggleNode node = new JFXToggleNode();
    node.setStyle("-fx-padding: 10");
    node.setGraphic(new FontIcon(FontAwesomeSolid.HEART));

    pane.getChildren().add(node);


    final Scene scene = new Scene(pane, 600, 400, Color.valueOf("#EEE"));
    stage.setTitle("JFX Toggle Button Demo ");
    scene.getStylesheets()
        .add(ToggleButtonDemo.class.getResource("/css/jfoenix-components.css").toExternalForm());
    stage.setScene(scene);
    stage.setResizable(false);
    stage.show();


}
 
Example 7
Source File: UIPropertyContext.java    From pcgen with GNU Lesser General Public License v2.1 5 votes vote down vote up
private Color getColor(String key)
{
	String prop = getProperty(key);
	if (prop == null)
	{
		Logging.debugPrint("null color for " + key);
		return null;
	}

	Logging.debugPrint("color for " + key + " = " + prop);
	return Color.valueOf(prop);
}
 
Example 8
Source File: BreakoutFactory.java    From FXGLGames with MIT License 5 votes vote down vote up
@Spawns("brick")
public Entity newBrick(SpawnData data) {
    var color = Color.valueOf(data.<String>get("color").toUpperCase());

    return entityBuilder()
            .from(data)
            .type(BRICK)
            .bbox(new HitBox(BoundingShape.box(96, 32)))
            .collidable()
            .with(new PhysicsComponent())
            .with(new BrickComponent(color))
            .build();
}
 
Example 9
Source File: IconColor.java    From helloiot with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Node buildIcon(StringFormat format, byte[] value) {
    Color  c;   
    try {
        c = Color.valueOf(format.value(value).asString());    
    } catch (Exception e) {
        c = Color.BLACK;
    }
    return IconBuilder.create(icon, 48.0).color(c).build();
}
 
Example 10
Source File: FontIcon.java    From ikonli with Apache License 2.0 5 votes vote down vote up
private static Paint resolvePaintValue(String iconCode, String value) {
    try { return Color.valueOf(value); } catch (IllegalArgumentException e1) {
        try { return LinearGradient.valueOf(value); } catch (IllegalArgumentException e2) {
            try { return RadialGradient.valueOf(value); } catch (IllegalArgumentException e3) {
                throw invalidDescription(iconCode, e3);
            }
        }
    }
}
 
Example 11
Source File: TextElement.java    From PDF4Teachers with Apache License 2.0 5 votes vote down vote up
public static TextElement readYAMLDataAndGive(HashMap<String, Object> data, boolean hasPage, int page){

		int x = (int) Config.getLong(data, "x");
		int y = (int) Config.getLong(data, "y");
		double fontSize = Config.getDouble(data, "size");
		boolean isBold = Config.getBoolean(data, "bold");
		boolean isItalic = Config.getBoolean(data, "italic");
		String fontName = Config.getString(data, "font");
		Color color = Color.valueOf(Config.getString(data, "color"));
		String text = Config.getString(data, "text");

		Font font = FontUtils.getFont(fontName, isItalic, isBold, (int) fontSize);
		return new TextElement(x, y, page, font, text, color, hasPage);
	}
 
Example 12
Source File: TextListItem.java    From PDF4Teachers with Apache License 2.0 5 votes vote down vote up
public static TextListItem readYAMLDataAndGive(HashMap<String, Object> data){

        double fontSize = Config.getDouble(data, "size");
        boolean isBold = Config.getBoolean(data, "bold");
        boolean isItalic = Config.getBoolean(data, "italic");
        String fontName = Config.getString(data, "font");
        Color color = Color.valueOf(Config.getString(data, "color"));
        long uses = Config.getLong(data, "uses");
        long creationDate = Config.getLong(data, "date");
        String text = Config.getString(data, "text");

        Font font = FontUtils.getFont(fontName, isItalic, isBold, (int) fontSize);

        return new TextListItem(font, text, color, uses, creationDate);
    }
 
Example 13
Source File: JFXToggleButton.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public Paint getUnToggleLineColor() {
    return untoggleLineColor == null ? Color.valueOf("#999999") : untoggleLineColor.get();
}
 
Example 14
Source File: JFXToggleButton.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public Paint getToggleLineColor() {
    return toggleLineColor == null ? Color.valueOf("#77C2BB") : toggleLineColor.get();
}
 
Example 15
Source File: UIPropertyContext.java    From pcgen with GNU Lesser General Public License v2.1 4 votes vote down vote up
private Color initColor(String key, Color defaultValue)
{
	String prop = initProperty(key, ColorUtilty.colorToRGBString(defaultValue));
	Logging.debugPrint("init color " + key + " to " + prop);
	return Color.valueOf(prop);
}
 
Example 16
Source File: JFXToggleButton.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public Paint getUnToggleColor() {
    return untoggleColor == null ? Color.valueOf("#FAFAFA") : untoggleColor.get();
}
 
Example 17
Source File: JFXTimePicker.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public Paint getDefaultColor() {
    return defaultColor == null ? Color.valueOf("#009688") : defaultColor.get();
}
 
Example 18
Source File: JFXTextField.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
@Override
public Paint getFocusColor() {
    return focusColor == null ? Color.valueOf("#4059A9") : focusColor.get();
}
 
Example 19
Source File: JFXTextArea.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public Paint getFocusColor() {
    return focusColor == null ? Color.valueOf("#4059A9") : focusColor.get();
}
 
Example 20
Source File: JFXDatePicker.java    From JFoenix with Apache License 2.0 4 votes vote down vote up
public Paint getDefaultColor() {
    return defaultColor == null ? Color.valueOf("#009688") : defaultColor.get();
}