I want to make a popup box where in each box there is a different message. I do not know the number of messages. I want to know what would be the best way to display those jFrames. I have used an array where the length of the array is the number of messages. The problem is that I am getting a NullPointerExeption. What am I doing wrong?
public void interpret() {
String[] command = html.split(";");
for (int i = 0; i < command.length; i++) {
// System.out.println(command[i]);
if (command[i].contains("message")) {
showMessage(command[i].substring(8, command[i].length() - 1));
}
}
}
messagePopUp[] mes = new messagePopUp[10]; // I am just using length 10 for debugging
private void showMessage(String line) {
mes[0].setTextAlert(line); // line giving me the error
mes[0].setVisible(true);
}
The messagePopUp.class is just a default jPanel class which I have added the setTextAlert();
Thank you