List of usage examples for javafx.scene.control Label setFont
public final void setFont(Font value)
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle("VBox Test"); VBox vb = new VBox(); vb.setPadding(new Insets(10, 50, 50, 50)); vb.setSpacing(10);//from w w w . ja v a2 s .c om vb.setAlignment(Pos.BASELINE_LEFT); System.out.println(vb.getAlignment()); Label lbl = new Label("VBox"); lbl.setFont(Font.font("Amble CN", FontWeight.BOLD, 24)); vb.getChildren().add(lbl); Button btn1 = new Button(); btn1.setText("Button1"); vb.getChildren().add(btn1); Button btn2 = new Button(); btn2.setText("Button2"); vb.getChildren().add(btn2); Button btn3 = new Button(); btn3.setText("Button3"); vb.getChildren().add(btn3); Button btn4 = new Button(); btn4.setText("Button4"); vb.getChildren().add(btn4); // Adding VBox to the scene Scene scene = new Scene(vb); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage stage) { Scene scene = new Scene(new Group()); stage.setTitle("Table View Sample"); stage.setWidth(300);/* w w w .j a v a 2 s . c om*/ stage.setHeight(500); final Label label = new Label("Student IDs"); label.setFont(new Font("Arial", 20)); TableColumn<Map, String> firstDataColumn = new TableColumn<>("Class A"); TableColumn<Map, String> secondDataColumn = new TableColumn<>("Class B"); firstDataColumn.setCellValueFactory(new MapValueFactory(Column1MapKey)); firstDataColumn.setMinWidth(130); secondDataColumn.setCellValueFactory(new MapValueFactory(Column2MapKey)); secondDataColumn.setMinWidth(130); TableView tableView = new TableView<>(generateDataInMap()); tableView.setEditable(true); tableView.getSelectionModel().setCellSelectionEnabled(true); tableView.getColumns().setAll(firstDataColumn, secondDataColumn); Callback<TableColumn<Map, String>, TableCell<Map, String>> cellFactoryForMap = ( TableColumn<Map, String> p) -> new TextFieldTableCell(new StringConverter() { @Override public String toString(Object t) { return t.toString(); } @Override public Object fromString(String string) { return string; } }); firstDataColumn.setCellFactory(cellFactoryForMap); secondDataColumn.setCellFactory(cellFactoryForMap); final VBox vbox = new VBox(); vbox.setSpacing(5); vbox.setPadding(new Insets(10, 0, 0, 10)); vbox.getChildren().addAll(label, tableView); ((Group) scene.getRoot()).getChildren().addAll(vbox); stage.setScene(scene); stage.show(); }
From source file:ui.ChoseFonctionnalite.java
private void startClientMode(ActionEvent eventT) { //File config = new File("resource/config.json"); String host = ""; String port = "8000"; Stage stageModal = new Stage(); Pane root = new Pane(); root.setBackground(new Background(new BackgroundImage(new Image("resource/background.jpg"), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, new BackgroundSize(530, 400, true, true, true, true)))); stageModal.setScene(new Scene(root, 200, 200)); stageModal.initStyle(StageStyle.UTILITY); Label adresse = new Label("Adresse serveur:"); adresse.setLayoutX(10);/* ww w . j ava2s.c o m*/ adresse.setLayoutY(10); adresse.setFont(Font.font("Arial", 16)); JFXTextField adresseInput = new JFXTextField("127.0.0.1"); adresseInput.setPrefWidth(180); adresseInput.setLayoutX(10); adresseInput.setLayoutY(40); JFXButton valider = new JFXButton("Se connecter"); valider.setCursor(Cursor.HAND); valider.setMinSize(100, 30); valider.setLayoutX(20); valider.setLayoutY(130); valider.setFont(new Font(20)); valider.setStyle("-fx-background-color: #9E21FF;"); valider.setOnAction(event -> { if (adresseInput.getText() != "") { stageModal.close(); InitClient initializeClient = new InitClient(stage, adresseInput.getText(), port); } }); root.getChildren().add(valider); root.getChildren().add(adresse); root.getChildren().add(adresseInput); stageModal.setTitle("Adresse serveur"); stageModal.initModality(Modality.WINDOW_MODAL); stageModal.initOwner(((Node) eventT.getSource()).getScene().getWindow()); stageModal.show(); }
From source file:net.thirdy.blackmarket.controls.ModSelectionPane.java
public ModSelectionPane() { setHgap(5.0);/*from w ww. j av a 2 s . c o m*/ setMaxHeight(Double.MAX_VALUE); setMinHeight(560); setAlignment(Pos.CENTER); setupModListView(); accept(Collections.emptyList()); setupModMappingTable(); setupFilterTextField(); tfMinShouldMatch = new DoubleTextField("Minimum number of OR modifiers to match"); tfMinShouldMatch.setMinWidth(350); Button add = addButton(); add.setPrefWidth(150); HBox hBox = new HBox(5, new Label("Filter: "), filterField, add); hBox.setAlignment(Pos.CENTER); VBox.setVgrow(modMappingTable, Priority.ALWAYS); VBox left = new VBox(10, hBox, modMappingTable); VBox.setVgrow(modsListView, Priority.ALWAYS); Label modifiersLbl = new Label("Modifiers"); modifiersLbl.setFont(Font.font("Verdana", FontWeight.MEDIUM, 14)); modifiersLbl.setPadding(new Insets(4)); HBox minShouldMatchHBox = new HBox(3, new Label("Minimum OR Matches:"), tfMinShouldMatch); minShouldMatchHBox.setAlignment(Pos.CENTER); VBox right = new VBox(3, new StackPane(modifiersLbl), minShouldMatchHBox, modsListView); setupGridPaneColumns(); GridPane.setVgrow(left, Priority.ALWAYS); GridPane.setVgrow(right, Priority.ALWAYS); add(left, 0, 0); add(right, 1, 0); }
From source file:ui.ChoseFonctionnalite.java
private void initUI() { Pane root = new Pane(); root.setBackground(new Background(new BackgroundImage(new Image("resource/background.jpg"), BackgroundRepeat.NO_REPEAT, BackgroundRepeat.NO_REPEAT, BackgroundPosition.CENTER, new BackgroundSize(530, 400, true, true, true, true)))); JFXButton serveur = new JFXButton("SERVEUR"); serveur.setCursor(Cursor.HAND); serveur.setMinSize(171, 57);/*from w w w . j a v a2s. co m*/ serveur.setLayoutX(179); serveur.setLayoutY(90); serveur.setFont(new Font(27)); serveur.setStyle("-fx-background-color: #9E21FF;"); serveur.setOnAction(event -> { startServerMode(); }); JFXButton client = new JFXButton("CLIENT"); client.setCursor(Cursor.HAND); client.setMinSize(171, 57); client.setLayoutX(179); client.setLayoutY(197); client.setFont(new Font(27)); client.setStyle("-fx-background-color: #9E21FF;"); client.setOnAction(event -> { startClientMode(event); }); Label info = new Label("choisir la maniere d'utiliser virtual remote"); info.setMinSize(529, 43); info.setLayoutX(10); info.setLayoutY(14); info.setFont(new Font("Algerian", 20)); root.getChildren().add(client); root.getChildren().add(serveur); root.getChildren().add(info); Scene scene = new Scene(root, 530, 400); stage.setTitle("Fontionnalit"); stage.setScene(scene); stage.setResizable(false); stage.initStyle(StageStyle.DECORATED); stage.setOnCloseRequest(event -> { System.exit(1); }); stage.show(); }
From source file:photobooth.views.EmailPane.java
private void addLabel() { String text = Global.getPhrase("email_pane_text"); Label label = new Label(text); label.setWrapText(true);//from ww w. j av a 2 s . c o m label.setLayoutX(50); label.setLayoutY(150); label.setMaxWidth(700); label.setTextAlignment(TextAlignment.CENTER); label.setFont(new Font(40)); label.setTextFill(Color.web("#000")); this.getChildren().add(label); }
From source file:ch.tuason.djbattlescore.lib.components.comps.ResultGridPane.java
/** * adds a certain DjEntity to the ranking grid panel... * // w ww .j a va2 s.c o m * @param results a Collection of DjEntity... */ public void addCurrentDJRanking(Collection<DjEntity> results) { this.addedRankingComponents.clear(); this.currentDjRanking = results; if (this.currentDjRanking != null && !this.currentDjRanking.isEmpty()) { int iPos = 1; for (DjEntity dj : this.currentDjRanking) { Image djImage = null; if (!StringUtils.isEmpty(dj.getAvatarPicPath32())) { djImage = getImageFromCache(dj); if (djImage == null) { try { djImage = new Image(getClass().getResourceAsStream( DjBattleConstants.IMAGE_RESOURCE_BASE_FOR_DJ_PICS + dj.getAvatarPicPath32())); if (!djImage.isError()) { imageCache.put(dj.getId(), djImage); } } catch (Exception e) { System.out.println("the image for dj '" + dj.getName() + "' could not be loaded for the avatar image... " + e.getMessage()); djImage = null; } } // it might be an absolute path? if (djImage == null) { try { djImage = new Image( DjBattleConstants.ABSOLUTE_IMAGE_FILEPATH_PREFIX + dj.getAvatarPicPath32()); if (!djImage.isError()) { imageCache.put(dj.getId(), djImage); } } catch (Exception e) { System.out.println("the image for dj '" + dj.getName() + "' could not be loaded for the avatar image... " + e.getMessage()); djImage = null; } } if (djImage == null) { djImage = getStandardImage(); } } if (StringUtils.isEmpty(dj.getAvatarPicPath32()) || djImage == null) { djImage = getStandardImage(); } HBox djComponent = new HBox(); djComponent.setPadding(new Insets(5, 0, 0, 20)); Label djLabel = new Label(dj.getDjNameWithSoundStyle(), new ImageView(djImage)); djLabel.setFont(new Font("Arial", 20)); // component.setTextFill(Color.web(DjBattleConstants.COLOR_RESULT_TITLE_TEXT)); djComponent.getChildren().add(djLabel); this.addedRankingComponents.add(djComponent); this.add(djComponent, 0, iPos); iPos++; } } }
From source file:photobooth.views.ExplorerPane.java
private void addLabel() { Label label = new Label("Select Picture"); label.setLayoutX(300);//from w ww .ja v a 2 s .c o m label.setLayoutY(10); label.setFont(new Font(30)); this.getChildren().add(label); }
From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualization.java
/** add a {@link Label} node to the branch container for the decluttered * axis labels/*from w ww . ja va2 s . c o m*/ * * @param labelText the string to add * @param labelWidth the width of the space to use for the label * @param labelX the horizontal position in the partPane of the text */ private synchronized void assignBranchLabel(String labelText, double labelWidth, double labelX) { Label label = new Label(labelText); label.setAlignment(Pos.CENTER); label.setTextAlignment(TextAlignment.CENTER); label.setFont(Font.font(10)); //use a leading ellipse since that is the lowest frequency part, //and can be infered more easily from other surrounding labels label.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS); //force size label.setMinWidth(labelWidth); label.setPrefWidth(labelWidth); label.setMaxWidth(labelWidth); label.relocate(labelX, 0); if (labelX == 0) { // first label has no border label.setStyle("-fx-border-width: 0 0 0 0 ; -fx-border-color:black;"); // NON-NLS } else { // subsequent labels have border on left to create dividers label.setStyle("-fx-border-width: 0 0 0 1; -fx-border-color:black;"); // NON-NLS } branchPane.getChildren().add(label); }
From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualizationPane.java
/** * add a {@link Label} node to the branch container for the decluttered axis * labels/*from w w w. j ava2 s . c om*/ * * @param labelText the string to add * @param labelWidth the width of the space to use for the label * @param labelX the horizontal position in the partPane of the text */ private synchronized void assignBranchLabel(String labelText, double labelWidth, double labelX) { Label label = new Label(labelText); label.setAlignment(Pos.CENTER); label.setTextAlignment(TextAlignment.CENTER); label.setFont(Font.font(10)); //use a leading ellipse since that is the lowest frequency part, //and can be infered more easily from other surrounding labels label.setTextOverrun(OverrunStyle.LEADING_ELLIPSIS); //force size label.setMinWidth(labelWidth); label.setPrefWidth(labelWidth); label.setMaxWidth(labelWidth); label.relocate(labelX, 0); if (labelX == 0) { // first label has no border label.setStyle("-fx-border-width: 0 0 0 0 ; -fx-border-color:black;"); // NON-NLS //NOI18N } else { // subsequent labels have border on left to create dividers label.setStyle("-fx-border-width: 0 0 0 1; -fx-border-color:black;"); // NON-NLS //NOI18N } branchPane.getChildren().add(label); }