Running program gives me a small grey box; problem not draw() or setup()
in
Programming Questions
•
2 years ago
EDIT: Well some of my code was lost when I pasted it here, but hopefully they were just small details.
- import java.io.*;
- import java.net.URL;
- import javax.swing.*;
- import java.awt.*;
- import java.awt.event.*;
- import java.util.*;
- BufferedReader reader;
- class GeoTrends extends PApplet{
- TwitterSearcher ts = new TwitterSearcher();
- //GoogleSearcher gs = new GoogleSearcher();
- void setup(){
- println("here");
- size(700, 700);
- println("got here");
- background(255);
- println("and here!");
- fill(0);
- PFont f = loadFont("Calibri-20.vlw");
- textFont(f);
- }
- void draw(){
- println("rawr");
- text("Searching Twitter for #" + ts.loc + "...", 50, 50);
- text(ts.url, 50, 100);
- }
- private class TwitterSearcher {
- String loc, url;
- ArrayList<String> tweetList;
- public TwitterSearcher(){
- loc = makeURLFriendly(JOptionPane.showInputDialog("location to search for"));
- url = "http://search.twitter.com/search.json?q=%23" + loc + "&max_results=10";
- this.getTweets(url);
- }
- public String makeURLFriendly(String s){
- s = s.replace(" ", "+");
- s = s.toLowerCase();
- return s;
- }
- public void getTweets(String url){
- tweetList = new ArrayList<String>(20);
- String currLine = "";
- String newTweet = "";
- reader = createReader(url);
- try {
- // while (currLine != null) {
- currLine = reader.readLine();
- } catch (IOException e) {
- e.printStackTrace();
- currLine = null;
- }
- if (currLine == null) {
- noLoop();
- }
- else if (currLine.contains("'text':")) {
- newTweet = (String) currLine.subSequence(currLine.indexOf("'text':"),
- currLine.indexOf(",'to_user"));
- tweetList.add(newTweet);}
- }
- } //end of class TwitterSearcher
- private class GoogleSearcher{
- }
- } //end of file
Any help or suggestions would be appreicated!
1