Characters Around Circle

less than 1 minute read

The code has been modified slightly and now uploaded to the site.

Question

<— Return Home

FXProgram.java

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;
import javafx.scene.transform.Rotate;

public class FXProgram extends Application{
    @Override
    public void start(Stage stage){
        Pane root = new Pane();
        root.setPrefSize(500, 500);

        int x = 400;
        int y = 250;
        // String theText = "Learning JavaFX";
        Text text = new Text(x, y, "L");
        // String obtainText = text.getText();
        Rotate rotate;
        int rotation = 90;

        for (int i = 0; i < text.getText().length(); i++){
            rotate = new Rotate(rotation * 10, x, y);
            text.setFont(Font.font("Times New Roman", FontWeight.BOLD, FontPosture.REGULAR, 24));
            text.getTransforms().add(rotate);
        }

        root.getChildren().addAll(text);

        Scene scene = new Scene(root);
        stage.setScene(scene);
        stage.setTitle("Exercise14_05");
        stage.show();
    }

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

<— Return Home