I want to know how i can do a messageBox from three input dialog ..
Like this:
JOptionPane.showInputMessageDialog("Enter your FirstName");
JOptionPane.showInputMessageDialog("Enter your MiddleName");
JOptionPane.showInputMessageDialog("Enter your LastName");
But I want one message has a three input boxes.
It is used to create an information-message dialog titled "Message". static void showMessageDialog(Component parentComponent, Object message, String title, int messageType) It is used to create a message dialog with given title and messageType.
Build a JPanel (supose it's named inputPanel) with the three JtextFields to input and then do this:
if (JOptionPane.YES_OPTION == JOptionPane.showconfirmDialog(
parentComponent, inputPanel, "Enter your data", JOptionPane.YES_NO_OPTION) {
// retrieve data from the JTextFields and do things
} else {
// User close the dialog, do things... or not
}
You can't do that with JOptionPane
. Create a JDialog
and add three JTextField
's to it instead. A JDialog
will block the caller when you call setVisible(true)
, so it's easy to create a dialog that waits for user input before it returns.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With