Auf Thema antworten

Habe eine Lösung gefunden und wollte die einfach mal mitteilen:


[code=Java]import javafx.application.Application;

import javafx.scene.Group;

import javafx.scene.Scene;

import javafx.scene.control.TextArea;

import javafx.stage.Stage;


public class MainApp extends Application {

    public TextArea textOut = new TextArea();


    @Override

    public void start(Stage stage) {

        Group root = new Group();

        Scene scene = new Scene(root, 800, 800);


        textOut.setPrefSize(300, 100);

        textOut.setLayoutX(50);

        textOut.setLayoutY(500);

        root.getChildren().add(textOut);

        stage.setTitle("World of Zuul"); // Fenstertitel

        stage.setScene(scene);

        Test test = new Test(this);

        test.welcome();

        stage.show();

    }

    public void print(String text){

        textOut.setText(text);

    }


    public static void main(String[] args) {

        launch(args);

    }

}

[/code]



[code=Java]public class Test {

private MainApp ma;


public Test(MainApp ma){

    this.ma=ma;

}


    public void welcome() {

        System.out.println("Hallo Console");

        ma.print("Hallo GUI");

    }

}

[/code]



Oben