java - How to check a jlabel array is full? -


this 1 shows validation popup if of labels full. want change shows error message if of jlabels full.

//check see if car park full void checkfull() {     for(int = 0; < parkingspace.length; i++)     {          if (parkingspace[i].geticon() != null)         {             joptionpane.showmessagedialog(null, "sorry car park full!");         }      } } 

you have reverse logic of loop. if find empty space, there's no problem (return). @ end of loop, if haven't returned, have no spaces left

//check see if car park full void checkfull() {     for(int = 0; < parkingspace.length; i++)     {          if (parkingspace[i].geticon() == null)         {           return;         }      }     joptionpane.showmessagedialog(null, "sorry car park full!");  } 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -