All I have to know is how to write this code shorter (if possible). Could someone take a look to it?
I couldn't find how I could write it in a shorter way, but maybe someone knows a way to do it. Maybe I can put all this code in only 1 If-statement or something?
String arrayWoord[]=new String[10];
arrayWoord[0] = letterVeld1.getText();
arrayWoord[1] = letterVeld2.getText();
arrayWoord[2] = letterVeld3.getText();
arrayWoord[3] = letterVeld4.getText();
arrayWoord[4] = letterVeld5.getText();
arrayWoord[5] = letterVeld6.getText();
arrayWoord[6] = letterVeld7.getText();
arrayWoord[7] = letterVeld8.getText();
arrayWoord[8] = letterVeld9.getText();
arrayWoord[9] = letterVeld10.getText();
if (arrayWoord[0].equals("")) {
toonKnop1.setVisible(false);
letterlijnLabel1.setVisible(false);
} // end of if
if (arrayWoord[1].equals("")) {
toonKnop2.setVisible(false);
letterlijnLabel2.setVisible(false);
} // end of if
if (arrayWoord[2].equals("")) {
toonKnop3.setVisible(false);
letterlijnLabel3.setVisible(false);
} // end of if
if (arrayWoord[3].equals("")) {
toonKnop4.setVisible(false);
letterlijnLabel4.setVisible(false);
} // end of if
if (arrayWoord[4].equals("")) {
toonKnop5.setVisible(false);
letterlijnLabel5.setVisible(false);
} // end of if
if (arrayWoord[5].equals("")) {
toonKnop6.setVisible(false);
letterlijnLabel6.setVisible(false);
} // end of if
if (arrayWoord[6].equals("")) {
toonKnop7.setVisible(false);
letterlijnLabel7.setVisible(false);
} // end of if
if (arrayWoord[7].equals("")) {
toonKnop8.setVisible(false);
letterlijnLabel8.setVisible(false);
} // end of if
if (arrayWoord[8].equals("")) {
toonKnop9.setVisible(false);
letterlijnLabel9.setVisible(false);
} // end of if
if (arrayWoord[9].equals("")) {
toonKnop10.setVisible(false);
letterlijnLabel10.setVisible(false);
} // end of if
Aucun commentaire:
Enregistrer un commentaire