Report as inappropriate.
The scenario shows how to use file I/O (Input/Output) in Greenfoot.
Most file I/O is prevented by the Security Manager when running as an applet. All the scenarios in the Greenfoot Gallery run as applets.
We can do file I/O in the Greenfoot editor or when running as an application. Also, we can read text files that were included in the JAR file for the scenario. Reading from a JAR file is useful, for example, when changing levels or worlds.
To include text files in the JAR file, just add the files to the scenario folder.
Thanks to davmac for his suggestion on how to detect if the scenario is running as an application or as an applet.
The GUI components are part of GUI World at
Want to leave a comment? You must first log in.