Friday, May 4, 2012

Create text using javafx.scene.text.TextBuilder

Example to create text using TextBuilder.create():

package javafx_text;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Text;
import javafx.scene.text.TextBuilder;
import javafx.stage.Stage;

 * @web
public class JavaFX_Text extends Application {

     * @param args the command line arguments
    public static void main(String[] args) {
    public void start(Stage primaryStage) {
        StackPane root = new StackPane();
        Text textHello = TextBuilder.create().text("Hello, Java Buddy!").build();
        primaryStage.setScene(new Scene(root, 500, 400));;

create text using TextBuilder.create()

Do more with TextBuilder:
- JavaFX TextBuilder with properties

No comments:

Post a Comment

Post a Comment