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 http://java-buddy.blogspot.com/
 */
public class JavaFX_Text extends Application {
 /**
 * @param args the command line arguments
 */
 public static void main(String[] args) {
 launch(args);
 }
 
 @Override
 public void start(Stage primaryStage) {
 primaryStage.setTitle("java-buddy.blogspot.com");
 StackPane root = new StackPane();
 
 Text textHello = TextBuilder.create().text("Hello, Java Buddy!").build();
 
 root.getChildren().add(textHello);
 
 primaryStage.setScene(new Scene(root, 500, 400));
 primaryStage.show();
 }
}




Do more with TextBuilder:
- JavaFX TextBuilder with properties

No comments:

Post a Comment

[フレーム]

Subscribe to: Post Comments (Atom)

AltStyle によって変換されたページ (->オリジナル) /