Java Code Examples for javafx.scene.paint.Color#RED

The following examples show how to use javafx.scene.paint.Color#RED . 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: XYPane.java    From charts with Apache License 2.0 6 votes vote down vote up
public XYPane(final Paint BACKGROUND, final int BANDS, final XYSeries<T>... SERIES) {
    getStylesheets().add(XYPane.class.getResource("chart.css").toExternalForm());
    aspectRatio        = PREFERRED_HEIGHT / PREFERRED_WIDTH;
    keepAspect         = false;
    _chartBackground   = BACKGROUND;
    listOfSeries       = FXCollections.observableArrayList(SERIES);
    scaleX             = 1;
    scaleY             = 1;
    symbolSize         = 2;
    noOfBands          = clamp(1, 5, BANDS);
    _lowerBoundX       = 0;
    _upperBoundX       = 100;
    _lowerBoundY       = 0;
    _upperBoundY       = 100;
    referenceZero      = true;
    _thresholdY        = 100;
    _thresholdYVisible = false;
    _thresholdYColor   = Color.RED;
    _polarTickStep     = PolarTickStep.FOURTY_FIVE;

    initGraphics();
    registerListeners();
}
 
Example 2
Source File: CircleSample.java    From marathonv5 with Apache License 2.0 6 votes vote down vote up
public CircleSample() {
    super(180,90);
    // Simple red filled circle
    Circle circle1 = new Circle(45,45,40, Color.RED);
    // Blue stroked circle
    Circle circle2 = new Circle(135,45,40);
    circle2.setStroke(Color.DODGERBLUE);
    circle2.setFill(null);
    // Create a group to show all the circles);
    getChildren().add(new Group(circle1,circle2));
    // REMOVE ME
    setControls(
            new SimplePropertySheet.PropDesc("Circle 1 Fill", circle1.fillProperty()),
            new SimplePropertySheet.PropDesc("Circle 1 Radius", circle1.radiusProperty(), 10d, 40d),
            new SimplePropertySheet.PropDesc("Circle 2 Stroke", circle2.strokeProperty()),
            new SimplePropertySheet.PropDesc("Circle 2 Stroke Width", circle2.strokeWidthProperty(), 1d, 5d),
            new SimplePropertySheet.PropDesc("Circle 2 Radius", circle2.radiusProperty(), 10d, 40d)
    );
    // END REMOVE ME
}
 
Example 3
Source File: GameToken.java    From metastone with GNU General Public License v2.0 5 votes vote down vote up
protected void setScoreValueLowerIsBetter(Group group, int value, int baseValue) {
	Color color = Color.WHITE;
	if (value < baseValue) {
		color = Color.GREEN;
	} else if (value > baseValue) {
		color = Color.RED;
	}
	DigitFactory.showPreRenderedDigits(group, value, color);
}
 
Example 4
Source File: FoodView.java    From narjillos with MIT License 5 votes vote down vote up
public FoodView(FoodPellet food) {
	super(food);

	roundObjectView = new RoundObjectView(Configuration.FOOD_RADIUS) {

		@Override
		public Node toNode(double zoomLevel, boolean infraredOn, boolean effectsOn) {
			if (zoomLevel < MINIMUM_ZOOM_LEVEL)
				return null;

			getShape().setFill(getColor(infraredOn));

			if (infraredOn) {
				getShape().setStroke(Color.WHITE);
				getShape().setStrokeWidth(3);
			} else {
				getShape().setStrokeWidth(0);
			}

			if (effectsOn)
				getShape().setEffect(getEffects(zoomLevel, infraredOn));

			return getShape();
		}

		private Color getColor(boolean infraredOn) {
			if (infraredOn)
				return Color.RED;
			return Color.BROWN;
		}
	};
	roundObjectView.moveTo(food.getPosition());
}
 
Example 5
Source File: TargetEditorController.java    From ShootOFF with GNU General Public License v3.0 5 votes vote down vote up
public static Color createColor(final String name) {
	switch (name) {
	case "black":
		return Color.BLACK;
	case "blue":
		return Color.BLUE;
	case "brown":
		return Color.SADDLEBROWN;
	case "gray":
		return DARK_GRAY;
	case "green":
		return Color.GREEN;
	case "orange":
		return Color.ORANGE;
	case "red":
		return Color.RED;
	case "white":
		return Color.WHITE;
	default:
		if (name.startsWith("#")) {
			try {
				return Color.web(name);
			} catch (IllegalArgumentException e) {
				return Color.CORNSILK;
			}
		} else {
			return Color.CORNSILK;	
		}
	}
}
 
