How do I repeat this label?
in
Programming Questions
•
1 year ago
Hi -
I am doing a test for a larger program and am a little stuck.
How do I get M to F to repeat along the top, I would like it to depend on the rectangles below.
Thanks
- PFont titleFont;
- int[] dates = {
- 0, 1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14
- };
- String[] titles = {
- "M", "T", "W", "Th", "F"
- };
- int xoff = 50;
- void setup() {
- size(815, 300);
- background(255);
- noStroke();
- fill(100);
- smooth();
- noLoop();
- titleFont = createFont("Helvetica", 10);
- textFont(titleFont);
- }
- void draw() {
- background(255);
- for (int i = 0; i < titles.length; i++) {
- text(titles[i], xoff+i*51, 95);
- }
- for (int j = 0; j < dates.length; j++) {
- fill(100);
- rect(xoff+j*51, 100, 50, 50);
- fill(255);
- text(dates[j], xoff*j+75, 120);
- }
- }
1