List of usage examples for javafx.scene.text Text setFont
public final void setFont(Font value)
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); int w = 220;// ww w . j av a 2 s . c om int h = 100; FloatMap map = new FloatMap(); map.setWidth(w); map.setHeight(h); for (int i = 0; i < w; i++) { double v = (Math.sin(i / 20.0 * Math.PI) - 0.5) / 40.0; for (int j = 0; j < h; j++) { map.setSamples(i, j, 0.0f, (float) v); } } Group g = new Group(); DisplacementMap dm = new DisplacementMap(); dm.setMapData(map); g.setEffect(dm); g.setCache(true); Rectangle r = new Rectangle(); r.setX(20.0); r.setY(20.0); r.setWidth(w); r.setHeight(h); r.setFill(Color.BLUE); g.getChildren().add(r); Text t = new Text(); t.setX(40.0); t.setY(80.0); t.setText("Wavy Text"); t.setFill(Color.YELLOW); t.setFont(Font.font(null, FontWeight.BOLD, 36)); g.getChildren().add(t); root.getChildren().add(g); primaryStage.setScene(scene); primaryStage.show(); }
From source file:Main.java
@Override public void start(Stage primaryStage) { primaryStage.setTitle(""); Group root = new Group(); Scene scene = new Scene(root, 300, 250, Color.WHITE); Group g = new Group(); DropShadow ds = new DropShadow(); ds.setOffsetY(3.0);/*w w w . j a v a 2s.c o m*/ ds.setColor(Color.color(0.4, 0.4, 0.4)); Text t = new Text(); t.setEffect(ds); t.setCache(true); t.setX(10.0); t.setY(70.0); t.setFill(Color.RED); t.setText("JavaFX drop shadow..."); t.setFont(Font.font(null, FontWeight.BOLD, 32)); g.getChildren().add(t); root.getChildren().add(g); primaryStage.setScene(scene); primaryStage.show(); }
From source file:User.java
private HBox drawRow1() { Text userNameField = new Text(); userNameField.setFont(Font.font("SanSerif", FontWeight.BOLD, 30)); userNameField.setFill(foregroundColor); userNameField.setSmooth(true);/*from ww w.j av a 2 s . c o m*/ // bind the field to the user.username userNameField.textProperty().bind(user.userNameProperty()); HBox userNameCell = new HBox(); userNameCell.prefWidthProperty().bind(primaryStage.widthProperty().subtract(45)); userNameCell.getChildren().add(userNameField); HBox row1 = new HBox(); row1.getChildren().addAll(userNameCell); return row1; }
From source file:de.micromata.mgc.javafx.launcher.gui.AboutDialogController.java
@Override public void initializeWithModel() { MgcApplicationInfo ai = model.getApplicationInfo(); AnchorPane.setTopAnchor(aboutLogoPanel, 2.0); AnchorPane.setRightAnchor(aboutLogoPanel, 2.0); AnchorPane.setLeftAnchor(aboutLogoPanel, 2.0); AnchorPane.setTopAnchor(aboutLogoPanel, 2.0); AnchorPane.setRightAnchor(licensePanel, 2.0); AnchorPane.setLeftAnchor(licensePanel, 2.0); AnchorPane.setRightAnchor(licenceTextArea, 5.0); AnchorPane.setLeftAnchor(licenceTextArea, 2.0); // AnchorPane.setTopAnchor(licensePanel, 100.0); // AnchorPane.setBottomAnchor(configurationTabs, 5.0); AnchorPane.setRightAnchor(buttonPanel, 2.0); AnchorPane.setLeftAnchor(buttonPanel, 2.0); AnchorPane.setBottomAnchor(buttonPanel, 2.0); okButton.setOnAction(event -> getStage().close()); String name = ai.getName() + " " + ai.getVersion(); Text text1 = new Text(name); text1.setFont(Font.font("Verdana", FontWeight.BOLD, 20)); Text text2 = new Text("\n\n" + ai.getCopyright() + "\n"); TextFlow apptext = new TextFlow(text1, text2); appInfo.getChildren().add(apptext);//from w w w . ja v a 2 s . c om if (ai.getLogoLargePath() != null) { logo.setImage(new Image(this.getClass().getResource(ai.getLogoLargePath()).toString())); } String sdetailText = ai.getDetailInfo(); if (StringUtils.isNotBlank(ai.getLicense()) == true) { sdetailText += "\n\nLicense: " + ai.getLicense(); } TextFlow detailText = new TextFlow(); detailText.getChildren().add(new Text(sdetailText)); if (StringUtils.isNotBlank(ai.getHomeUrl()) == true) { detailText.getChildren().add(new Text("\n\nHomepage: ")); Hyperlink hlink = new Hyperlink(ai.getHomeUrl()); hlink.setOnAction(event -> SystemService.get().openUrlInBrowser(ai.getHomeUrl())); detailText.getChildren().add(hlink); } appDetails.getChildren().add(detailText); initLicenseText(); }
From source file:Main.java
private VBox addVBox() { VBox vbox = new VBox(); vbox.setPadding(new Insets(10)); // Set all sides to 10 vbox.setSpacing(8); // Gap between nodes Text title = new Text("Data"); title.setFont(Font.font("Arial", FontWeight.BOLD, 14)); vbox.getChildren().add(title);/* w w w .j a v a 2s.c om*/ Hyperlink options[] = new Hyperlink[] { new Hyperlink("Sales"), new Hyperlink("Marketing"), new Hyperlink("Distribution"), new Hyperlink("Costs") }; for (int i = 0; i < 4; i++) { // Add offset to left side to indent from title VBox.setMargin(options[i], new Insets(0, 0, 0, 8)); vbox.getChildren().add(options[i]); } return vbox; }
From source file:Main.java
private void addStackPane(HBox hb) { StackPane stack = new StackPane(); Rectangle helpIcon = new Rectangle(30.0, 25.0); helpIcon.setFill(new LinearGradient(0, 0, 0, 1, true, CycleMethod.NO_CYCLE, new Stop[] { new Stop(0, Color.web("#4977A3")), new Stop(0.5, Color.web("#B0C6DA")), new Stop(1, Color.web("#9CB6CF")), })); helpIcon.setStroke(Color.web("#D0E6FA")); helpIcon.setArcHeight(3.5);//from w w w. j a v a 2 s. c o m helpIcon.setArcWidth(3.5); Text helpText = new Text("?"); helpText.setFont(Font.font("Verdana", FontWeight.BOLD, 18)); helpText.setFill(Color.WHITE); helpText.setStroke(Color.web("#7080A0")); stack.getChildren().addAll(helpIcon, helpText); stack.setAlignment(Pos.CENTER_RIGHT); // Add offset to right for question mark to compensate for RIGHT // alignment of all nodes StackPane.setMargin(helpText, new Insets(0, 10, 0, 0)); hb.getChildren().add(stack); HBox.setHgrow(stack, Priority.ALWAYS); }
From source file:Main.java
private GridPane addGridPane() { GridPane grid = new GridPane(); grid.setHgap(10);/*from w ww.ja va 2s.com*/ grid.setVgap(10); grid.setPadding(new Insets(0, 10, 0, 10)); // Category in column 2, row 1 Text category = new Text("Sales:"); category.setFont(Font.font("Arial", FontWeight.BOLD, 20)); grid.add(category, 1, 0); // Title in column 3, row 1 Text chartTitle = new Text("Current Year"); chartTitle.setFont(Font.font("Arial", FontWeight.BOLD, 20)); grid.add(chartTitle, 2, 0); // Subtitle in columns 2-3, row 2 Text chartSubtitle = new Text("Goods and Services"); grid.add(chartSubtitle, 1, 1, 2, 1); // House icon in column 1, rows 1-2 ImageView imageHouse = new ImageView(new Image(Main.class.getResourceAsStream("graphics/house.png"))); grid.add(imageHouse, 0, 0, 1, 2); // Left label in column 1 (bottom), row 3 Text goodsPercent = new Text("Goods\n80%"); GridPane.setValignment(goodsPercent, VPos.BOTTOM); grid.add(goodsPercent, 0, 2); // Chart in columns 2-3, row 3 ImageView imageChart = new ImageView(new Image(Main.class.getResourceAsStream("graphics/piechart.png"))); grid.add(imageChart, 1, 2, 2, 1); // Right label in column 4 (top), row 3 Text servicesPercent = new Text("Services\n20%"); GridPane.setValignment(servicesPercent, VPos.TOP); grid.add(servicesPercent, 3, 2); // grid.setGridLinesVisible(true); return grid; }
From source file:com.cooksys.postmaster.PostmasterModelSingleton.java
public PostmasterModelSingleton() { //initialize properties requestList = new ArrayList<ParsedHttpRequest>(); responseList = new ArrayList<ParsedHttpResponse>(); this.createTransientPropertyInstances(); this.port = 8080; //encode the default response if (responseList.isEmpty()) { ParsedHttpResponse response = new ParsedHttpResponse(); response.setContentType("text/html"); response.getHeaders().add(new HeaderRow("My-Header", "my header value")); response.getHeaders().add(new HeaderRow("Another-Header", "another header value")); response.getCookies().add(new CookieRow("My-Cookie", "my cookie value")); response.setName("Postmaster Default Response"); response.setStatusCode("200 OK"); response.setMessageBody("<html><body><h1>PostMaster Default Response" + "</h1><p>Create your own auto-response message in the 'Saved Responses' tab</p></body></html>"); defaultResponseIndex = 0;/*from w w w. j a va 2 s.c om*/ //add it to the lists responseList.add(response); Text defaultResponseText = new Text(response.getName()); defaultResponseText.setFont(Font.font(null, FontWeight.BOLD, 12)); savedResponsesList.add(defaultResponseText); } }
From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualization.java
/** add a {@link Text} node to the leaf container for the decluttered axis * labels//from w w w .j a va2 s . c o m * * @param labelText the string to add * @param labelWidth the width of the space available for the text * @param labelX the horizontal position in the partPane of the text * @param bold true if the text should be bold, false otherwise */ private synchronized void assignLeafLabel(String labelText, double labelWidth, double labelX, boolean bold) { Text label = new Text(" " + labelText + " "); label.setTextAlignment(TextAlignment.CENTER); label.setFont(Font.font(null, bold ? FontWeight.BOLD : FontWeight.NORMAL, 10)); //position label accounting for width label.relocate(labelX + labelWidth / 2 - label.getBoundsInLocal().getWidth() / 2, 0); label.autosize(); if (leafPane.getChildren().isEmpty()) { //just add first label leafPane.getChildren().add(label); } else { //otherwise don't actually add the label if it would intersect with previous label final Text lastLabel = (Text) leafPane.getChildren().get(leafPane.getChildren().size() - 1); if (!lastLabel.getBoundsInParent().intersects(label.getBoundsInParent())) { leafPane.getChildren().add(label); } } }
From source file:org.sleuthkit.autopsy.timeline.ui.AbstractVisualizationPane.java
/** * add a {@link Text} node to the leaf container for the decluttered axis * labels// ww w. jav a 2s . com * * @param labelText the string to add * @param labelWidth the width of the space available for the text * @param labelX the horizontal position in the partPane of the text * @param bold true if the text should be bold, false otherwise */ private synchronized void assignLeafLabel(String labelText, double labelWidth, double labelX, boolean bold) { Text label = new Text(" " + labelText + " "); //NOI18N label.setTextAlignment(TextAlignment.CENTER); label.setFont(Font.font(null, bold ? FontWeight.BOLD : FontWeight.NORMAL, 10)); //position label accounting for width label.relocate(labelX + labelWidth / 2 - label.getBoundsInLocal().getWidth() / 2, 0); label.autosize(); if (leafPane.getChildren().isEmpty()) { //just add first label leafPane.getChildren().add(label); } else { //otherwise don't actually add the label if it would intersect with previous label final Text lastLabel = (Text) leafPane.getChildren().get(leafPane.getChildren().size() - 1); if (!lastLabel.getBoundsInParent().intersects(label.getBoundsInParent())) { leafPane.getChildren().add(label); } } }