Example 6
Source File: StopWatch.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Watch() {
    startButton = new Button(Color.web("#8cc700"), Color.web("#71a000"));
    stopButton = new Button(Color.web("#AA0000"), Color.web("#660000"));

    mainDial = new Dial(117, true, 12, 60, Color.RED, true);
    minutesDial = new Dial(30, false, 12, 60, "minutes", Color.BLACK, false);
    tenthsDial = new Dial(30, false, 12, 60, "10ths", Color.BLACK, false);

    configureBackground();
    myLayout();
    configureListeners();
    configureTimeline();
    getChildren().addAll(background, minutesDial, tenthsDial, digitalClock, mainDial, startButton, stopButton);
}
 
Example 7
Source File: InfluenceAnalysisUI.java    From SONDY with GNU General Public License v3.0 5 votes vote down vote up
public final void updateRankDistributionChart(){
    Stop[] stops = new Stop[] { new Stop(0, Color.STEELBLUE), new Stop(0.5, Color.YELLOW), new Stop(1, Color.RED)};

    rankDistributionChart.getData().clear();
    int[] rankDistribution = selectedMethod.rankedUsers.extractRankDistribution();
    XYChart.Series series = new XYChart.Series();
    for(int i = 0; i < rankDistribution.length; i++){
        series.getData().add(new XYChart.Data(i+"",rankDistribution[i]));
    }
    rankDistributionChart.getData().add(series);
}
 
Example 8
Source File: CubeSample.java    From marathonv5 with Apache License 2.0 5 votes vote down vote up
@Override public Node create3dContent() {
    Cube c = new Cube(50,Color.RED,1);
    c.rx.setAngle(45);
    c.ry.setAngle(45);
    Cube c2 = new Cube(50,Color.GREEN,1);
    c2.setTranslateX(100);
    c2.rx.setAngle(45);
    c2.ry.setAngle(45);
    Cube c3 = new Cube(50,Color.ORANGE,1);
    c3.setTranslateX(-100);
    c3.rx.setAngle(45);
    c3.ry.setAngle(45);

    animation = new Timeline();
    animation.getKeyFrames().addAll(
            new KeyFrame(Duration.ZERO,
                    new KeyValue(c.ry.angleProperty(), 0d),
                    new KeyValue(c2.rx.angleProperty(), 0d),
                    new KeyValue(c3.rz.angleProperty(), 0d)
            ),
            new KeyFrame(Duration.seconds(1),
                    new KeyValue(c.ry.angleProperty(), 360d),
                    new KeyValue(c2.rx.angleProperty(), 360d),
                    new KeyValue(c3.rz.angleProperty(), 360d)
            ));
    animation.setCycleCount(Animation.INDEFINITE);

    return new Group(c,c2,c3);
}
 
Example 9
Source File: Led.java    From JFX8CustomControls with Apache License 2.0 4 votes vote down vote up
public final Color getLedColor() {
    return null == ledColor ? Color.RED : ledColor.get();
}
 
Example 10
Source File: YChartItem.java    From charts with Apache License 2.0 4 votes vote down vote up
public YChartItem() {
    this(0, "", Color.RED, Color.TRANSPARENT, Symbol.NONE);
}
 
Example 11
Source File: MatrixSegment.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public MatrixSegment(final String CHARACTER) {
    this(CHARACTER, Color.RED);
}
 
