User Tools

Site Tools


cs276:arraylistfontdemo
/*
 * ArraylistFontDemo
 *
 * Illustrates the basic use of the ArrayList class provided in the
 * java.util package.  Also basic text display functions.  Loads five words/phrases
 * into an ArrayList and then loops through them, outputing each word or phrase
 * on a new 'line' using the LucidaBright font at 48 points (scaled down to 16).
 *
 * Created 10/15/2007 by spc
 */
 
import java.util.ArrayList;
 
ArrayList wordList = new ArrayList();
 
void setup() {
  wordList.add("Too");
  wordList.add("Cramped");
  wordList.add("Not enough");
  wordList.add("Space");
  wordList.add("Claustrophobic");
 
  println(wordList.size());
 
  size(150, 150, P3D);  // what does this do?
  PFont font;
  font = loadFont("LucidaBright-48.vlw"); 
  textFont(font, 16); 
  noLoop();
}
 
void draw() {
/* what does this do?
  text("word", 15, 45);
  text("word", 15, 60, -30); 
*/
 
  int x = 0; 
  while (x < wordList.size()) {
    String s = (String) wordList.get(x);
    text(s, 15, 20+x*10);
    x++;
  } 
}
cs276/arraylistfontdemo.txt · Last modified: 2007/10/16 17:05 by scarl