xxxxxxxxxx
import java.util.*;
import javax.swing.*;
void setup()
{
size(750,960);
background(0);
String in = JOptionPane.showInputDialog(" Introduzir notas");
StringTokenizer tokenizer = new StringTokenizer(in, " ");
String ficheiro = "";
int t = 0;
while(tokenizer.hasMoreTokens() && t < 0) {
ficheiro = ficheiro + tokenizer.nextToken();
t++;
}
int xCoord = 0;
int yCoord = 0;
while(tokenizer.hasMoreTokens())
{
String notas = tokenizer.nextToken();
if (notas.equals("do")) {
print("do");
stroke(194,53,50);
line(xCoord + 30,yCoord + 210,xCoord + 60,yCoord + 210);
}
else if(notas.equals("re")) {
print("re");
stroke(218,149,53);
line(xCoord + 30 ,yCoord + 180,xCoord + 60,yCoord + 180);
}
else if(notas.equals("mi")) {
print("mi");
stroke(236,230,90);
line(xCoord + 30,yCoord + 150,xCoord + 60,yCoord + 150);
}
else if(notas.equals("fa")) {
print("fa");
stroke(144,180,53);
line(xCoord +30 ,yCoord + 120,xCoord + 60,yCoord + 120);
}
else if(notas.equals("sol")) {
print("sol");
stroke(120,182,199);
line(xCoord + 30 ,yCoord + 90,xCoord + 60,yCoord + 90);
}
else if(notas.equals("la")) {
print("la");
stroke(51,81,154);
line(xCoord + 30,yCoord + 60,xCoord +60 ,yCoord + 60);
}
else if(notas.equals("si")) {
print("si");
stroke(156,94,155);
line(xCoord + 30,yCoord + 30,xCoord + 60,yCoord + 30);
}
if(xCoord < 660 )
{
xCoord = xCoord + 30;
}
else
{
xCoord = 0;
yCoord = yCoord + 240;
}
}
print("Fim");
save(ficheiro + ".png");
}