import javafx.application.Application; 
import javafx.scene.Group; 
import javafx.scene.Scene; 
import javafx.scene.text.Font; 
import javafx.scene.text.Text; 
import javafx.stage.Stage; 
 
public class Main extends Application { 
 
  @Override 
  public void start(Stage stage) { 
    Group root = new Group(); 
    Scene scene = new Scene(root, 300, 150); 
    stage.setScene(scene); 
    stage.setTitle("Sample"); 
 
    Text t = new Text(10, 50, "This is a test"); 
    t.setWrappingWidth(200); 
    t.setText("First row Second row Second row Second row Second row Second row "); 
    t.setFont(new Font(20)); 
 
    root.getChildren().add(t); 
 
 
    stage.show(); 
  } 
 
  public static void main(String[] args) { 
    launch(args); 
  } 
} 
 
    
  
  |