Sorry if this sounds like a dumb question, but I searched everywhere on custom buttons in JOptionPane. I came across how to create special buttons, but I can not use it in my program.
int choice; Object[] doors = { "Door 1", "Door 2", "Door 3" }; JFrame frame = new JFrame(); input = "Which door do you choose?"; choice = JOptionPane.showOptionDialog(frame, input, "Doors", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, doors, doors[2]); if (car == 1 && choice.equals(doors[0])) { open = 3; option = 2; } if (car == 1 && choice.equals(doors[1])) { open = 3; option = 1; } if (car == 1 && choice.equals(doors[2])) { open = 2; option = 1; } if (car == 2 && choice.equals(doors[0])) { open = 3; option = 2; } if (car == 2 && choice.equals(doors[1])) { open = 1; option = 3; } if (car == 2 && choice.equals(doors[2])) { open = 1; option = 2; } if (car == 3 && choice.equals(doors[0])) { open = 2; option = 3; } if (car == 3 && choice.equals(doors[1])) { open = 1; option = 3; } if (car == 3 && choice.equals(doors[2])) { open = 2; option = 1; }
Note. This is not my whole program, but only a problematic aspect.
The parameters in the dialog box are displayed perfectly, only there is an error that says that "int cannot be delayed." I think I used an erroneous comparison, but how can I fix this?
source share