Example 12
Source File: SingleChartTest.java    From charts with Apache License 2.0 4 votes vote down vote up
@Override public void init() {
    List<XYChartItem> xyItem1 = new ArrayList<>(NO_OF_X_VALUES);
    List<XYChartItem> xyItem2 = new ArrayList<>(NO_OF_X_VALUES);
    List<XYChartItem> xyItem3 = new ArrayList<>(NO_OF_X_VALUES);
    List<XYChartItem> xyItem4 = new ArrayList<>(NO_OF_X_VALUES);

    for (int i = 0 ; i < NO_OF_X_VALUES ; i++) {
        xyItem1.add(new XYChartItem(i, RND.nextDouble() * 12 + RND.nextDouble() * 6, "P" + i, COLORS[RND.nextInt(3)]));
        xyItem2.add(new XYChartItem(i, RND.nextDouble() * 7 + RND.nextDouble() * 3, "P" + i, COLORS[RND.nextInt(3)]));
        xyItem3.add(new XYChartItem(i, RND.nextDouble() * 3 + RND.nextDouble() * 4, "P" + i, COLORS[RND.nextInt(3)]));
        xyItem4.add(new XYChartItem(i, RND.nextDouble() * 4, "P" + i, COLORS[RND.nextInt(3)]));
    }

    xySeries1 = new XYSeries(xyItem1, ChartType.LINE, Color.rgb(255, 0, 0, 0.5), Color.RED);
    xySeries2 = new XYSeries(xyItem2, ChartType.LINE, Color.rgb(0, 255, 0, 0.5), Color.LIME);
    xySeries3 = new XYSeries(xyItem3, ChartType.LINE, Color.rgb(0, 0, 255, 0.5), Color.BLUE);
    xySeries4 = new XYSeries(xyItem4, ChartType.LINE, Color.rgb(255, 0, 255, 0.5), Color.MAGENTA);

    xySeries1.setSymbolsVisible(false);
    xySeries2.setSymbolsVisible(false);
    xySeries3.setSymbolsVisible(false);
    xySeries4.setSymbolsVisible(false);

    // XYChart
    Converter tempConverter     = new Converter(TEMPERATURE, CELSIUS); // Type Temperature with BaseUnit Celsius
    double    tempFahrenheitMin = tempConverter.convert(0, FAHRENHEIT);
    double    tempFahrenheitMax = tempConverter.convert(20, FAHRENHEIT);

    lineChartXAxisBottom = createBottomXAxis(0, NO_OF_X_VALUES, true);
    lineChartYAxisLeft   = createLeftYAxis(0, 20, true);
    lineChartYAxisRight  = createRightYAxis(tempFahrenheitMin, tempFahrenheitMax, false);
    xyChart = new XYChart<>(new XYPane(xySeries1, xySeries2, xySeries3, xySeries4),
                            lineChartYAxisLeft, lineChartYAxisRight, lineChartXAxisBottom);

    // YChart
    List<YChartItem> yItem1 = new ArrayList<>(20);
    List<YChartItem> yItem2 = new ArrayList<>(20);
    List<YChartItem> yItem3 = new ArrayList<>(20);
    for (int i = 0 ; i < 20 ; i++) {
        yItem1.add(new YChartItem(RND.nextDouble() * 100, "P" + i, COLORS[RND.nextInt(3)]));
        yItem2.add(new YChartItem(RND.nextDouble() * 100, "P" + i, COLORS[RND.nextInt(3)]));
        yItem3.add(new YChartItem(RND.nextDouble() * 100, "P" + i, COLORS[RND.nextInt(3)]));
    }

    ySeries1 = new YSeries(yItem1, ChartType.RADAR_SECTOR, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(255, 0, 0, 0.5)), new Stop(0.5, Color.rgb(255, 255, 0, 0.5)), new Stop(1.0, Color.rgb(0, 200, 0, 0.8))), Color.TRANSPARENT);
    ySeries2 = new YSeries(yItem2, ChartType.SMOOTH_RADAR_POLYGON, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(0, 255, 255, 0.5)), new Stop(1.0, Color.rgb(0, 0, 255, 0.5))), Color.TRANSPARENT);
    ySeries3 = new YSeries(yItem3, ChartType.SMOOTH_RADAR_POLYGON, new RadialGradient(0, 0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop(0.0, Color.rgb(255, 255, 0, 0.5)), new Stop(1.0, Color.rgb(255, 0, 255, 0.5))), Color.TRANSPARENT);
    yChart   = new YChart(new YPane(ySeries1, ySeries2, ySeries3));

    lastTimerCall = System.nanoTime();
    timer = new AnimationTimer() {
        @Override public void handle(final long now) {
            if (now > lastTimerCall + UPDATE_INTERVAL) {
                ObservableList<XYChartItem> xyItems = xySeries1.getItems();
                xyItems.forEach(item -> item.setY(RND.nextDouble() * 8 + RND.nextDouble() * 10));

                xyItems = xySeries2.getItems();
                xyItems.forEach(item -> item.setY(RND.nextDouble() * 4 + RND.nextDouble() * 10));

                xyItems = xySeries3.getItems();
                xyItems.forEach(item -> item.setY(RND.nextDouble() * 3 + RND.nextDouble() * 4));

                xyItems = xySeries4.getItems();
                xyItems.forEach(item -> item.setY(RND.nextDouble() * 4));

                ObservableList<YChartItem> yItems = ySeries1.getItems();
                yItems.forEach(item -> item.setY(RND.nextDouble() * 100));

                yItems = ySeries2.getItems();
                yItems.forEach(item -> item.setY(RND.nextDouble() * 100));

                yItems = ySeries3.getItems();
                yItems.forEach(item -> item.setY(RND.nextDouble() * 100));

                // Can be used to update charts but if more than one series is in one xyPane
                // it's easier to use the refresh() method of XYChart
                //xySeries1.refresh();
                //xySeries2.refresh();
                //xySeries3.refresh();
                //xySeries4.refresh();

                // Useful to refresh the chart if it contains more than one series to avoid
                // multiple redraws
                xyChart.refresh();

                //ySeries1.refresh();
                //ySeries2.refresh();

                yChart.refresh();

                lastTimerCall = now;
            }
        }
    };
}
 
