Skip to main content
summaryrefslogtreecommitdiffstats
blob: 3dae506602b5df2e50aadac44a823466dcc3f27d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package org.eclipse.fx.xtext.sample.editor.text;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.BorderPane;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.Text;
import javafx.scene.text.TextFlow;
import javafx.stage.Stage;

public class SampleTextFlow extends Application {

	@Override
	public void start(Stage primaryStage) throws Exception {
		BorderPane p = new BorderPane();
		
		TextFlow f = new TextFlow();
		
		Text t1 = new Text("I'm black 12pt");
		t1.setFont(Font.font(12));
		f.getChildren().add(t1);
		
		Text t2 = new Text("I'm red 20pt");
		t2.setFont(Font.font(20));
		t2.setFill(Color.RED);
		f.getChildren().add(t2);
		
		p.setCenter(f);
		primaryStage.setScene(new Scene(p));
		primaryStage.show();
	}

	public static void main(String[] args) {
		launch(args);
	}
}

Back to the top