In Swing how can I create an option dialog box that doesn't have any buttons or the icon at the top?
I want to use JOptionPane.showOptionDialog
, but there are always buttons at the bottom.
To remove the icon, set the message type to JOptionPane.PLAIN_MESSAGE.
To create a dialog box without buttons you do 2 things.
new Object[] {}
The final code looks like this:
JPanel panel = new JPanel(); // Create and modify this panel
JOptionPane.showOptionDialog(null,
panel,
"Dialog Title",
JOptionPane.DEFAULT_OPTION,
JOptionPane.PLAIN_MESSAGE, // NO Icon
null,
new Object[] {}, // No options
null);