在j2se的开发项目过程中,经常会使用到弹窗,那么应该如何实现弹窗呢?


使用JOptionPane类中的方法showMessageDialog()即可实现


该方法具体内容如下:
	public static void showMessageDialog(Component parentComponent, Object message, String title, int messageType) throws HeadlessException (其中由参数 messageType 确定弹窗的类型, 具体的下面会有详细参数解释)
相关参数的定义如下:
	parentComponent - 确定弹窗的父Frame; 如果传入参数为null 或 parentComponent 本身不带有 Frame,则使用默认的 Frame。
	message - 弹窗显示的内容
	title - 弹窗的标题
	messageType - 弹窗类型:ERROR_MESSAGE、INFORMATION_MESSAGE、WARNING_MESSAGE、					QUESTION_MESSAGE 或 PLAIN_MESSAGE