@Override public void start(Stage stage) { stage.setTitle("Vokabeltrainer"); Scene scene = new Scene(new VBox(), 400, 350); scene.setFill(Color.OLDLACE); MenuBar menuBar = new MenuBar(); // --- Menu File Menu menuFile = new Menu("Vokabeln"); MenuItem sample = new MenuItem("Sample"); sample.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // Do stuff here } }); menuFile.getItems().add(sample); // --- Menu Edit Menu menuEdit = new Menu("Abfragemodus"); // --- Menu View Menu menuView = new Menu("Statistik"); menuBar.getMenus().addAll(menuFile, menuEdit, menuView); ((VBox) scene.getRoot()).getChildren().addAll(menuBar); stage.setScene(scene); stage.show(); }
@Override public void drawYValueBox() { if (showMouseHoverIndicator.getValue()){ double y = mouseY.getValue(); y = y - 10; double x = 0; double wd = 150; double ht = 18; if (mouseY == null) { return; } int yIntPos = (int)Math.round(mouseY.getValue()); Float yValue = this.getValueByYPos(yIntPos); if ( yValue != null && yValue != 0){ String strVolume = String.format("%.2f", yValue); GraphicsContext gc = getGraphicsContext2D(); gc.setFill(Color.web("#010a23")); gc.fillRect(x, y, wd, ht); gc.setFill(Color.web("#4bf221")); gc.fillText(strVolume, x + 13, y+13); } } }
@Override public void init() { int noOfValues = 24 * 60; LocalDateTime start = LocalDateTime.now(); LocalDateTime end = start.plusHours(24); List<TYChartItem> tyData1 = new ArrayList<>(); for (int i = 0 ; i < noOfValues ; i++) { tyData1.add(new TYChartItem(start.plusMinutes(i), RND.nextDouble() * 12 + RND.nextDouble() * 6, "P" + i, COLORS[RND.nextInt(3)])); } tySeries1 = new XYSeries(tyData1, ChartType.LINE, Color.RED, Color.rgb(255, 0, 0, 0.5)); tySeries1.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); xAxisBottom = createBottomTimeAxis(start, end, "HH:mm", true); yAxisLeft = createLeftYAxis(0, 20, true); yAxisRight = createRightYAxis(tempFahrenheitMin, tempFahrenheitMax, false); tyChart = new XYChart<>(new XYPane(tySeries1), yAxisLeft, yAxisRight, xAxisBottom); tyChart.setPrefSize(400, 200); }
private void createLetter(String c) { final Text letter = new Text(c); letter.setFill(Color.BLACK); letter.setFont(FONT_DEFAULT); letter.setTextOrigin(VPos.TOP); letter.setTranslateX((getWidth() - letter.getBoundsInLocal().getWidth()) / 2); letter.setTranslateY((getHeight() - letter.getBoundsInLocal().getHeight()) / 2); getChildren().add(letter); // over 3 seconds move letter to random position and fade it out final Timeline timeline = new Timeline(); timeline.getKeyFrames().add( new KeyFrame(Duration.seconds(3), new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { // we are done remove us from scene getChildren().remove(letter); } }, new KeyValue(letter.translateXProperty(), getRandom(0.0f, getWidth() - letter.getBoundsInLocal().getWidth()),INTERPOLATOR), new KeyValue(letter.translateYProperty(), getRandom(0.0f, getHeight() - letter.getBoundsInLocal().getHeight()),INTERPOLATOR), new KeyValue(letter.opacityProperty(), 0f) )); timeline.play(); }
@FXML private void initialize() { System.out.println("CaptureWindow initialized"); // Scene Scene scene = new Scene(stackPane, screenWidth, screenHeight, Color.TRANSPARENT); setScene(scene); addKeyHandlers(); mainCanvas.setWidth(screenWidth); mainCanvas.setHeight(screenHeight); mainCanvas.setOnMousePressed(m -> { xFrom = (int) m.getSceneX(); yFrom = (int) m.getScreenY(); }); mainCanvas.setOnMouseDragged(m -> { xNow = (int) m.getScreenX(); yNow = (int) m.getScreenY(); repaintCanvas(); }); gc = mainCanvas.getGraphicsContext2D(); }
private Scene simpleScene() { try { VBox root = new VBox(); Pane pane = new Pane(); Rectangle rectangle = new Rectangle(100, 100, Color.AQUA); pane.getChildren().addAll(rectangle); VerticalResizeContainerController controller = new VerticalResizeContainerController(pane); root.getChildren().addAll(controller.getView()); VBox.setVgrow(controller.getView(), Priority.ALWAYS); Scene scene = new Scene(root, 800, 600); return scene; } catch (Exception e) { e.printStackTrace(); return null; } }
/** * Called when the GUI is created. If we need to do something special to anything in the GUI, we do it in here. */ @FXML public void initialize() { //Gives the "reset board" menu option the shortcut of ctrl+r resetBoard.setAccelerator(new KeyCodeCombination(KeyCode.R, KeyCombination.CONTROL_DOWN)); exit.setAccelerator(new KeyCodeCombination(KeyCode.F4, KeyCombination.ALT_DOWN)); for (int x = 0; x < boardWidth; x++) { for (int y = 0; y < boardHeight; y++) { board.add(new FXSpace(), x, y); } } board.setMaxWidth(FXSpace.WIDTH * boardWidth); board.setMaxHeight(FXSpace.HEIGHT * boardHeight); board.setBorder(new Border(new BorderStroke(Color.LIGHTGREY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); for (int x = 0; x < tileTrayWidth; x++) { tileTray.add(new FXSpace(), x, 0); } tileTray.setMaxWidth(FXSpace.WIDTH * tileTrayWidth); tileTray.setMaxHeight(FXSpace.HEIGHT * 1); tileTray.setBorder(new Border(new BorderStroke(Color.LIGHTGREY, BorderStrokeStyle.SOLID, CornerRadii.EMPTY, new BorderWidths(1)))); }
@Override public void updateItem(Number item, boolean empty) { super.updateItem(item, empty); // format the number as if it were a monetary value using the // formatting relevant to the current locale. This would format // 43.68 as "$43.68", and -23.67 as "($23.67)" setText(item == null ? "" : NumberFormat.getCurrencyInstance().format(item)); if (item != null) { double value = item.doubleValue(); setTextFill(value == 0 ? Color.BLACK : value < 0 ? Color.RED : Color.GREEN); } }
private static void init() { root = new Group(); s = new Scene(root, SCENE_WIDTH, SCENE_HEIGHT); c = new Canvas(CANVAS_WIDTH, CANVAS_HEIGHT); root.getChildren().add(c); gc = c.getGraphicsContext2D(); gc.setStroke(Color.BLUE); gc.setLineWidth(2); gc.setFill(Color.BLUE); Renderer.init(); GameLoop.start(gc); //Initialize Objects Player p = new Player(); setPlayer(p); //load map loadMap(); //should be called at last it based on player EventHandler.attachEventHandlers(s); }
@Override public void start(Stage stage) { // create the scene stage.setTitle("Social Network"); scene = new Scene(new Browser(),750,500, Color.web("#666970")); stage.setScene(scene); scene.getStylesheets().add("webviewsample/BrowserToolbar.css"); stage.show(); }
public RotateTransitionSample() { super(140,140); Rectangle rect = new Rectangle(20, 20, 100, 100); rect.setArcHeight(20); rect.setArcWidth(20); rect.setFill(Color.ORANGE); getChildren().add(rect); rotateTransition = RotateTransitionBuilder.create() .node(rect) .duration(Duration.seconds(4)) .fromAngle(0) .toAngle(720) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
public FadeTransitionSample() { super(100,100); Rectangle rect = new Rectangle(0, 0, 100, 100); rect.setArcHeight(20); rect.setArcWidth(20); rect.setFill(Color.DODGERBLUE); getChildren().add(rect); fadeTransition = FadeTransitionBuilder.create() .duration(Duration.seconds(4)) .node(rect) .fromValue(1) .toValue(0.2) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
private void addColorsPane() { colorPickers.add(colorOne); colorPickers.add(colorTwo); colorPickers.add(colorThree); colorPickers.add(colorFour); colorPickers.add(colorFive); // Get the colors from the database, so the colorpickers can be set // to those colors. String[] colors = Database.INSTANCE.getColorsFromDatabase(); for (int i = 0; i < colorPickers.size(); i++) { colorPickers.get(i).getStyleClass().add("button"); // Set the color in the database on the color picker. colorPickers.get(i).setValue(Color.web(colors[i])); } }
/** * 设置图形节点为选中样式 */ @Override public void drawConner() { canvas.setMouseTransparent(true); isConnerShow = true; GraphicsContext gc = canvas.getGraphicsContext2D(); double whiteR = 12; double blueR = 10; if (x1 != null) { double X = x.doubleValue(); double Y = y.doubleValue(); gc.setFill(Color.WHITE); gc.fillOval(x1.doubleValue() -6+ X, y1.doubleValue() -6+ Y, whiteR, whiteR); gc.fillOval(x2.doubleValue() - 6+ X, y2.doubleValue() - 6 + Y, whiteR, whiteR); gc.setFill(Color.color(0.03, 0.43, 0.81)); gc.fillOval(x1.doubleValue() -5 + X, y1.doubleValue() -5 + Y, blueR, blueR); gc.fillOval(x2.doubleValue()-5+ X, y2.doubleValue() - 5 + Y, blueR, blueR); } }
/** * Get the color at the give {@code position} in the ladder of color stops */ private static Color ladder(final double position, final Stop[] stops) { Stop prevStop = null; for (int i=0; i<stops.length; i++) { Stop stop = stops[i]; if(position <= stop.getOffset()){ if (prevStop == null) { return stop.getColor(); } else { return interpolateLinear((position-prevStop.getOffset())/(stop.getOffset()-prevStop.getOffset()), prevStop.getColor(), stop.getColor()); } } prevStop = stop; } // position is greater than biggest stop, so will we biggest stop's color return prevStop.getColor(); }
public EllipseSample() { super(180,90); // Simple red filled ellipse Ellipse ellipse1 = new Ellipse(45,45,30,45); ellipse1.setFill(Color.RED); // Blue stroked ellipse Ellipse ellipse2 = new Ellipse(135,45,30,45); ellipse2.setStroke(Color.DODGERBLUE); ellipse2.setFill(null); // Create a group to show all the ellipses); getChildren().add(new Group(ellipse1,ellipse2)); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Ellipse 1 Fill", ellipse1.fillProperty()), new SimplePropertySheet.PropDesc("Ellipse 1 Width", ellipse1.radiusXProperty(), 10d, 40d), new SimplePropertySheet.PropDesc("Ellipse 1 Height", ellipse1.radiusYProperty(), 10d, 45d), new SimplePropertySheet.PropDesc("Ellipse 2 Stroke", ellipse2.strokeProperty()), new SimplePropertySheet.PropDesc("Ellipse 2 Stroke Width", ellipse2.strokeWidthProperty(), 1d, 5d), new SimplePropertySheet.PropDesc("Ellipse 2 Width", ellipse2.radiusXProperty(), 10d, 40d), new SimplePropertySheet.PropDesc("Ellipse 2 Height", ellipse2.radiusYProperty(), 10d, 45d) ); // END REMOVE ME }
private Path initializeHalfCircle() { final Path halfCircle = new Path(); halfCircle.setStroke(Color.BLACK); MoveTo p1 = new MoveTo(); ArcTo p2 = new ArcTo(); p1.xProperty().bind(xProperty().add(CIRCLE_RADIUS)); p1.yProperty().bind(yProperty()); p2.xProperty().bind(xProperty().subtract(CIRCLE_RADIUS)); p2.yProperty().bind(yProperty()); p2.setRadiusX(CIRCLE_RADIUS); p2.setRadiusY(CIRCLE_RADIUS); halfCircle.getElements().add(p1); halfCircle.getElements().add(p2); return halfCircle; }
public static Node createIconContent() { QuadCurve quadCurve = new QuadCurve(); quadCurve.setStartX(0); quadCurve.setStartY(50); quadCurve.setControlX(20); quadCurve.setControlY(0); quadCurve.setEndX(80); quadCurve.setEndY(50); quadCurve.setStroke(Color.web("#b9c0c5")); quadCurve.setStrokeWidth(5); quadCurve.getStrokeDashArray().addAll(15d,15d); quadCurve.setFill(null); javafx.scene.effect.InnerShadow effect = new javafx.scene.effect.InnerShadow(); effect.setOffsetX(1); effect.setOffsetY(1); effect.setRadius(3); effect.setColor(Color.rgb(0,0,0,0.6)); quadCurve.setEffect(effect); return quadCurve; }
public ObjectProperty<Color> darkTextColorProperty() { if (null == darkTextColor) { darkTextColor = new ObjectPropertyBase<Color>(_darkTextColor) { @Override protected void invalidated() { if (isAutoTextColor()) { adjustTextColors(); redraw(); } } @Override public Object getBean() { return SunburstChart.this; } @Override public String getName() { return "darkTextColor"; } }; _darkTextColor = null; } return darkTextColor; }
public PathSample() { super(180,90); // Create path shape - square Path path1 = new Path(); path1.getElements().addAll( new MoveTo(25, 25), new HLineTo(65), new VLineTo(65), new LineTo(25, 65), new ClosePath() ); path1.setFill(null); path1.setStroke(Color.RED); path1.setStrokeWidth(2); // Create path shape - curves Path path2 = new Path(); path2.getElements().addAll( new MoveTo(100, 45), new CubicCurveTo(120, 20, 130, 80, 140, 45), new QuadCurveTo(150, 0, 160, 45), new ArcTo(20, 40, 0, 180, 45, true, true) ); path2.setFill(null); path2.setStroke(Color.DODGERBLUE); path2.setStrokeWidth(2); // show the path shapes; getChildren().add(new Group(path1, path2)); // REMOVE ME setControls( new SimplePropertySheet.PropDesc("Path 1 Stroke", path1.strokeProperty()), new SimplePropertySheet.PropDesc("Path 2 Stroke", path2.strokeProperty()) ); // END REMOVE ME }
/** * Set verification button to a state that signals that the verification can be stopped. */ public void setVerificationButtonStop() { Text icon = GlyphsDude.createIcon(FontAwesomeIcon.STOP); icon.setFill(Color.INDIANRED); startVerificationButton.setText("Stop Verification"); startVerificationButton.setGraphic(icon); }
private Tuple2<Color, Integer> validateCharactersLeft(final String currentText) { final Integer len = currentText.length(); final Color color = Match(len).of( Case($(tweetLen -> tweetLen < 130), GREEN), Case($(tweetLen -> tweetLen > 130 && tweetLen < 140), YELLOW), Case($(tweetLen -> tweetLen > 140), RED), Case($(tweetLen -> tweetLen == 140), BLUE) ); return Tuple.of(color, len); }
public void render() { //Tank tracks if (updates == 7) { for (Tank tank : framework.getTanks()) { gc.save(); gc.transform(new Affine(new Rotate(tank.getAngle(), tank.getX(), tank.getY()))); gc.setFill(Color.rgb(229, 229, 211, 0.8)); gc.fillRect(tank.getX() - 32, tank.getY(), 16, 5); gc.fillRect(tank.getX() + 32 - 16, tank.getY(), 16, 5); gc.restore(); } updates = 0; } }
public Location(final double LATITUDE, final double LONGITUDE, final double ALTITUDE, final Instant TIMESTAMP, final String NAME, final String INFO, final Color COLOR) { _name = NAME; _latitude = LATITUDE; _longitude = LONGITUDE; _altitude = ALTITUDE; _timestamp = TIMESTAMP; _info = INFO; _color = COLOR; zoomLevel = 15; listenerList = new CopyOnWriteArrayList<>(); }
/** * Helper function to convert a color in sRGB space to linear RGB space. */ public static Color convertSRGBtoLinearRGB(Color color) { double[] colors = new double[] { color.getRed(), color.getGreen(), color.getBlue() }; for (int i=0; i<colors.length; i++) { if (colors[i] <= 0.04045) { colors[i] = colors[i] / 12.92; } else { colors[i] = Math.pow((colors[i] + 0.055) / 1.055, 2.4); } } return Color.color(colors[0], colors[1], colors[2], color.getOpacity()); }
private void initFX() { Platform.setImplicitExit(false); v = new WebView(); BorderPane bp = new BorderPane(); Scene scene = new Scene(bp, Color.ALICEBLUE); class X implements ChangeListener<String>, Runnable { private String title; public X() { super(); } @Override public void changed(ObservableValue<? extends String> ov, String t, String t1) { title = v.getEngine().getTitle(); EventQueue.invokeLater(this); } @Override public void run() { if (title != null) { HtmlComponent.this.setDisplayName(title); } } } final X x = new X(); v.getEngine().titleProperty().addListener(x); Platform.runLater(x); bp.setCenter(v); p.setScene(scene); }
@Override public void init() { ChartItem p1Q1 = new ChartItem("Product 1", 16, CYAN_700.get()); ChartItem p2Q1 = new ChartItem("Product 2", 8, CYAN_500.get()); ChartItem p3Q1 = new ChartItem("Product 3", 4, CYAN_300.get()); ChartItem p4Q1 = new ChartItem("Product 4", 2, CYAN_100.get()); ChartItem p1Q2 = new ChartItem("Product 1", 12, PURPLE_700.get()); ChartItem p2Q2 = new ChartItem("Product 2", 5, PURPLE_500.get()); ChartItem p3Q2 = new ChartItem("Product 3", 3, PURPLE_300.get()); ChartItem p4Q2 = new ChartItem("Product 4", 1, PURPLE_100.get()); ChartItem p1Q3 = new ChartItem("Product 1", 14, PINK_700.get()); ChartItem p2Q3 = new ChartItem("Product 2", 7, PINK_500.get()); ChartItem p3Q3 = new ChartItem("Product 3", 3.5, PINK_300.get()); ChartItem p4Q3 = new ChartItem("Product 4", 1.75, PINK_100.get()); ChartItem p1Q4 = new ChartItem("Product 1", 18, AMBER_700.get()); ChartItem p2Q4 = new ChartItem("Product 2", 9, AMBER_500.get()); ChartItem p3Q4 = new ChartItem("Product 3", 4.5, AMBER_300.get()); ChartItem p4Q4 = new ChartItem("Product 4", 2.25, AMBER_100.get()); ChartItemSeries<ChartItem> q1 = new ChartItemSeries<>(ChartType.NESTED_BAR, "1st Quarter", CYAN_900.get(), Color.TRANSPARENT, p1Q1, p2Q1, p3Q1, p4Q1); ChartItemSeries<ChartItem> q2 = new ChartItemSeries<>(ChartType.NESTED_BAR, "2nd Quarter", PURPLE_900.get(), Color.TRANSPARENT, p1Q2, p2Q2, p3Q2, p4Q2); ChartItemSeries<ChartItem> q3 = new ChartItemSeries<>(ChartType.NESTED_BAR, "3rd Quarter", PINK_900.get(), Color.TRANSPARENT, p1Q3, p2Q3, p3Q3, p4Q3); ChartItemSeries<ChartItem> q4 = new ChartItemSeries<>(ChartType.NESTED_BAR, "4th Quarter", AMBER_900.get(), Color.TRANSPARENT, p1Q4, p2Q4, p3Q4, p4Q4); chart = new NestedBarChart(q1, q2, q3, q4); chart.setOnSelectionEvent(e -> System.out.println(e)); }
public ObjectProperty<Color> thresholdYColorProperty() { if (null == thresholdYColor) { thresholdYColor = new ObjectPropertyBase<Color>(_thresholdYColor) { @Override protected void invalidated() { redraw(); } @Override public Object getBean() { return YPane.this; } @Override public String getName() { return "thresholdYColor"; } }; _thresholdYColor = null; } return thresholdYColor; }
/** * Setup the layout properties of a Node. */ private void setProperties(){ setMinSize(NodeBox.this.getMinWidth(),NodeBox.this.getMinHeight()); setMaxSize(getMinWidth(),getMinHeight()); setPadding(defaultPadding); setBackground(new Background(new BackgroundFill(Color.TRANSPARENT,defaultCornerRadii,null))); //setBackgroundColor(this, , defaultCornerRadii,null); setBorder( defaultBorder ); setMargin(this,new Insets(0,0,15,0)); }
private void init(Stage primaryStage) { Group root = new Group(); primaryStage.setResizable(false); primaryStage.setScene(new Scene(root, 400,260)); Rectangle rect = new Rectangle (0, 0, 40, 40); rect.setArcHeight(10); rect.setArcWidth(10); rect.setFill(Color.ORANGE); root.getChildren().add(rect); Path path = PathBuilder.create() .elements( new MoveTo(20,20), new CubicCurveTo(380, 0, 380, 120, 200, 120), new CubicCurveTo(0, 120, 0, 240, 380, 240) ) .build(); path.setStroke(Color.DODGERBLUE); path.getStrokeDashArray().setAll(5d,5d); root.getChildren().add(path); pathTransition = PathTransitionBuilder.create() .duration(Duration.seconds(4)) .path(path) .node(rect) .orientation(OrientationType.ORTHOGONAL_TO_TANGENT) .cycleCount(Timeline.INDEFINITE) .autoReverse(true) .build(); }
public Clock(Color onColor, Color offColor) { // create effect for on LEDs Glow onEffect = new Glow(1.7f); onEffect.setInput(new InnerShadow()); // create effect for on dot LEDs Glow onDotEffect = new Glow(1.7f); onDotEffect.setInput(new InnerShadow(5,Color.BLACK)); // create effect for off LEDs InnerShadow offEffect = new InnerShadow(); // create digits digits = new Digit[7]; for (int i = 0; i < 6; i++) { Digit digit = new Digit(onColor, offColor, onEffect, offEffect); digit.setLayoutX(i * 80 + ((i + 1) % 2) * 20); digits[i] = digit; getChildren().add(digit); } // create dots Group dots = new Group( new Circle(80 + 54 + 20, 44, 6, onColor), new Circle(80 + 54 + 17, 64, 6, onColor), new Circle((80 * 3) + 54 + 20, 44, 6, onColor), new Circle((80 * 3) + 54 + 17, 64, 6, onColor)); dots.setEffect(onDotEffect); getChildren().add(dots); // update digits to current time and start timer to update every second refreshClocks(); play(); }
public Sketch(){ //TODO, should this make a copy of the path? path = new Path(); stroke = new Stroke(); path.toFront(); path.setStrokeWidth(2); path.setStroke(Color.BLACK); id = ++objectCount; }
@Override public void draw(Switch sw) { Coordinate root = sw.getPos().add(sw.getPos().substract(sw.getRootNode().getPos()).normalize().scale(-16)); Coordinate active = sw.getPos().add(sw.getPos().substract(sw.getActiveNode().getPos()).normalize().scale(-16)); graphicsContext.setLineWidth(4); graphicsContext.setStroke(Color.DARKRED); graphicsContext.strokeLine(sw.getPos().getX(), sw.getPos().getY(), root.getX(), root.getY()); graphicsContext.setStroke(Color.RED); graphicsContext.strokeLine(sw.getPos().getX(), sw.getPos().getY(), active.getX(), active.getY()); }
private void configureDesign() { rectangleVisual.setLayoutY(0f); rectangleVisual.setLayoutX(-14); rectangleVisual.setFill(Color.TRANSPARENT); rectangleSmall.setLayoutX(-7); rectangleSmall.setLayoutY(5); rectangleSmall.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{ new Stop(0, colorWeak), new Stop(0.5, colorStrong), new Stop(1, colorWeak)})); rectangleBig.setLayoutX(-14); rectangleBig.setLayoutY(0); rectangleBig.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{ new Stop(0, colorStrong), new Stop(0.5, colorWeak), new Stop(1, colorStrong)})); rectangleWatch.setFill(new LinearGradient(0, 0, 1, 0, true, CycleMethod.NO_CYCLE, new Stop[]{ new Stop(0, Color.web("#4e605f")), new Stop(0.2, Color.web("#c3d6d5")), new Stop(0.5, Color.web("#f9ffff")), new Stop(0.8, Color.web("#c3d6d5")), new Stop(1, Color.web("#4e605f"))})); rectangleWatch.setLayoutX(-12); rectangleWatch.setLayoutY(12); }
public void setColor(final Color COLOR) { if (null == color) { _color = COLOR; refresh(); } else { color.set(COLOR); } }
public boolean visit(Tile t) { CoordGene<Double> coord = new CoordGene<Double>((double) t.getX(), (double) t.getY()); CoordGene<Double> coordPix = traducteur.axialToPixel(coord); hex.setxPixel(coordPix.getX() + traducteur.getMoveOrigin().getX()); hex.setyPixel(coordPix.getY() + traducteur.getMoveOrigin().getY()); hex.calculHex(); Piece piece = t.getPiece(); if (piece != null) { String name; if (t.getZ() == 0) { gc.setFill(new ImagePattern(piece.getImage())); } else { name = getClass().getClassLoader() .getResource("main/resources/img/tile/" + piece.getName() + piece.getTeam() +t.getZ() +".png") .toString(); gc.setFill(new ImagePattern(new Image(name))); } gc.setStroke(Color.BLACK); gc.setLineWidth(1); gc.strokePolygon(hex.getListXCoord(), hex.getListYCoord(), 6); gc.fillPolygon(hex.getListXCoord(), hex.getListYCoord(), 6); } else { if (OptionManager.isGridEnable()) { gc.setStroke(Color.BLACK); gc.setLineWidth(1); gc.strokePolygon(hex.getListXCoord(), hex.getListYCoord(), 6); } } return false; }
private static void drawRectangles(Group target) { DrawnRectangle rectangle1 = new DrawnRectangle(1, PANE_WIDTH - 20, 2); rectangle1.setFill(Color.GREEN); DrawnRectangle rectangle2 = new DrawnRectangle(20, 2000, 5); rectangle2.setFill(Color.RED); DrawnRectangle rectangle3 = new DrawnRectangle(PANE_WIDTH - 2000, PANE_WIDTH - 100, 6); rectangle3.setFill(Color.ORANGE); target.getChildren().addAll(rectangle1, rectangle2, rectangle3); }
public void setSymbolStroke(final Color COLOR) { if (null == symbolStroke) { _symbolStroke = COLOR; redraw(); } else { symbolStroke.set(COLOR); } }
/** * 设置图形节点为选中样式 */ public void drawConner() { canvas.setMouseTransparent(false); if (node != null) { node.setMouseTransparent(true); } isConnerShow = true; // System.out.println("draw conner"); double height = getPrefHeight(); double width = getPrefWidth(); GraphicsContext gc = canvas.getGraphicsContext2D(); double whiteR = 12; double blueR = 10; double delta = (whiteR - blueR) / 2; double lineStart = whiteR / 2; gc.setStroke(Color.GREEN); gc.setLineWidth(2); gc.strokeLine(lineStart, lineStart, width - lineStart, lineStart); gc.strokeLine(lineStart, height - lineStart, width - lineStart, height - lineStart); gc.strokeLine(lineStart, lineStart, lineStart, height - lineStart); gc.strokeLine(width - lineStart, lineStart, width - lineStart, height - lineStart); gc.setFill(Color.WHITE); gc.fillOval(0, 0, whiteR, whiteR); gc.fillOval(width - whiteR, 0, whiteR, whiteR); gc.fillOval(0, height - whiteR, whiteR, whiteR); gc.fillOval(width - whiteR, height - whiteR, whiteR, whiteR); gc.setFill(Color.color(0.03, 0.43, 0.81)); gc.fillOval(delta, delta, blueR, blueR); gc.fillOval(width - blueR - delta, delta, blueR, blueR); gc.fillOval(delta, height - blueR - delta, blueR, blueR); gc.fillOval(width - blueR - delta, height - blueR - delta, blueR, blueR); }
public void update(GraphicsContext gc) { gc.setFill(Color.LIGHTBLUE); gc.fillOval(x - radius, y - radius, radius * 2, radius * 2); if (time > 0) { time--; } if (time <= 0) { expired = true; } }