This site requires JavaScript, please enable it in your browser!
Greenfoot back

Report as inappropriate.

edparrish
edparrish presents ...

2011/8/17

fileiox

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
http://www.greenfootgallery.org/scenarios/2371

4311 views / 6 in the last 7 days

1 vote | 0 in the last 7 days

Tags: demo with-source gui file cabrillo i/o

open in greenfoot
Your browser is ignoring the <APPLET> tag.
HTML5 version not available | Scenario not running?
A new version of this scenario was uploaded on Wed Aug 17 22:14:18 UTC 2011 Updated screenshot.

Want to leave a comment? You must first log in.

Who likes this?

Slinger