Example 13
Source File: GraphPanel.java    From charts with Apache License 2.0 4 votes vote down vote up
private void init() {
    width              = PREFERRED_WIDTH;
    height             = PREFERRED_HEIGHT;
    mouseHandler       = this::handleMouseEvents;
    lastTimerCall      = System.nanoTime();
    _physicsActive     = true;
    _forceInverted     = false;

    setInitialPosition((int)width, (int)height);

    timer              = new AnimationTimer() {
        @Override public void handle(final long now) {
            if (now > lastTimerCall + REFRESH_PERIOD) {
                fruchtermanReingold();
                lastTimerCall = now;
                redraw();
            }
        }
    };

    nodeChangeListener    = (o, ov, nv) -> redraw();
    temp                  = BASE_TEMPERATURE;
    area                  = width * height;
    k                     = Math.sqrt(area / nodeEdgeModel.getNodes().size());
    distanceScalingFactor = new SimpleDoubleProperty(DISTANCE_SCALING_FACTOR);
    _edgeColor            = Color.DARKGRAY;
    _edgeWidthFactor = 2;
    //_nodeBorderColor       = Color.WHITE;
    _nodeHighlightingColor = Color.RED;
    _nodeBorderWidth       = 3;
    _selectedNodeFillColor   = Color.BLACK;
    _selectedNodeBorderColor = Color.LIME;
    maxXPosition = 1;
    maxYPosition = 1;
    minXPosition = -1;
    minYPosition = -1;


    if(null != nodeEdgeModel.getCurrentGroupKey()){
        GROUPING_KEY = nodeEdgeModel.getCurrentGroupKey();
    } else{
        GROUPING_KEY = NodeEdgeModel.DEFAULT;
    }

    popup                    = new InfoPopup();


    initGraphics();
    registerListeners();
    timer.start();
}
 
Example 14
Source File: DoodleTrace.java    From gluon-samples with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Constructor taking the application's name.
 */
public DoodleTrace() {

    // Create the drawing surface
    Pane drawSurface = new Pane();
    setCenter(drawSurface);

    // Initialize draw path
    drawPath = new Path();
    drawPath.setStrokeWidth(3);
    drawPath.setStroke(Color.BLACK);
    drawSurface.getChildren().add(drawPath);

    // Initialize trace path
    tracePath = new Path();
    tracePath.setStrokeWidth(3);
    tracePath.setStroke(Color.BLACK);
    drawSurface.getChildren().add(tracePath);

    // Ball tracer
    RadialGradient gradient1 = new RadialGradient(
            0,
            0,
            .5,
            .5,
            .55,
            true,
            CycleMethod.NO_CYCLE,
            new Stop(0, Color.RED),
            new Stop(1, Color.BLACK));

    // Create a ball
    ball = new Circle(100, 100, 20, gradient1);

    // Add ball
    drawSurface.getChildren().add(ball);

    // Animation responsible for tracing the doodle
    tracerTimeline = new Timeline();

    // Flag to prevent user from doodling during animation
    tracerTimeline.setOnFinished(ae3 -> animating = false);

    if (Platform.isDesktop()) {
        applyMouseInput(drawSurface);
    } else if (Platform.isAndroid() || Platform.isIOS()) {
        applyTouchInput(drawSurface);
    }
}
 
Example 15
Source File: Led.java    From JFX8CustomControls with Apache License 2.0 4 votes vote down vote up
public final ObjectProperty<Color> ledColorProperty() {
    if (null == ledColor) {
        ledColor = new SimpleObjectProperty<>(this, "ledColor", Color.RED);
    }
    return ledColor;
}
 
