Hi so lately I've been doing a lot of java programming and I've been using a lot of if statements. the problem is i have to copy and paste the if statements over a hundred times to check all the senarios. Here is an example:
while (i < AreaNumbers.size()) {
String roomnum = "j" + AreaNumbers.get(i);
if (roomnum.equals("j100")) {
if (k == 1) {
j100.setVisible(true);
j100.setToolTipText("<html>" + "<br>" + "Room Number: " + AreaNumbers.get(i) + "<br>" + "Incident ID: " + IncidentID.get(i) + "<br>" + " Teacher: " + Teachers.get(i) + "<br>" + " Description: " + Descriptions.get(i) + "</html>");
k = k + 1;
} else if (k > 0) {
j100.setToolTipText(k + " help desk calls, click here for more information");
k = k + 1;
}
for this example i would copy and paste the if (roomnum.equals("j100")) { and everything past it for every label i want to check and compare. Is there anyway i could do this where i could write a statement that goes through this same scenario once and everywhere it sees j100 it could replace it after each time with a different label, such as j101 j107 an so on. Im sorry if this isnt very clear i just cant think of a better way to word it. Thanks in advance.
j100and, according to your description, this code will be repeated over a hundred times. Does it mean you plan on having hundred variables like that?${$name}