List of usage examples for javafx.scene.control Label setText
public final void setText(String value)
From source file:deincraftlauncher.InstallController.java
@Override public void initialize(URL url, ResourceBundle rb) { instance = this; System.out.println("Starting Installer UI..."); int saveX = 393; int cancelY = 165; int saveY = 200; int sizeX = 481; Rectangle separator = new Rectangle(); separator.setWidth(sizeX);//from w w w. j ava 2 s .co m separator.setHeight(separatorSizeY); separator.setLayoutY(separatorY); separator.setFill(blueColor); mainPanel.getChildren().add(separator); mainPanel.setBackground(Background.EMPTY); TextButton cancel = new TextButton(saveX, cancelY, "cancel", Color.RED, mainPanel); cancel.setOnClick((TextButton tile) -> { cancel(); }); save = new TextButton(saveX, saveY, "Weiter", Color.GRAY, mainPanel); save.setFocusable(false); save.setOnClick((TextButton tile) -> { Continue(); }); login = new TextButton(14, 151, "Login", Color.BLUE, mainPanel); login.setOnClick((TextButton tile) -> { doLogin(null); }); Label Title = new Label(); Title.setText("Installer"); Title.setPrefSize(sizeX, separatorY); Title.setTextFill(Color.WHITESMOKE); Title.setTextAlignment(TextAlignment.CENTER); Title.setFont(DesignHelpers.getFocusFont(42)); Title.setAlignment(Pos.CENTER); mainPanel.getChildren().add(Title); pathLabel.setBackground(new Background(new BackgroundFill(Color.rgb(170, 170, 170), radii, insets))); //ContinueButton.setBackground(new Background(new BackgroundFill(Color.rgb(100, 190, 100), radii, insets))); //Green Version setDefaultPath(); System.out.println("starting done"); }
From source file:calendarioSeries.vistas.MainViewController.java
@FXML private void handleButtonPressed(ActionEvent event) { Button buttonClicked = (Button) event.getSource(); String id = buttonClicked.getId(); for (Label diasMe : diasMes) { diasMe.setText(""); }//from ww w.java 2 s. co m if (id.equals("next")) { if (mesActual.getNumMes() != 11) { mesActual = new Mes(mesActual.getNumAno(), mesActual.getNumMes() + 1); } else { mesActual = new Mes(mesActual.getNumAno() + 1, 0); } } else if (id.equals("previous")) { if (mesActual.getNumMes() != 0) { mesActual = new Mes(mesActual.getNumAno(), mesActual.getNumMes() - 1); } else { mesActual = new Mes(mesActual.getNumAno() - 1, 11); } } showDetallesMes(mesActual); event.consume(); }
From source file:Person.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 500, 250, Color.WHITE); // create a grid pane GridPane gridpane = new GridPane(); gridpane.setPadding(new Insets(5)); gridpane.setHgap(10);//from w ww . ja v a 2 s .co m gridpane.setVgap(10); ObservableList<Person> leaders = FXCollections.observableArrayList(); leaders.add(new Person("A", "B", "C")); leaders.add(new Person("D", "E", "F")); final ListView<Person> leaderListView = new ListView<Person>(leaders); leaderListView.setPrefWidth(150); leaderListView.setPrefHeight(150); // leaderListView.setCellFactory(new Callback<ListView<Person>, ListCell<Person>>() { public ListCell<Person> call(ListView<Person> param) { final Label leadLbl = new Label(); final Tooltip tooltip = new Tooltip(); final ListCell<Person> cell = new ListCell<Person>() { @Override public void updateItem(Person item, boolean empty) { super.updateItem(item, empty); if (item != null) { leadLbl.setText(item.getAliasName()); setText(item.getFirstName() + " " + item.getLastName()); tooltip.setText(item.getAliasName()); setTooltip(tooltip); } } }; // ListCell return cell; } }); // setCellFactory gridpane.add(leaderListView, 0, 1); leaderListView.getSelectionModel().selectedItemProperty().addListener(new ChangeListener<Person>() { public void changed(ObservableValue<? extends Person> observable, Person oldValue, Person newValue) { System.out.println("selection changed"); } }); root.getChildren().add(gridpane); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Imported Fruits"); stage.setWidth(500);/*from w w w . ja va2 s . co m*/ stage.setHeight(500); ObservableList<PieChart.Data> pieChartData = FXCollections.observableArrayList( new PieChart.Data("Grapefruit", 13), new PieChart.Data("Oranges", 25), new PieChart.Data("Plums", 10), new PieChart.Data("Pears", 22), new PieChart.Data("Apples", 30)); final PieChart chart = new PieChart(pieChartData); chart.setTitle("Imported Fruits"); final Label caption = new Label(""); caption.setTextFill(Color.DARKORANGE); caption.setStyle("-fx-font: 24 arial;"); for (final PieChart.Data data : chart.getData()) { data.getNode().addEventHandler(MouseEvent.MOUSE_PRESSED, new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent e) { caption.setTranslateX(e.getSceneX()); caption.setTranslateY(e.getSceneY()); caption.setText(String.valueOf(data.getPieValue()) + "%"); } }); } ((Group) scene.getRoot()).getChildren().addAll(chart, caption); stage.setScene(scene); //scene.getStylesheets().add("piechartsample/Chart.css"); stage.show(); }
From source file:com.panemu.tiwulfx.control.DetailPanel.java
private void displayValues() { for (String prop : propertyNames) { try {//from w w w .j a v a 2 s .c om Label lblValue = componentMap.get(prop); Object obj = PropertyUtils.getSimpleProperty(objectToDisplay, prop); if (obj != null) { /** * There is a bug in Label control. When the text's length * is 1 and the wrapText property is true, the label display * nothing. Workaround, don't wrap is the text's length is 1 */ if (obj.toString().length() == 1) { lblValue.setWrapText(false); } lblValue.setText(obj.toString()); } else { lblValue.setText("-- undefined --"); } } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException ex) { throw new RuntimeException(ex.getMessage()); } } }
From source file:mesclasses.view.JourneeController.java
private void writeAndMarkInRed(Label label, int value, int threshold) { label.setText("" + value); if (value >= threshold) { CssUtil.addClass(label, "text-red"); } else {// w w w .j ava 2 s.c o m CssUtil.removeClass(label, "text-red"); } }
From source file:Main.java
@Override public void start(Stage primaryStage) { final Label markerText = new Label(); StackPane.setAlignment(markerText, Pos.TOP_CENTER); String workingDir = System.getProperty("user.dir"); final File f = new File(workingDir, "../media/omgrobots.flv"); final Media m = new Media(f.toURI().toString()); final ObservableMap<String, Duration> markers = m.getMarkers(); markers.put("Robot Finds Wall", Duration.millis(3100)); markers.put("Then Finds the Green Line", Duration.millis(5600)); markers.put("Robot Grabs Sled", Duration.millis(8000)); markers.put("And Heads for Home", Duration.millis(11500)); final MediaPlayer mp = new MediaPlayer(m); mp.setOnMarker(new EventHandler<MediaMarkerEvent>() { @Override/*from ww w . j a v a 2 s .c o m*/ public void handle(final MediaMarkerEvent event) { Platform.runLater(new Runnable() { @Override public void run() { markerText.setText(event.getMarker().getKey()); } }); } }); final MediaView mv = new MediaView(mp); final StackPane root = new StackPane(); root.getChildren().addAll(mv, markerText); root.setOnMouseClicked(new EventHandler<MouseEvent>() { @Override public void handle(MouseEvent event) { mp.seek(Duration.ZERO); markerText.setText(""); } }); final Scene scene = new Scene(root, 960, 540); final URL stylesheet = getClass().getResource("media.css"); scene.getStylesheets().add(stylesheet.toString()); primaryStage.setScene(scene); primaryStage.setTitle("Video Player 2"); primaryStage.show(); mp.play(); }
From source file:eu.over9000.skadi.ui.dialogs.PerformUpdateDialog.java
public PerformUpdateDialog(RemoteVersionResult newVersion) { this.chosen = new SimpleObjectProperty<>( Paths.get(SystemUtils.USER_HOME, newVersion.getVersion() + ".jar").toFile()); this.setHeaderText("Updating to " + newVersion.getVersion()); this.setTitle("Skadi Updater"); this.getDialogPane().getStyleClass().add("alert"); this.getDialogPane().getStyleClass().add("information"); final ButtonType restartButtonType = new ButtonType("Start New Version", ButtonBar.ButtonData.OK_DONE); this.getDialogPane().getButtonTypes().addAll(restartButtonType, ButtonType.CANCEL); Node btn = this.getDialogPane().lookupButton(restartButtonType); btn.setDisable(true);/*from ww w . j ava 2 s. c o m*/ Label lbPath = new Label("Save as"); TextField tfPath = new TextField(); tfPath.textProperty() .bind(Bindings.createStringBinding(() -> this.chosen.get().getAbsolutePath(), this.chosen)); tfPath.setPrefColumnCount(40); tfPath.setEditable(false); Button btChangePath = GlyphsDude.createIconButton(FontAwesomeIcons.FOLDER_OPEN, "Browse..."); btChangePath.setOnAction(event -> { FileChooser fc = new FileChooser(); fc.setTitle("Save downloaded jar.."); fc.setInitialFileName(this.chosen.getValue().getName()); fc.getExtensionFilters().add(new FileChooser.ExtensionFilter("Jar File", ".jar")); fc.setInitialDirectory(this.chosen.getValue().getParentFile()); File selected = fc.showSaveDialog(this.getOwner()); if (selected != null) { this.chosen.set(selected); } }); ProgressBar pbDownload = new ProgressBar(0); pbDownload.setDisable(true); pbDownload.setMaxWidth(Double.MAX_VALUE); Label lbDownload = new Label("Download"); Label lbDownloadValue = new Label(); Button btDownload = GlyphsDude.createIconButton(FontAwesomeIcons.DOWNLOAD, "Start"); btDownload.setMaxWidth(Double.MAX_VALUE); btDownload.setOnAction(event -> { btChangePath.setDisable(true); btDownload.setDisable(true); this.downloadService = new DownloadService(newVersion.getDownloadURL(), this.chosen.getValue()); lbDownloadValue.textProperty().bind(this.downloadService.messageProperty()); pbDownload.progressProperty().bind(this.downloadService.progressProperty()); this.downloadService.setOnSucceeded(dlEvent -> { btn.setDisable(false); }); this.downloadService.setOnFailed(dlFailed -> { LOGGER.error("new version download failed", dlFailed.getSource().getException()); lbDownloadValue.textProperty().unbind(); lbDownloadValue.setText("Download failed, check log file for details."); }); this.downloadService.start(); }); final GridPane grid = new GridPane(); grid.setHgap(10); grid.setVgap(10); grid.add(lbPath, 0, 0); grid.add(tfPath, 1, 0); grid.add(btChangePath, 2, 0); grid.add(new Separator(), 0, 1, 3, 1); grid.add(lbDownload, 0, 2); grid.add(pbDownload, 1, 2); grid.add(btDownload, 2, 2); grid.add(lbDownloadValue, 1, 3); this.getDialogPane().setContent(grid); this.setResultConverter(btnType -> { if (btnType == restartButtonType) { return this.chosen.getValue(); } if (btnType == ButtonType.CANCEL) { if (this.downloadService.isRunning()) { this.downloadService.cancel(); } } return null; }); }
From source file:hd3gtv.as5kpc.Serverchannel.java
void appCue(TextField mediaid, Label takenum, TextField showname, Button btncue, Button btnrec) { int id;/*from ww w . ja va 2 s. c o m*/ int take; try { id = Integer.parseInt(mediaid.getText()); take = Integer.valueOf(takenum.getText()); } catch (Exception e) { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Media ID"); alert.setHeaderText("Erreur lors de la rcupration de l'ID, seuls des chiffres sont autoriss."); alert.setContentText("Dtail: " + e.getMessage()); alert.showAndWait(); return; } GetFreeClipIdBackgound gfip = getFreeClipIdBackgound(id + getVtrIndex(), take); gfip.setOnSucceeded((WorkerStateEvent ev) -> { takenum.setText(gfip.getValue().get("take")); String first_name = gfip.getValue().get("first_name"); if (first_name != null) { final String _first_name = first_name.substring("00-00 ".length()); showname.setText(_first_name); if (_first_name.endsWith(getServerLabel())) { showname.setText( _first_name.substring(0, _first_name.length() - getServerLabel().length()).trim()); } } btncue.setDisable(false); mediaid.setDisable(false); showname.setDisable(false); btnrec.setDisable(false); }); gfip.setOnFailed((WorkerStateEvent ev) -> { Alert alert = new Alert(AlertType.WARNING); alert.setTitle("Cue"); alert.setHeaderText("Impossible de rcuperer un tat"); alert.setContentText("La rcupration du statut de l'Id " + id + " n'a pas fonctionn."); alert.showAndWait(); mediaid.setDisable(false); showname.setDisable(false); }); gfip.start(); }
From source file:at.ac.tuwien.qse.sepm.gui.controller.impl.OrganizerImpl.java
private void initializeFilesTree() { folderTree.setOnMouseClicked(event -> handleFolderChange()); folderTree.setCellFactory(treeView -> { HBox hbox = new HBox(); hbox.setMaxWidth(200);//from ww w .java 2 s .c o m hbox.setPrefWidth(200); hbox.setSpacing(7); FontAwesomeIconView openFolderIcon = new FontAwesomeIconView(FontAwesomeIcon.FOLDER_OPEN_ALT); openFolderIcon.setTranslateY(7); FontAwesomeIconView closedFolderIcon = new FontAwesomeIconView(FontAwesomeIcon.FOLDER_ALT); closedFolderIcon.setTranslateY(7); Label dirName = new Label(); dirName.setMaxWidth(150); FontAwesomeIconView removeIcon = new FontAwesomeIconView(FontAwesomeIcon.REMOVE); Tooltip deleteToolTip = new Tooltip(); deleteToolTip.setText("Verzeichnis aus Workspace entfernen"); Button button = new Button(null, removeIcon); button.setTooltip(deleteToolTip); button.setTranslateX(8); return new TreeCell<String>() { @Override public void updateItem(String item, boolean empty) { super.updateItem(item, empty); if (item == null || empty) { setGraphic(null); setText(null); } else if (getTreeItem() instanceof FilePathTreeItem) { hbox.getChildren().clear(); dirName.setText(item); if (getTreeItem().isExpanded()) { hbox.getChildren().add(openFolderIcon); } else { hbox.getChildren().add(closedFolderIcon); } hbox.getChildren().add(dirName); TreeItem<String> treeItem = getTreeItem(); TreeItem<String> parent = treeItem != null ? treeItem.getParent() : null; if (parent != null && parent.equals(folderTree.getRoot())) { String path = ((FilePathTreeItem) getTreeItem()).getFullPath(); button.setOnAction(event -> handleDeleteDirectory(Paths.get(path))); hbox.getChildren().add(button); } setGraphic(hbox); } } }; }); }