package fx;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.StackPane;
import javafx.scene.text.Text;
import javafx.stage.Stage;
public class Exercise15_06 extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage primaryStage) {
String string1 = "Java is fun";
String string2 = "Java is powerful";
Text text = new Text(string1);
text.setOnMouseClicked(event -> text.setText(text.getText().equals(string1) ? string2 : string1));
Scene scene = new Scene(new StackPane(text), 350, 200);
primaryStage.setScene(scene);
primaryStage.setTitle("Exercise15_06");
primaryStage.show();
}
}