Created
April 13, 2016 12:20
-
-
Save MartinBspheroid/fec6c115ae6086e691c77c518b80076e to your computer and use it in GitHub Desktop.
This file contains hidden or 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