java怎样实现弹出窗口

2025-02-25 14:07:00
推荐回答(1个)
回答1:

JOptionPane.showMessageDialog()

public static void showMessageDialog(Component parentComponent,
Object message,
String title,
int messageType)
throws HeadlessException调出对话框,它显示使用由 messageType 参数确定的默认图标的 message。

参数:
parentComponent - 确定在其中显示对话框的 Frame;如果为 null 或者 parentComponent 不具有 Frame,则使用默认的 Frame
message - 要显示的 Object
title - 对话框的标题字符串
messageType - 要显示的消息类型:ERROR_MESSAGE、INFORMATION_MESSAGE、WARNING_MESSAGE、QUESTION_MESSAGE 或 PLAIN_MESSAGE