Why are two rects displayed

when i press on the kill icon, two rects are displayed when only one should

Those two lines are quite weird.

// there is a number defined
static final int NUM = 2;

// You have an array where you create multiple textboxes. Those get displayed here:
// A for loop which calls actions in multiple tbox objects
for (int i = 0; i  != NUM; tboxes[i++].display());

For readability I would write it like that:

for (int i = 0; i<1; i++) {
    tboxes[i].display()
};
1 Like