List of usage examples for javafx.scene.text TextFlow setTextAlignment
public final void setTextAlignment(TextAlignment value)
From source file:de.pixida.logtest.designer.testrun.TestRunEditor.java
public TitledPane createPanelForLaunchingTests() { final Button startBtn = new Button("Run Test"); startBtn.disableProperty().bind(this.testRunService.runningProperty()); final double startButtonPadding = 8d; startBtn.setPadding(new Insets(startButtonPadding)); startBtn.setGraphic(Icons.getIconGraphics("control_play_blue")); HBox.setHgrow(startBtn, Priority.ALWAYS); startBtn.setMaxWidth(Double.MAX_VALUE); startBtn.setOnAction(event -> {//from w w w.ja va2 s. com final Job job = this.createJobFromConfig(); this.testRunService.setJob(job); this.testRunService.start(); }); final HBox startLine = new HBox(); startLine.getChildren().add(startBtn); final VBox runLines = new VBox(); final double linesSpacing = 10d; runLines.setSpacing(linesSpacing); final TextFlow resultBar = new TextFlow(); resultBar.backgroundProperty().bind(this.resultBarBackgroundProperty); this.resultBarBackgroundProperty.set(RESULT_BAR_BACKGROUND_IDLE); resultBar.setStyle("-fx-border-color: black; -fx-border-width:1"); final Text resultBarText = new Text(); resultBarText.textProperty().bind(this.resultBarTextProperty); this.resultBarTextProperty.set("Idle"); resultBar.getChildren().add(resultBarText); resultBar.setTextAlignment(TextAlignment.CENTER); final double resultBarPadding = 2d; resultBar.setPadding(new Insets(resultBarPadding)); final int logOutputLinesSize = 25; this.resultLogOutputText.setPrefRowCount(logOutputLinesSize); this.resultLogOutputText.setEditable(false); this.resultLogOutputText.setStyle("-fx-font-family: monospace"); HBox.setHgrow(this.resultLogOutputText, Priority.ALWAYS); runLines.getChildren().addAll(startLine, new Text("Recent results:"), resultBar, this.resultLogOutputText); final TitledPane runPane = new TitledPane("Run", runLines); runPane.setGraphic(Icons.getIconGraphics("lightning_go")); runPane.setCollapsible(false); return runPane; }
From source file:org.pdfsam.ui.news.News.java
News(NewsData data) { this.getStyleClass().add("news-box"); TextFlow flow = new TextFlow(); if (data.isImportant()) { Text megaphone = GlyphsDude.createIcon(FontAwesomeIcon.BULLHORN, "1.2em"); megaphone.getStyleClass().clear(); megaphone.getStyleClass().add("news-box-title-important"); flow.getChildren().addAll(megaphone, new Text(" ")); }/*from ww w . j a va2s .com*/ Text titleText = new Text(data.getTitle() + System.lineSeparator()); titleText.setOnMouseClicked(e -> eventStudio().broadcast(new OpenUrlRequest(data.getLink()))); titleText.getStyleClass().add("news-box-title"); Text contentText = new Text(data.getContent()); contentText.setTextAlignment(TextAlignment.JUSTIFY); contentText.getStyleClass().add("news-content"); flow.getChildren().addAll(titleText, contentText); flow.setTextAlignment(TextAlignment.JUSTIFY); Label labelDate = new Label(FORMATTER.format(data.getDate()), GlyphsDude.createIcon(MaterialDesignIcon.CLOCK)); labelDate.setPrefWidth(Integer.MAX_VALUE); HBox.setHgrow(labelDate, Priority.ALWAYS); HBox bottom = new HBox(labelDate); bottom.setAlignment(Pos.CENTER_LEFT); bottom.getStyleClass().add("news-box-footer"); if (isNotBlank(data.getLink())) { Button link = UrlButton.urlButton(null, data.getLink(), FontAwesomeIcon.EXTERNAL_LINK_SQUARE, "pdfsam-toolbar-button"); bottom.getChildren().add(link); } getChildren().addAll(flow, bottom); }