How would I go about displaying a JOptionPane.showinputDialog()
with multiple JButtons
on each line? I am not talking about the Yes
, No
, Cancel
buttons but multiple custom labeled JButtons
that displays in the content area of JOptionPane.showinputDialog
?
so I would need to get the value of the button pressed from the JOptionPane
as well.
You can place any JComponents
to the JOptionPane, there I can't see any limits, JOptionPane
is same Top-Level Container as JFrame
, JDialog
or JWindow
, but in contrast with plain Top-Level Containers
, JOptionPane
has implemented return events from built-in funcionalities in Integer
value, meaning buttons YES
, NO
, OK
, CANCEL
and CLOSE
too,
put all JButtons to the Array
String[] buttons = { "Yes", "Yes to all", "No", "Cancel".... };
int returnValue = JOptionPane.showOptionDialog(null, "Narrative", "Narrative",
JOptionPane.WARNING_MESSAGE, 0, null, buttons, buttons[i]);
System.out.println(returnValue);