Created
April 13, 2016 12:20
-
-
Save MartinBspheroid/a1b155196ce69377b6720fb60bfae7c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.File; | |
long lastTime = 0; | |
File f; | |
String[] data; | |
void setup() { | |
f = new File("e:/test.txt"); | |
} | |
void draw() { | |
background(0); | |
check(); | |
for (int i = 0; i < data.length; i++) { | |
text(data[i], 10, 20 +(i*20)); | |
} | |
} | |
void check() { | |
long millisec = f.lastModified(); | |
if (millisec > lastTime) { | |
reload(); | |
lastTime = millisec; | |
} | |
} | |
void reload() { | |
data = loadStrings(f.getAbsolutePath()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment