This array element (e-mails) shows up when you start the program - thats right. But I want to do something like: If I press e.g. the key ‘1’ I want that the program delete automatically the mailingListe element number 1 (i=1) and the following elements must move up and replace the new blank space. I tried it the keyPressed command as you can see at the last lines but it didnt function. Does someone knows the right commands for this code.
Thanks!
String [] mailingListe = new String[10];
int i,y;
PFont font;
String[] fontList = PFont.list();
String tmptext = "";
void setup()
{
size(1000, 900);
textSize(15);
background(180);
fill(45);
printArray(fontList);
font = createFont("Times New Roman", 1);
textFont(font, 22);
fillArray();
}
void draw()
{
i=0;
y=100;
for (i=0; i<10; i++)
{
text(mailingListe[i],350,y);
y = y+70;
text(tmptext, 350,y);
}
}
void fillArray()
{
mailingListe[0] = "test1@gmail.com";
mailingListe[1] = "test2@gmail.com";
mailingListe[2] = "test3@gmail.com";
mailingListe[3] = "test4@gmail.com";
mailingListe[4] = "test5@gmail.com";
mailingListe[5] = "test6@gmail.com";
mailingListe[6] = "test7@gmail.com";
mailingListe[7] = "test8@gmail.com";
mailingListe[8] = "test9@gmail.com";
mailingListe[9] = "test10@gmail.com";
}
void keyPressed()
{
if ( key == '1-9')
{
mailingListe[i] = tmptext;
tmptext = " ";
}
}