/************************************************* * Author: Ezra Velazquez * Date: 11/19/10 * Prof: Che-Wei Wang * Week: Nine * Note: Traffic Report * * Represents just (1) one traffic * title ************************************************/ class Details { PFont trafficFont; String info; float x; float y; Details(String info_, float y_) { info = info_; info = info + " - "; y = y_; trafficFont = loadFont("HelveticaNeue-Bold-48.vlw"); } void setX(float x_) { x = x_; } //Change x value by -2 void move() { x = x - 2; if(x < width-totalW) { x = width; } } void display() { textFont(trafficFont); textAlign(LEFT); fill(200,50,36); text(info,x,y); } //Return width of text float textW() { textFont(trafficFont); return textWidth(info); } }