Example usage for javafx.scene.paint Color CORNFLOWERBLUE

List of usage examples for javafx.scene.paint Color CORNFLOWERBLUE

Introduction

In this page you can find the example usage for javafx.scene.paint Color CORNFLOWERBLUE.

Prototype

Color CORNFLOWERBLUE

To view the source code for javafx.scene.paint Color CORNFLOWERBLUE.

Click Source Link

Document

The color cornflower blue with an RGB value of #6495ED

Usage

From source file:spacetrader.controller.EncounterScreenController.java

/**
 * Initializes the controller class./*  w w w  .j ava 2 s  .c om*/
 */
@Override
public void initialize(URL url, ResourceBundle rb) {
    minuteMatrix = new Array2DRowRealMatrix(MINUTE_ARROW);
    hourMatrix = new Array2DRowRealMatrix(HOUR_ARROW);
    context = canvas.getGraphicsContext2D();
    context.translate(375, 275);
    context.setFill(Color.CORNFLOWERBLUE);
    context.fillPolygon(minuteMatrix.getColumn(0), minuteMatrix.getColumn(1), 10);
    context.setFill(Color.MEDIUMAQUAMARINE);
    context.fillPolygon(hourMatrix.getColumn(0), hourMatrix.getColumn(1), 8);
    timeline = new Timeline();
    timeline.setCycleCount(Timeline.INDEFINITE);
    inCount = 0;
    upDown = true;
    KeyFrame frame = new KeyFrame(Duration.seconds(1.0 / 24), new EventHandler<ActionEvent>() {
        public void handle(ActionEvent event) {
            System.out.println(inCount);
            context.clearRect(-375, -275, 750, 550);
            context.setStroke(Color.rgb(0, outCount, 127 + outCount));
            context.setLineWidth(61);
            context.strokeOval(-230, -230, 460, 460);
            context.setStroke(Color.rgb(0, (outCount + 30) % 128, 127 + (outCount + 30) % 128));
            context.strokeOval(-290, -290, 580, 580);
            context.setStroke(Color.rgb(0, (outCount + 60) % 128, 127 + (outCount + 60) % 128));
            context.strokeOval(-350, -350, 700, 700);
            context.setStroke(Color.rgb(0, (outCount + 90) % 128, 127 + (outCount + 90) % 128));
            context.setLineWidth(100);
            context.strokeOval(-430, -430, 860, 860);

            context.setFill(new LinearGradient(-200, -200, 200, 200, false, CycleMethod.NO_CYCLE,
                    new Stop(0, Color.rgb(255, 255 - inCount, inCount)),
                    new Stop(1, Color.rgb(255 - inCount, 0, 255))));
            context.fillOval(-200, -200, 400, 400);
            minuteMatrix = minuteMatrix.multiply(minuteRotateMatrix);
            hourMatrix = hourMatrix.multiply(hourRotateMatrix);
            context.setFill(Color.CORNFLOWERBLUE);
            context.fillPolygon(minuteMatrix.getColumn(0), minuteMatrix.getColumn(1), 10);
            context.setFill(Color.MEDIUMAQUAMARINE);
            context.fillPolygon(hourMatrix.getColumn(0), hourMatrix.getColumn(1), 8);
            if (inCount % 20 < 10) {
                context.drawImage(
                        new Image(Paths.get("image/star.png").toUri().toString(), 360, 360, false, false), -180,
                        -180);
            } else {
                context.drawImage(
                        new Image(Paths.get("image/star.png").toUri().toString(), 300, 300, false, false), -150,
                        -150);
            }
            if (upDown) {
                inCount += 3;
                if (inCount >= 255) {
                    upDown = false;
                }
            } else {
                inCount -= 3;
                if (inCount <= 0) {
                    upDown = true;
                }
            }
            if (outCount >= 128) {
                outCount = 0;
            } else {
                outCount += 8;
            }
        }
    });
    timeline.getKeyFrames().add(frame);
    timeline.play();
}