javafx.scene.text.TextBuilder Java Examples
The following examples show how to use
javafx.scene.text.TextBuilder.
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: RaceTrack.java From marathonv5 with Apache License 2.0 | 4 votes |
public RaceTrack() { ImageView carImageView = new ImageView(new Image( DataAppPreloader.class.getResourceAsStream("images/car.png"))); road = SVGPathBuilder.create() .content(trackPath).fill(null).stroke(Color.gray(0.4)) .strokeWidth(50) .effect(DropShadowBuilder.create().radius(20).blurType(BlurType.ONE_PASS_BOX).build()) .build(); SVGPath trackLine = SVGPathBuilder.create() .content(trackPath).fill(null).stroke(Color.WHITE) .strokeDashArray(8d,6d).build(); Line startLine = LineBuilder.create() .startX(610.312).startY(401.055).endX(610.312).endY(450.838) .stroke(Color.WHITE).strokeDashArray(2d,2d).build(); Text startFinish = TextBuilder.create().text("START/FINISH").fill(Color.WHITE) .x(570).y(475).build(); percentage = TextBuilder.create().text("0%") .x(390).y(170).font(Font.font("System", 60)) .fill(Color.web("#ddf3ff")) .stroke(Color.web("#73c0f7")) .effect(DropShadowBuilder.create().radius(15).color(Color.web("#3382ba")).blurType(BlurType.ONE_PASS_BOX).build()) .build(); ImageView raceCarImg = new ImageView(new Image( DataAppPreloader.class.getResourceAsStream("images/Mini-red-and-white.png"))); raceCarImg.setX(raceCarImg.getImage().getWidth()/2); raceCarImg.setY(raceCarImg.getImage().getHeight()/2); raceCarImg.setRotate(90); raceCar = new Group(raceCarImg); track = new Group(road, trackLine, startLine, startFinish); track.setCache(true); // add children getChildren().addAll(track, raceCar, percentage); // Create path animation that we will use to drive the car along the track race = new PathTransition(Duration.seconds(1), road, raceCar); race.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); race.play(); race.pause(); // center our content and set our size setTranslateX(-road.getBoundsInLocal().getMinX()); setTranslateY(-road.getBoundsInLocal().getMinY()); setPrefSize(road.getBoundsInLocal().getWidth(), road.getBoundsInLocal().getHeight()); setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE); }
Example #2
Source File: RaceTrack.java From marathonv5 with Apache License 2.0 | 4 votes |
public RaceTrack() { ImageView carImageView = new ImageView(new Image( DataAppPreloader.class.getResourceAsStream("images/car.png"))); road = SVGPathBuilder.create() .content(trackPath).fill(null).stroke(Color.gray(0.4)) .strokeWidth(50) .effect(DropShadowBuilder.create().radius(20).blurType(BlurType.ONE_PASS_BOX).build()) .build(); SVGPath trackLine = SVGPathBuilder.create() .content(trackPath).fill(null).stroke(Color.WHITE) .strokeDashArray(8d,6d).build(); Line startLine = LineBuilder.create() .startX(610.312).startY(401.055).endX(610.312).endY(450.838) .stroke(Color.WHITE).strokeDashArray(2d,2d).build(); Text startFinish = TextBuilder.create().text("START/FINISH").fill(Color.WHITE) .x(570).y(475).build(); percentage = TextBuilder.create().text("0%") .x(390).y(170).font(Font.font("System", 60)) .fill(Color.web("#ddf3ff")) .stroke(Color.web("#73c0f7")) .effect(DropShadowBuilder.create().radius(15).color(Color.web("#3382ba")).blurType(BlurType.ONE_PASS_BOX).build()) .build(); ImageView raceCarImg = new ImageView(new Image( DataAppPreloader.class.getResourceAsStream("images/Mini-red-and-white.png"))); raceCarImg.setX(raceCarImg.getImage().getWidth()/2); raceCarImg.setY(raceCarImg.getImage().getHeight()/2); raceCarImg.setRotate(90); raceCar = new Group(raceCarImg); track = new Group(road, trackLine, startLine, startFinish); track.setCache(true); // add children getChildren().addAll(track, raceCar, percentage); // Create path animation that we will use to drive the car along the track race = new PathTransition(Duration.seconds(1), road, raceCar); race.setOrientation(PathTransition.OrientationType.ORTHOGONAL_TO_TANGENT); race.play(); race.pause(); // center our content and set our size setTranslateX(-road.getBoundsInLocal().getMinX()); setTranslateY(-road.getBoundsInLocal().getMinY()); setPrefSize(road.getBoundsInLocal().getWidth(), road.getBoundsInLocal().getHeight()); setMaxSize(USE_PREF_SIZE, USE_PREF_SIZE); }
Example #3
Source File: DemoUtil.java From RadialFx with GNU Lesser General Public License v3.0 | 4 votes |
public void addGraphicControl(final String title, final ObjectProperty<Node> graphicProperty) { final Node circle = CircleBuilder.create().radius(4).fill(Color.ORANGE).build(); final Node square = RectangleBuilder.create().width(8).height(8).build(); final Node text = TextBuilder.create().text("test").build(); final ComboBox<Node> choices = new ComboBox<Node>(FXCollections.observableArrayList(circle, square, text)); choices.setCellFactory(new Callback<ListView<Node>, ListCell<Node>>() { @Override public ListCell<Node> call(final ListView<Node> param) { final ListCell<Node> cell = new ListCell<Node>() { @Override public void updateItem(final Node item, final boolean empty) { super.updateItem(item, empty); if (item != null) { setText(item.getClass().getSimpleName()); } else { setText(null); } } }; return cell; } }); choices.getSelectionModel().select(0); graphicProperty.bind(choices.valueProperty()); final VBox box = new VBox(); final Text titleText = new Text(title); titleText.textProperty().bind(new StringBinding() { { super.bind(choices.selectionModelProperty()); } @Override protected String computeValue() { return title + " : " + String.valueOf(choices.selectionModelProperty().get().getSelectedItem().getClass().getSimpleName()); } }); box.getChildren().addAll(titleText, choices); getChildren().add(box); }