Created
December 7, 2018 16:38
-
-
Save memish/cf46da867d47f210584b15e903a5ac2e 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.FileWriter; | |
import java.net.*; | |
import java.io.*; | |
FileWriter fw; | |
BufferedWriter bw; | |
PrintWriter output; | |
boolean start=false; | |
boolean readit = false; | |
String[] lines; | |
boolean startOut=true; | |
String[] words = {"Hello", "World", "GoodBye"}; | |
int size = 25; | |
String urll = "http://172.16.37.184/latin/writer.php"; | |
String fname = "latinwords2.txt"; | |
void setup() { | |
// Create a new file in the sketch directory | |
size(600,400); | |
// openFile(); | |
} | |
void draw() { | |
int y = 20; | |
textSize(20); | |
for(int i = 0; i<words.length; i++){ | |
text(words[i],20,y); | |
y += size; | |
} | |
}//end of draw | |
void postNewItem (String data, String starter,String fn) { | |
try { | |
//"append" | |
URL url = new URL(urll + "?data=" + data + "&start="+starter+ "&fname="+fn); | |
URLConnection conn = url.openConnection(); | |
InputStream is = conn.getInputStream(); | |
is.close(); | |
}catch (Exception ioe) { | |
println("IO" + ioe); | |
} | |
} // end of postNewItem() method | |
void mousePressed() { | |
int spot = mouseY/size; | |
println(mouseX + " " + mouseY); | |
if(mouseY>0 && mouseY<70 && mouseX<100){ | |
println( " mouseY " + mouseY + " size + 20 " + (size + 20) + words[spot]); | |
postNewItem (words[spot], "append",fname); | |
}else{ | |
postNewItem ("new", "new",fname); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment