private static void layoutizeLabelCreator( ICreatorCustomLabel myLabel, double r, double g, double b) { Color color = Color.color(r, g, b); ((Label) myLabel) .setBackground( new Background(new BackgroundFill(color, new CornerRadii(3), new Insets(0)))); ((Label) myLabel).setStyle("-fx-border-color: white;"); ((Label) myLabel).setMinSize(400, 35); ((Label) myLabel).setTextAlignment(TextAlignment.CENTER); ((Label) myLabel).setFont(Font.font(20)); ((Label) myLabel) .setOnDragDetected( new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { Dragboard db = ((Label) event.getSource()).startDragAndDrop(TransferMode.ANY); ClipboardContent content = new ClipboardContent(); content.putString("clipboardString"); db.setContent(content); event.consume(); } }); ((Label) myLabel).setVisible(true); }
@PostConstruct void init() { if (Font.getFontNames("Hack").isEmpty()) { Font.loadFont( DartFileManager.class .getClassLoader() .getResource("css/Hack-Regular.ttf") .toExternalForm(), 10); Font.loadFont( DartFileManager.class .getClassLoader() .getResource("css/Hack-Italic.ttf") .toExternalForm(), 10); Font.loadFont( DartFileManager.class .getClassLoader() .getResource("css/Hack-BoldItalic.ttf") .toExternalForm(), 10); Font.loadFont( DartFileManager.class.getClassLoader().getResource("css/Hack-Bold.ttf").toExternalForm(), 10); } }
protected HBox buildPiePageAlumno() { HBox hBox = new HBox(); hBox.setMaxHeight(maxHeightPie); hBox.setMaxWidth(DefaultAncho); hBox.setStyle("-fx-background-color: Black"); HBox agrupacion = new HBox(); agrupacion .getChildren() .addAll( TextBuilder.create() .text("| ") .font(Font.font("MS UI Gothic", FontWeight.BOLD, FontPosture.REGULAR, 20)) .fill(Color.WHITE) .build(), txtRecienLlegados, TextBuilder.create() .text(" |") .font(Font.font("MS UI Gothic", FontWeight.BOLD, FontPosture.REGULAR, 20)) .fill(Color.WHITE) .build()); hBox.getChildren().addAll(imgpieImagen, agrupacion); HBox.setMargin(imgpieImagen, new Insets(0, 0, 0, 10)); HBox.setMargin(agrupacion, new Insets(10, 0, 10, 770)); return hBox; }
public void showEDResult(List<String> path) { // intialize alert/dialog to display edit distance result Alert alert = new Alert(AlertType.INFORMATION); alert.setTitle("Result"); alert.setHeaderText("Word Path : "); alert.initModality(Modality.NONE); alert.setResizable(true); // create layout for content VBox box = new VBox(); HBox midBox = new HBox(); box.setPadding(new Insets(35, 0, 35, 0)); box.setSpacing(35); midBox.setSpacing(15); Label pathLabel = new Label(); Label numStepsLabel = new Label("Number of steps : "); Label numSteps = new Label(); Font font = new Font(14); pathLabel.setFont(font); numStepsLabel.setFont(font); numSteps.setFont(Font.font(font.getFamily(), FontWeight.BOLD, 14)); midBox.getChildren().add(numStepsLabel); midBox.getChildren().add(numSteps); midBox.setAlignment(Pos.CENTER); box.getChildren().add(pathLabel); box.getChildren().add(midBox); box.setAlignment(Pos.CENTER); alert.getDialogPane().setPrefWidth(300); // check for path if (path != null) { numSteps.setText(Integer.toString(path.size() - 1)); pathLabel.setText(String.join(" -> ", path)); Text text = new Text(pathLabel.getText()); text.setFont(font); if (text.getLayoutBounds().getWidth() > 200) { alert.getDialogPane().setPrefWidth(text.getLayoutBounds().getWidth() + 100); } } // no path found else { pathLabel.setText("No Path Found."); numSteps.setText("N/A"); } // set content and styling alert.getDialogPane().setContent(box); alert .getDialogPane() .getStylesheets() .add(getClass().getResource("application.css").toExternalForm()); alert.getDialogPane().getStyleClass().add("myDialog"); alert.showAndWait(); }
private void buildObjetos() { // imagen goindex imgIndex = buildButton("index.png", 60, 60, true); // filtro autor txtFiltroAutor = TextBuilder.create() .text("Por Autor") .cursor(Cursor.HAND) .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build(); // filtro titulo txtFiltroTitulo = TextBuilder.create() .text("Por Título") .cursor(Cursor.HAND) .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build(); // filtro materia txtFiltroEditorial = TextBuilder.create() .text("Por Editorial") .cursor(Cursor.HAND) .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build(); // ver Ranking txtRanking = TextBuilder.create() .text("Ranking") .cursor(Cursor.HAND) .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build(); // pie de p�gina imgpieImagen = ImageViewBuilder.create() .image(new Image(getClass().getResourceAsStream("Imagenes/imagenPie.png"))) .preserveRatio(true) .fitHeight(40) .build(); // label de recien LLegados txtRecienLlegados = TextBuilder.create() .text("Recien Llegados") .font(Font.font("MS UI Gothic", FontWeight.BOLD, 20)) .fill(Color.WHITE) .cursor(Cursor.HAND) .effect(BloomBuilder.create().threshold(0f).build()) .build(); }
private void setCaracteristicasAlContenedorPrincipal() { Button botonJuegosExistentes = new Button("Juegos existentes"); botonJuegosExistentes.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); botonJuegosExistentes.setTextFill(Color.WHITE); BackgroundFill fondoDeColorJuegosExistentes = new BackgroundFill(Color.RED, new CornerRadii(5), new Insets(0.0, 0.0, 0.0, 0.0)); botonJuegosExistentes.setBackground(new Background(fondoDeColorJuegosExistentes)); botonJuegosExistentes.setOnMouseEntered( e -> { botonJuegosExistentes.setScaleX(1.3); botonJuegosExistentes.setScaleY(1.3); }); botonJuegosExistentes.setOnMouseExited( e -> { botonJuegosExistentes.setScaleX(1); botonJuegosExistentes.setScaleY(1); }); botonJuegosExistentes.setOnAction( e -> { VistaJuegosExistentes nuevaVista = new VistaJuegosExistentes(this); nuevaVista.mostrar(); }); Button botonNuevoJuego = new Button("Nuevo juego"); botonNuevoJuego.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); botonNuevoJuego.setTextFill(Color.WHITE); BackgroundFill fondoDeColorNuevoJuego = new BackgroundFill(Color.RED, new CornerRadii(5), new Insets(0.0, 0.0, 0.0, 0.0)); botonNuevoJuego.setBackground(new Background(fondoDeColorNuevoJuego)); botonNuevoJuego.setOnMouseEntered( e -> { botonNuevoJuego.setScaleX(1.3); botonNuevoJuego.setScaleY(1.3); }); botonNuevoJuego.setOnMouseExited( e -> { botonNuevoJuego.setScaleX(1); botonNuevoJuego.setScaleY(1); }); botonNuevoJuego.setOnAction( e -> { VistaEleccionVarianteFlor nuevaVista = new VistaEleccionVarianteFlor(this); nuevaVista.mostrar(); }); this.contenedor.getChildren().addAll(botonJuegosExistentes, botonNuevoJuego); }
protected Node buildtoolsFiltroAlumno(boolean index) { HBox hBox = new HBox(10); hBox.setMaxHeight(maxHeightCabezera); hBox.setMaxWidth(DefaultAncho); hBox.setMinWidth(DefaultAncho); hBox.setPadding(new Insets(10, 10, 5, 10)); hBox.setStyle("-fx-background-color:black"); hBox.getChildren().add(txtFiltroTitulo); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); hBox.getChildren().add(txtFiltroAutor); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); hBox.getChildren().add(txtFiltroEditorial); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); hBox.getChildren().add(txtRanking); hBox.getChildren() .add( TextBuilder.create() .text("|") .fill(Color.WHITE) .font(Font.font("MS UI Gothic", FontWeight.BOLD, 28)) .build()); // Agregando el Efecto Bloom Bloom bloom = BloomBuilder.create().threshold(0f).build(); hBox.setEffect(bloom); if (index) { StackPane agrupador = new StackPane(); agrupador.getChildren().add(hBox); agrupador.getChildren().add(imgIndex); StackPane.setAlignment(imgIndex, Pos.BOTTOM_RIGHT); StackPane.setMargin(imgIndex, new Insets(0, -6, -17, 0)); return agrupador; } else { return hBox; } }
public void initContent(GridPane pane) { // pane.setGridLinesVisible(true); pane.setPadding(new Insets(20)); pane.setHgap(10); pane.setVgap(20); // header label Label lblHeader = new Label("Alert Dialogs"); pane.add(lblHeader, 1, 0); lblHeader.setTextFill(Color.DARKBLUE); lblHeader.setFont(Font.font("Calibri", FontWeight.BOLD, 36)); // label for input text field Label lblInput = new Label("A Text field:"); pane.add(lblInput, 0, 1); lblInput.setFont(Font.font("Calibri", FontWeight.NORMAL, 20)); // input text field this.txfInput = new TextField(); pane.add(txfInput, 1, 1); this.txfInput.setMinHeight(30.0); this.txfInput.setPromptText("Enter some text and save."); // horizontal box for buttons HBox hbox = new HBox(20); pane.add(hbox, 1, 2); hbox.setAlignment(Pos.CENTER); // info button Button btnInfo = new Button("Info"); btnInfo.setOnAction(event -> this.infoAction()); hbox.getChildren().add(btnInfo); // save button Button btnSave = new Button("Save"); btnSave.setOnAction(event -> this.saveAction()); hbox.getChildren().add(btnSave); // clear button Button btnClear = new Button("Clear"); btnClear.setOnAction(event -> this.clearAction()); hbox.getChildren().add(btnClear); // status text this.txtStatus = new Text(); pane.add(txtStatus, 0, 4, 3, 1); this.txtStatus.setFont(Font.font("Calibri", FontWeight.NORMAL, 20)); this.txtStatus.setFill(Color.FIREBRICK); this.txtStatus.setText("An example of Alert Dialogs. Enter some text and save."); btnInfo.requestFocus(); }
public void createAppointmentsView(User user, AppointmentViewController parentController) { VBox vbox = new VBox(); vbox.setPadding(new Insets(25)); vbox.setSpacing(8); HBox hbox = new HBox(); hbox.setSpacing(10); Text title = new Text("Appoinments"); title.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); hbox.getChildren().add(title); Button mainMenuBtn = new Button("Main Menu"); mainMenuBtn.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { parentController.goBack(); } }); hbox.getChildren().add(mainMenuBtn); vbox.getChildren().add(hbox); // Show schedule appointment if patient or HSP staff if (user.getUsertype() == UserType.PATIENT || user.getUsertype() == UserType.HSPSTAFF) { vbox.getChildren().add(addScheduleAppoinment(null, parentController)); } Text subTitle = new Text("Manage/View Appoinments"); title.setFont(Font.font("Tahoma", FontWeight.NORMAL, 15)); vbox.getChildren().add(subTitle); listView = new ListView<String>(); listView.setItems(parentController.getAppoinmentList()); listView .getSelectionModel() .selectedItemProperty() .addListener( (ObservableValue<? extends String> observable, String oldValue, String newValue) -> { System.out.println(newValue); int index = listView.getSelectionModel().getSelectedIndex(); parentController.didSelectItem(index); }); vbox.getChildren().add(listView); createScene(vbox); }
public abstract class AbstractListCell<T> extends ListCell<T> { /** * @author David * <p>This class is designed to be extended to create modified ListCells. It contains info for * getting resource files and fonts. Implement the makeCell method to decide how a cell should * be created. */ private final String DEFAULT_RESOURCE_PACKAGE = "resources/"; private String className = this.getClass().getName(); protected ResourceBundle myResources; protected ResourceBundle visualResources = ResourceBundle.getBundle(DEFAULT_RESOURCE_PACKAGE + "Visual"); protected Font titleFont = Font.loadFont( getClass().getClassLoader().getResourceAsStream("Ubuntu.ttf"), Double.parseDouble(visualResources.getString("title"))); protected Font headerFont = Font.loadFont( getClass().getClassLoader().getResourceAsStream("Ubuntu.ttf"), Double.parseDouble(visualResources.getString("header"))); protected Font textFont = Font.loadFont( getClass().getClassLoader().getResourceAsStream("Ubuntu.ttf"), Double.parseDouble(visualResources.getString("text"))); protected void findResources() { myResources = ResourceBundle.getBundle( DEFAULT_RESOURCE_PACKAGE + className.substring(className.lastIndexOf('.') + 1)); } @Override public void updateItem(T item, boolean empty) { super.updateItem(item, empty); if (item != null) { try { makeCell(item); } catch (NullPointerException e) { setText(null); setGraphic(null); } } } protected abstract void makeCell(T item); }
private void createShowConsoleButton() { consoleToggleButton = new ToggleButton(FontAwesome.ICON_TERMINAL); consoleToggleButton.setFont(Font.font("FontAwesome", 14)); consoleToggleButton.setTextFill(Color.DARKBLUE); consoleToggleButton.setTooltip(new Tooltip("Show/Hide Console.")); consoleToggleButton.selectedProperty().bindBidirectional(isDetailNodeVisible); }
public Scene initialize(Stage s) { stage = s; Group root = new Group(); Text t = new Text( 260, 100, " Escape From New Pangea The Survival of Humankind"); t.setWrappingWidth(500); t.setFont(Font.font("Verdana", 20)); t.setFill(Color.AZURE); Button b = new Button("Click to start"); ImageView im = new ImageView(new Image("images/Gobi_Desert.jpg")); b.setLayoutX(300); b.setLayoutY(275); b.setMinWidth(200); b.setMinHeight(50); b.setOnMouseClicked(e -> startGame(e)); root.getChildren().add(im); root.getChildren().add(t); root.getChildren().add(b); Scene scene = new Scene(root, 800, 600, Color.WHITE); return scene; }
private void setTrollMessage() { switch (getScoreForTrolling()) { case Game.BAD_SCORE: { trollMessage.setText(Messages.NOT_GOOD + currentName); break; } case Game.CAN_BETTER_SCORE: { trollMessage.setText(Messages.YOU_CAN_BETTER + currentName); break; } case Game.NOT_BAD_SCORE: { trollMessage.setText(Messages.NOT_BAD + currentName); break; } case Game.AWESOME_SCORE: { trollMessage.setText(Messages.AWESOME + currentName); break; } } trollMessage.setTranslateX(90); trollMessage.setTranslateY(190); trollMessage.setFill(Color.WHITE); trollMessage.setTextAlignment(TextAlignment.CENTER); trollMessage.setFont(Font.loadFont(GameFiles.SENSEI, 24)); gameOverBox.getChildren().remove(playerName); gameOverBox.getChildren().add(trollMessage); return; }
private void createProxyRequestsButton() { proxyRequestsToggleButton = new ToggleButton(FontAwesome.ICON_EXCHANGE); proxyRequestsToggleButton.setFont(Font.font("FontAwesome", 14)); proxyRequestsToggleButton.setTextFill(Color.BLACK); proxyRequestsToggleButton.setTooltip(new Tooltip("Enable/Disable Proxying via Burp")); proxyRequestsToggleButton.selectedProperty().bindBidirectional(isProxyingEnabled); }
private void createShowAlertsButton() { showAlertsToggleButton = new ToggleButton(FontAwesome.ICON_WARNING); showAlertsToggleButton.setFont(Font.font("FontAwesome", 14)); showAlertsToggleButton.setTextFill(Color.DARKGOLDENROD); showAlertsToggleButton.setTooltip(new Tooltip("Show/Hide Alerts.")); showAlertsToggleButton.selectedProperty().bindBidirectional(showAlerts); }
public void setResults(BenchmarkResult results) { double p = (double) results.score / 100; double marginalError = (1.96 * Math.sqrt((p * (1 - p)) / results.signatures.size())) * 100; pctLabel.setText( results.score + "% \u00B1 " + Math.round(marginalError) + "% (" + results.matched + "/" + results.signatures.size() + ")"); for (SignatureResult result : results.signatures) { if (result.matched) { Label lbl = new Label( "" + String.format( "0x%06X -> 0x%06X", result.sourcePosition, result.matchedPosition) + result.toString()); lbl.setFont(Font.font("monospace")); resultList.getItems().add(lbl); } } }
public void createUpdateAppoinmentView( Appointment appointment, AppointmentViewController parentController) { VBox vbox = new VBox(); vbox.setPadding(new Insets(25)); vbox.setSpacing(8); HBox hbox = new HBox(); hbox.setSpacing(10); Text title = new Text("Update Appoinment"); title.setFont(Font.font("Tahoma", FontWeight.NORMAL, 20)); hbox.getChildren().add(title); Button mainMenuBtn = new Button("Go Back"); mainMenuBtn.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent e) { parentController.handleUpdateGoBack(); } }); hbox.getChildren().add(mainMenuBtn); vbox.getChildren().add(hbox); vbox.getChildren().add(addScheduleAppoinment(appointment, parentController)); createScene(vbox); }
private Text drawText(double x, double y, String text, Color color) { Text t = new Text(x, y, text); t.setFill(color); t.setFont(Font.font("Tahoma", 20)); t.setTextAlignment(TextAlignment.CENTER); return t; }
public HexPane(FileHex hex) { super(hex.getHexText()); this.hex = hex; setEditable(false); // http://stackoverflow.com/questions/24983841/format-text-output-in-javafx setFont(Font.font("Courier New", 14)); }
@Override public void start(Stage primaryStage) { primaryStage.setTitle("CoAP Explorer"); Group root = new Group(); Scene scene = new Scene(root, 800, 600); TextArea hexArea = new TextArea(); TextArea binArea = new TextArea(); CoapPacket packet = new CoapPacket(); packet.setPayload("PAYLOAD"); packetProp.setValue(packet); binArea.textProperty().bindBidirectional(packetProp, new AsciiConverter()); hexArea.textProperty().bindBidirectional(packetProp, new HexConverter()); hexArea.setEditable(false); hexArea.setFont(javafx.scene.text.Font.font(Font.MONOSPACED)); VBox vbox = new VBox(); vbox.setPadding(new Insets(10)); vbox.setSpacing(8); VBox.setMargin(hexArea, new Insets(0, 0, 0, 8)); vbox.getChildren().add(hexArea); VBox.setMargin(binArea, new Insets(0, 0, 0, 8)); vbox.getChildren().add(binArea); root.getChildren().add(vbox); primaryStage.setScene(scene); primaryStage.show(); }
/** @param fp */ private void makeDialog(FlowPane fp) { Separator sp = new Separator(); // LOGO logoChildBP.setCenter(logo); // LBL TXT lblText = new Text(LBLTXT); Font mFont = Font.font("Dialog", FontPosture.ITALIC, 0xf); lblText.setFont(mFont); lblText.setFill(Color.BLUEVIOLET); lblText.setWrappingWidth(0x12c); labelChildBP.setCenter(lblText); // ---------------------------------------------------------------------- addItems(fp); // ---------------------------------------------------------------------- this.addButt = new Button("ADD NEW"); this.addButt.setDefaultButton(true); this.addButt.setAlignment(Pos.TOP_RIGHT); this.addButt.setOnAction( new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent t) { addNewItemsDialog(); primaryStage.close(); } }); fp.getChildren().add(addButt); }
private static Parent setTitle(String str) { final VBox vbox = new VBox(); final Text text = new Text(str); text.setFont(Font.font("Times New Roman", 24)); text.setFill(Color.WHEAT); vbox.getChildren().add(text); return vbox; }
private void addStaticContent() { createLegend(); final Text inputText = new Text("Input"); inputText.setX( getAnimationPaneWidth() / 2 - getAnimationPaneWidth() / 4 - inputText.getBoundsInLocal().getWidth() / 2); inputText.setY(20); inputText.setFont( Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize())); inputText.setFontSmoothingType(FontSmoothingType.LCD); animationPane.getChildren().add(inputText); final Text outputText = new Text("Output"); outputText.setX( getAnimationPaneWidth() / 2 + getAnimationPaneWidth() / 4 - outputText.getBoundsInLocal().getWidth() / 2); outputText.setY(20); outputText.setFont( Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize())); outputText.setFontSmoothingType(FontSmoothingType.LCD); animationPane.getChildren().add(outputText); final Text adapterText = new Text("Adapter"); adapterText.setX(getAnimationPaneWidth() / 2 - adapterText.getBoundsInLocal().getWidth() / 2); adapterText.setTranslateY(20); adapterText.setFont( Font.font(Font.getDefault().getName(), FontWeight.BOLD, Font.getDefault().getSize())); adapterText.setFontSmoothingType(FontSmoothingType.LCD); animationPane.getChildren().add(adapterText); Line lineInput = new Line(); lineInput.getStrokeDashArray().addAll(5d); lineInput.setCache(true); lineInput.startXProperty().set(getAnimationPaneWidth() / 2 - getAnimationPaneWidth() / 8); lineInput.endXProperty().set(lineInput.startXProperty().get()); lineInput.startYProperty().set(0); lineInput.endYProperty().bind(animationPane.heightProperty()); animationPane.getChildren().add(lineInput); Line lineOutput = new Line(); lineOutput.getStrokeDashArray().addAll(5d); lineOutput.setCache(true); lineOutput.startXProperty().set(getAnimationPaneWidth() / 2 + getAnimationPaneWidth() / 8); lineOutput.endXProperty().set(lineOutput.startXProperty().get()); lineOutput.startYProperty().set(0); lineOutput.endYProperty().bind(animationPane.heightProperty()); animationPane.getChildren().add(lineOutput); }
private void createFirebugButton() { firebugButton = new Button(FontAwesome.ICON_BUG); firebugButton.setFont(Font.font("FontAwesome", 14)); firebugButton.setTextFill(Color.RED); firebugButton.setTooltip(new Tooltip("Launch Firebug.")); firebugButton.disableProperty().bind(webEngine.getLoadWorker().runningProperty()); firebugButton.setOnAction(observable -> webEngine.executeScript(firebugScript)); }
public Church(Main.Location loc) { super(CHURCH, loc); Label label = new Label(); label.textProperty().bind(mealsServed.asString()); label.setFont(Font.font("Impact", 12 * Main.SCALE)); label.setTranslateX(-8 * Main.SCALE); label.setTranslateY(3 * Main.SCALE); getChildren().add(label); }
@Override public void start(Stage primaryStage) throws Exception { // Load the font Font.loadFont(getClass().getResource("/fonts/VarelaRound-Regular.ttf").toExternalForm(), 10); Parent root = FXMLLoader.load(getClass().getResource("/fxml/home.fxml")); primaryStage.setScene(new Scene(root, 500, 500)); primaryStage.setResizable(false); primaryStage.show(); }
/** Constructor to create to access the GridPane created for adding organizations. */ public QuestionnaireAdd() { // PaneController.addMap(TITLE, this); // GridPane gp = new GridPane(); label = new Label("Create a New Questionnaire"); label.setFont(Font.font("Verdana", FontWeight.BOLD, 18)); }
private HBox createLabelBox() { Text label = new Text("E-Bazaar"); label.setFont(Font.font("Comic Sans MS", FontWeight.BOLD, 60)); label.setFill(Color.DARKRED); HBox labelBox = new HBox(10); labelBox.setAlignment(Pos.CENTER); labelBox.getChildren().add(label); return labelBox; }
private Text createText(String s, int yPos, int size) { Font font = Font.loadFont(getClass().getClassLoader().getResourceAsStream("SECRCODE.TTF"), size); Text t = new Text(s); t.setFont(font); t.setLayoutX((WIDTH - t.getBoundsInLocal().getWidth()) / 2); t.setLayoutY(yPos); root.getChildren().add(t); return t; }
@Override protected void initUI() { Text scoreText = new Text(); scoreText.setFont(Font.font(18)); scoreText.setTranslateX(1100); scoreText.setTranslateY(50); scoreText.textProperty().bind(score.asString("Score: %d")); getGameScene().addUINode(scoreText); }