List of usage examples for javafx.scene.paint Stop Stop
public Stop(@NamedArg("offset") double offset, @NamedArg(value = "color", defaultValue = "BLACK") Color color)
From source file:Main.java
private void addStackPane(HBox hb) { StackPane stack = new StackPane(); Rectangle helpIcon = new Rectangle(30.0, 25.0); helpIcon.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop[] { new Stop(0, Color.web("#4977A3")), new Stop(0.5, Color.web("#B0C6DA")), new Stop(1, Color.web("#9CB6CF")), })); helpIcon.setStroke(Color.web("#D0E6FA")); helpIcon.setArcHeight(3.5);//from w w w .ja v a 2 s . c om helpIcon.setArcWidth(3.5); Text helpText = new Text("?"); helpText.setFont(Font.font("Verdana", FontWeight.BOLD, 18)); helpText.setFill(Color.WHITE); helpText.setStroke(Color.web("#7080A0")); stack.getChildren().addAll(helpIcon, helpText); stack.setAlignment(Pos.CENTER_RIGHT); // Add offset to right for question mark to compensate for RIGHT // alignment of all nodes StackPane.setMargin(helpText, new Insets(0, 10, 0, 0)); hb.getChildren().add(stack); HBox.setHgrow(stack, Priority.ALWAYS); }
From source file:de.unibw.inf2.fishification.FishWorld.java
/** * Draws the background of the aquarium. *///from www.j av a 2s. c o m private void fillAquariumBackground() { RadialGradientBuilder gradientBuilder = RadialGradientBuilder.create(); gradientBuilder.centerX(getWorldCanvas().getWidth() / 2); gradientBuilder.centerY(50); gradientBuilder.radius(1000); gradientBuilder.proportional(false); gradientBuilder.stops(new Stop(0.0, Color.WHITE), new Stop(0.05, Color.rgb(245, 251, 251)), new Stop(0.1, Color.rgb(220, 242, 239)), new Stop(0.2, Color.rgb(164, 214, 211)), new Stop(0.3, Color.rgb(142, 195, 199)), new Stop(0.4, Color.rgb(111, 170, 184)), new Stop(0.5, Color.rgb(84, 145, 166)), new Stop(0.6, Color.rgb(61, 125, 152)), new Stop(0.7, Color.rgb(50, 111, 140)), new Stop(0.8, Color.rgb(33, 96, 129)), new Stop(0.9, Color.rgb(25, 85, 121)), new Stop(1.0, Color.rgb(19, 77, 115))); RadialGradient gradient = gradientBuilder.build(); getWorldCanvas().setFill(gradient); }
From source file:spacetrader.controller.EncounterScreenController.java
/** * Initializes the controller class./*www . j av a 2 s. c o m*/ */ @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(); }