Java Code Examples for javafx.scene.control.Label#setPrefHeight()
The following examples show how to use
javafx.scene.control.Label#setPrefHeight() .
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: TimelinePanel.java From constellation with Apache License 2.0 | 6 votes |
private Label createExtentLabel() { final Label newLabel = new Label(); // Align the text vertically: newLabel.setRotate(270d); // Fix the dimensions to prevent jittery motion on value changes: newLabel.setMinWidth(150d); newLabel.setPrefWidth(150d); newLabel.setMaxWidth(150d); newLabel.setMinHeight(30d); newLabel.setPrefHeight(30d); newLabel.setMaxHeight(30d); newLabel.setAlignment(Pos.CENTER); return newLabel; }
Example 2
Source File: PickerAssignee.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
private Label getAssigneeLabel() { Label assigneeLoginName = new Label(getLoginName()); FontLoader fontLoader = Toolkit.getToolkit().getFontLoader(); double width = fontLoader.computeStringWidth(assigneeLoginName.getText(), assigneeLoginName.getFont()); assigneeLoginName.setPrefWidth(width + 35); assigneeLoginName.setPrefHeight(LABEL_HEIGHT); assigneeLoginName.getStyleClass().add("labels"); return assigneeLoginName; }
Example 3
Source File: PickerAssignee.java From HubTurbo with GNU Lesser General Public License v3.0 | 5 votes |
private Label getAssigneeLabelWithAvatar() { Label assignee = new Label(getLoginName()); assignee.setGraphic(getAvatarImageView()); FontLoader fontLoader = Toolkit.getToolkit().getFontLoader(); double width = fontLoader.computeStringWidth(assignee.getText(), assignee.getFont()); assignee.setPrefWidth(width + 35 + AVATAR_SIZE); assignee.setPrefHeight(LABEL_HEIGHT); assignee.getStyleClass().add("labels"); assignee.setStyle("-fx-background-color: lightgreen;"); return assignee; }
Example 4
Source File: ArtistsController.java From MusicPlayer with MIT License | 4 votes |
private VBox createCell(Artist artist) { VBox cell = new VBox(); Label title = new Label(artist.getTitle()); ImageView image = new ImageView(artist.getArtistImage()); image.imageProperty().bind(artist.artistImageProperty()); VBox imageBox = new VBox(); title.setTextOverrun(OverrunStyle.CLIP); title.setWrapText(true); title.setPadding(new Insets(10, 0, 10, 0)); title.setAlignment(Pos.TOP_LEFT); title.setPrefHeight(66); title.prefWidthProperty().bind(grid.widthProperty().subtract(100).divide(5).subtract(1)); image.fitWidthProperty().bind(grid.widthProperty().subtract(100).divide(5).subtract(1)); image.fitHeightProperty().bind(grid.widthProperty().subtract(100).divide(5).subtract(1)); image.setPreserveRatio(true); image.setSmooth(true); imageBox.prefWidthProperty().bind(grid.widthProperty().subtract(100).divide(5).subtract(1)); imageBox.prefHeightProperty().bind(grid.widthProperty().subtract(100).divide(5).subtract(1)); imageBox.setAlignment(Pos.CENTER); imageBox.getChildren().add(image); cell.getChildren().addAll(imageBox, title); cell.setPadding(new Insets(10, 10, 0, 10)); cell.getStyleClass().add("artist-cell"); cell.setAlignment(Pos.CENTER); cell.setOnMouseClicked(event -> { MainController mainController = MusicPlayer.getMainController(); ArtistsMainController artistsMainController = (ArtistsMainController) mainController.loadView("ArtistsMain"); VBox artistCell = (VBox) event.getSource(); String artistTitle = ((Label) artistCell.getChildren().get(1)).getText(); Artist a = Library.getArtist(artistTitle); artistsMainController.selectArtist(a); }); cell.setOnDragDetected(event -> { PseudoClass pressed = PseudoClass.getPseudoClass("pressed"); cell.pseudoClassStateChanged(pressed, false); Dragboard db = cell.startDragAndDrop(TransferMode.ANY); ClipboardContent content = new ClipboardContent(); content.putString("Artist"); db.setContent(content); MusicPlayer.setDraggedItem(artist); db.setDragView(cell.snapshot(null, null), cell.widthProperty().divide(2).get(), cell.heightProperty().divide(2).get()); event.consume(); }); return cell; }