List of usage examples for javafx.scene.control Label Label
public Label()
From source file:Main.java
@Override public void start(Stage primaryStage) { Button btn = new Button(); final Label lbl = new Label(); primaryStage.setTitle("Hello World!"); lbl.setLayoutX(70);/*from w w w . jav a 2s . c om*/ lbl.setLayoutY(150); btn.setLayoutX(100); btn.setLayoutY(100); btn.setText("Hello, World!"); btn.setOnAction(new EventHandler<ActionEvent>() { @Override public void handle(ActionEvent event) { lbl.setText("Hello, World."); } }); Group root = new Group(); root.getChildren().add(btn); root.getChildren().add(lbl); primaryStage.setScene(new Scene(root, 300, 250)); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { stage.setTitle("ComboBoxSample"); Scene scene = new Scene(new Group(), 450, 250); Label notification = new Label(); notification.setText("Label"); GridPane grid = new GridPane(); grid.setVgap(4);//from w ww .j a v a 2 s . co m grid.setHgap(10); grid.setPadding(new Insets(5, 5, 5, 5)); grid.add(new Label("To: "), 0, 0); grid.add(notification, 1, 0); Group root = (Group) scene.getRoot(); root.getChildren().add(grid); stage.setScene(scene); stage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Group root = new Group(); Scene scene = new Scene(root, 300, 150); stage.setScene(scene);/*from ww w . jav a2s . c o m*/ stage.setTitle("Progress Controls"); for (int i = 0; i < values.length; i++) { final Label label = labels[i] = new Label(); label.setText("progress:" + values[i]); final ProgressBar pb = pbs[i] = new ProgressBar(); pb.setProgress(values[i]); final ProgressIndicator pin = pins[i] = new ProgressIndicator(); pin.setProgress(values[i]); final HBox hb = hbs[i] = new HBox(); hb.setSpacing(5); hb.setAlignment(Pos.CENTER); hb.getChildren().addAll(label, pb, pin); } final VBox vb = new VBox(); vb.setSpacing(5); vb.getChildren().addAll(hbs); scene.setRoot(vb); stage.show(); }
From source file:com.panemu.tiwulfx.control.DetailPanel.java
private void generateUI() { this.getChildren().removeAll(this.getChildren()); for (String prop : propertyNames) { LabelSeparator labelSeparator = new LabelSeparator(""); labelSeparator.setText(prop);// w w w. j a v a 2s. c o m VBox.setMargin(labelSeparator, new Insets(10, 0, 0, 0)); this.getChildren().add(labelSeparator); Label lblValue = new Label(); lblValue.getStyleClass().add("valueLabel"); lblValue.setWrapText(true); this.getChildren().add(lblValue); componentMap.put(prop, lblValue); } }
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 w ww.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:com.playonlinux.ui.impl.javafx.mainwindow.center.ViewApps.java
private void initFailure() { failurePanel = new VBox(); failurePanel.getStyleClass().add("rightPane"); failurePanel.setSpacing(10);/* w w w. ja v a 2 s .c o m*/ failurePanel.setAlignment(Pos.CENTER); Label failureNotificationLbl = new Label(); failureNotificationLbl.setText(translate( "Connecting to ${application.name} failed.\n" + "Please check your connection and try again.")); failureNotificationLbl.setTextAlignment(TextAlignment.CENTER); ImageView retryImage = new ImageView(new Image(getClass().getResourceAsStream("refresh.png"))); retryImage.setFitWidth(16); retryImage.setFitHeight(16); retryButton = new Button(translate("Retry"), retryImage); failurePanel.getChildren().addAll(failureNotificationLbl, retryButton); }
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);/*w w w . j a v a2s . c om*/ 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
private void createControls() { artist = new Label(); artist.setId("artist"); album = new Label(); album.setId("album"); title = new Label(); title.setId("title"); year = new Label(); year.setId("year"); final Reflection reflection = new Reflection(); reflection.setFraction(0.2);// w ww . j a va2s.c om // final URL url = getClass().getResource("resources/defaultAlbum.png"); // final Image image = new Image(url.toString()); // albumCover = new ImageView(image); // albumCover.setFitWidth(240); // albumCover.setPreserveRatio(true); // albumCover.setSmooth(true); // albumCover.setEffect(reflection); }
From source file:ruleprunermt2.FXMLDocumentController.java
public FXMLDocumentController() { this.fileName = new Label(); this.kValue = new Label(); this.seedName = new Label(); }
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);// w w w . ja v a 2 s . c o 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"); }