Example 16
Source File: TopsoilPlotWetherill.java    From ET_Redux with Apache License 2.0 4 votes vote down vote up
@Override
public List<Node> toolbarControlsFactory() {
    List<Node> controls = super.toolbarControlsFactory();

    CheckBox ellipsesCheckBox = new CheckBox("Ellipses");
    ellipsesCheckBox.setSelected(true);
    ellipsesCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(ELLIPSES, ellipsesCheckBox.isSelected());
    });
    
    ChoiceBox<SigmaPresentationModes> uncertaintyChoiceBox = new ChoiceBox<>(FXCollections.observableArrayList(SigmaPresentationModes.values()));
    uncertaintyChoiceBox.setValue(SigmaPresentationModes.TWO_SIGMA_ABSOLUTE);
    uncertaintyChoiceBox.setConverter(new StringConverter<SigmaPresentationModes>() {
        @Override
        public String toString(SigmaPresentationModes object) {
            return object.getDisplayName();
        }

        @Override
        public SigmaPresentationModes fromString(String string) {
            return null;
        }
    });
    uncertaintyChoiceBox.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<SigmaPresentationModes>() {
        @Override
        public void changed(ObservableValue observable, SigmaPresentationModes oldValue, SigmaPresentationModes newValue) {
            plot.setProperty(UNCERTAINTY, newValue.getSigmaMultiplier());
        }
    });

    ColorPicker ellipsesColorPicker = new ColorPicker(Color.RED);
    ellipsesColorPicker.setStyle("-fx-font-size: 8px; -fx-font-family: 'Courier New';");
    ellipsesColorPicker.setPrefWidth(100);
    ellipsesColorPicker.setOnAction(mouseEvent -> {
        // to satisfy D3
        plot.setProperty(ELLIPSE_FILL_COLOR, ellipsesColorPicker.getValue().toString().substring(0, 8).replaceAll("0x", "#"));
    });

    CheckBox concordiaLineCheckBox = new CheckBox("Concordia");
    concordiaLineCheckBox.setSelected(true);
    concordiaLineCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(CONCORDIA_LINE, concordiaLineCheckBox.isSelected());
    });

    CheckBox allSelectedCheckBox = new CheckBox("Select All");
    allSelectedCheckBox.setSelected(true);
    allSelectedCheckBox.setOnAction(mouseEvent -> {
        setSelectedAllData(allSelectedCheckBox.isSelected());
    });

    CheckBox regressionUnctEnvelopeCheckBox = new CheckBox("2D Regression Unct");
    regressionUnctEnvelopeCheckBox.setSelected(false);
    regressionUnctEnvelopeCheckBox.setOnAction(mouseEvent -> {
        plot.setProperty(REGRESSION_ENVELOPE, regressionUnctEnvelopeCheckBox.isSelected());
    });

    CheckBox regressionCheckBox = new CheckBox("2D Regression");
    regressionCheckBox.setSelected(false);
    regressionUnctEnvelopeCheckBox.setDisable(true);
    regressionCheckBox.setOnAction(mouseEvent -> {
        boolean isRegression = regressionCheckBox.isSelected();
        plot.setProperty(REGRESSION_LINE, isRegression);
        regressionUnctEnvelopeCheckBox.setDisable(!isRegression);
    });

    controls.add(ellipsesCheckBox);
    controls.add(uncertaintyChoiceBox);
    controls.add(ellipsesColorPicker);
    controls.add(allSelectedCheckBox);
    controls.add(concordiaLineCheckBox);
    controls.add(regressionCheckBox);
    controls.add(regressionUnctEnvelopeCheckBox);

    return controls;
}
 
Example 17
Source File: MatrixChartItem.java    From charts with Apache License 2.0 4 votes vote down vote up
public MatrixChartItem(final int X, final int Y, final double Z) {
    this(X, Y, Z, "", Color.RED);
}
 
Example 18
Source File: PlotItem.java    From charts with Apache License 2.0 4 votes vote down vote up
public PlotItem() {
        this("", 0,"", Color.RED);
}
 
Example 19
Source File: Options.java    From Enzo with Apache License 2.0 4 votes vote down vote up
public Options(final double DEGREES, final double OFFSET, final double RADIUS) {
    this(DEGREES, OFFSET, RADIUS, 44, Color.RED, Color.WHITE, Color.WHITE, true, false, false, 0.5, true);
}
 
Example 20
Source File: XYChartItem.java    From charts with Apache License 2.0 4 votes vote down vote up
public XYChartItem(final double X, final double Y, final String NAME) {
    this(X, Y, NAME, Color.RED, Color.TRANSPARENT, Symbol.NONE);
}