I have tried other topics, so please do not send me to another topic/tutorial because I have not managed to understand it and I HAVE TRIED. If you are not helping please do not reply.
I would like to change this code to display only "OK" and delete the cancel button.
Object contestacion5 = JOptionPane.showInputDialog(null, "#5 Que describe mejor a la Norteña?", "Examen Tijuanas PR", //3
JOptionPane.DEFAULT_OPTION, null,
new Object[] {"Ensalada de espinacas, tomates, zetas, cebolla, tocineta, aguacate, queso de hoja y tiras de maiz crujientes en vinagreta de la casa.",
"Lechuga romana servida con tomate, cebolla, maiz, aguacate, queso de hoja y tiritas de maiz crujientes acompañado de su seleccion de filetes de pollo de res.",
"Ensalada vegetariana de nopales, tomates, cebolla, lechuga romana, queso de hoja, aguacate, y aderezo especial de la casa." }, null);
Here it is the picture, I want it exactly as this but without the Cancel button, thanks!
I have tried to do this way: Is there a way to only have the OK button in a JOptionPane showInputDialog (and no CANCEL button)?
and this is what it displays:
Using the approach you linked, so you can work on your errors. Hope you do read the tutorial though.
JPanel panel = new JPanel(new GridLayout(2, 1)); // layout sets combobox under label
JLabel label = new JLabel("#5 Que describe mejor a la Norteña?");
JComboBox selection = new JComboBox(new String[]{"Ensalada de espinacas, tomates, zetas, cebolla, tocineta, aguacate, queso de hoja y tiras de maiz crujientes en vinagreta de la casa.",
"Lechuga romana servida con tomate, cebolla, maiz, aguacate, queso de hoja y tiritas de maiz crujientes acompañado de su seleccion de filetes de pollo de res.",
"Ensalada vegetariana de nopales, tomates, cebolla, lechuga romana, queso de hoja, aguacate, y aderezo especial de la casa."});
String[] options = {"OK"};
panel.add(label);
panel.add(selection);
JOptionPane.showOptionDialog(null, panel, "Examen Tijuanas PR",
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,
null, options, options[0]);
Result: