PFont font; int x = 50; int y = 600; int by; int r; int k; int i=r; int date1; int date2; int date3; int date4; int date5; int date6; int date7; int date8; int date9; String stat_set = " "; //variable to choose which set of data to draw int stat_set_use = 0; //variable to pass the data after it has been chosen import controlP5.*; ControlP5 controlP5; ScrollList l; Table info; void setup(){ size(1000,700); font = loadFont("UniversLT-14.vlw"); textFont(font); smooth(); info = new Table("Population_Density.csv"); info.parseRecords(); controlP5 = new ControlP5(this); // controlP5.addButton("2008",10,200,100,30,20).setId(1); // controlP5.addButton("2007",10,200,130,30,20).setId(2); // controlP5.addButton("2006",10,200,160,30,20).setId(3); // controlP5.addButton("2005",10,200,190,30,20).setId(4); // controlP5.addButton("2004",10,200,220,30,20).setId(5); // controlP5.addButton("2003",10,200,250,30,20).setId(6); // controlP5.addButton("2002",10,200,280,30,20).setId(7); // controlP5.addButton("2001",10,200,310,30,20).setId(8); // controlP5.addButton("2000",10,200,340,30,20).setId(9); //controlP5 = new ControlP5(this); l = controlP5.addScrollList("myList",50,50,100,250); l.setLabel("Chose an area"); for(int r=0;r<52;r++) { controlP5.Button b = l.addItem(info.bld[r].name,r); b.setId(r); } } void controlEvent(ControlEvent theEvent) { // ScrollList is if type ControlGroup. // when an item in a scrollList is activated, // 2 controlEvents will be broadcasted. // the first one from the ScrollList, the second // one from the button that has been pressed // inside the scrollList. // to avoid an error message from controlP5, you // need to check what type of item triggered the // event, either a controller or a group. if(theEvent.isController()) { // an event from a controller e.g. button println(theEvent.controller().id()+" from "+theEvent.controller()); int i=theEvent.controller().id(); //int sh=theEvent.controller.id(-100); //for (int i=0; i