从JOptionPane中删除图标

Cod*_*gry 10 java swing image joptionpane imageicon

如何从中删除图标JOptionPane

ImageIcon icon = new ImageIcon(image);
JLabel label = new JLabel(icon);
int result = JOptionPane.showConfirmDialog((Component) null, label, "ScreenPreview", JOptionPane.OK_CANCEL_OPTION);
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

Dth*_*Dth 22

您可以通过直接指定邮件的外观来实现.

您的代码将采用默认代码,而此代码将使用缺少图标的"PLAIN_MESSAGE"样式.组件的行为保持不变.

JOptionPane.showConfirmDialog(null, label, "ScreenPreview", JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE);
Run Code Online (Sandbox Code Playgroud)

更多信息:http://docs.oracle.com/javase/6/docs/api/javax/swing/JOptionPane.html