/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package javafx_extext;
import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.stage.Stage;
/**
*
* @author erix7
*/
public class JavaFX_exText 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");
Group root = new Group();
Scene scene = new Scene(root, 400, 300, Color.WHITE);
Text text = new Text(50, 50, "Serif");
text.setFill(Color.RED);
text.setFont(Font.font("Serif", 20));
Text text2 = new Text(50, 100, "SanSerif");
text2.setFill(Color.GREEN);
text2.setFont(Font.font("SanSerif", 30));
Text text3 = new Text(50, 150, "Monospaced");
text3.setFill(Color.BLUE);
text3.setFont(Font.font("Monospaced", 40));
root.getChildren().add(text);
root.getChildren().add(text2);
root.getChildren().add(text3);
primaryStage.setScene(scene);
primaryStage.show();
}
}
Tuesday, January 31, 2012
JavaFX exercise: Set text font
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment