我想知道如何更改JOptionPane框的图标(标题栏中的java徽标)。我正在使用摇摆界面。请参阅下面的示例代码。想知道为什么每次我运行代码时,它总是显示java徽标图标而不是信息消息图标。
import javax.swing.JOptionPane;
public class NewClass
{
public static void main(String[] args)
{
double width, length, area, perimeter;
String lengthStr, widthStr, outputStr;
lengthStr = JOptionPane.showInputDialog("Enter the length: ");
length = Double.parseDouble(lengthStr);
widthStr = JOptionPane.showInputDialog("Enter the width: ");
width = Double.parseDouble(widthStr);
area = length * width;
perimeter = 2 * (length + width);
outputStr = "Length: " + length + "\n" + "Width: " + width + "\n" + "Area: " + area + " square units\n"
+ "Perimeter: " + perimeter + " units\n";
JOptionPane.showMessageDialog(null, outputStr, "Rectangle", JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}