《javaJOptionPaneshowMessageDialog对话框》由会员分享,可在线阅读,更多相关《javaJOptionPaneshowMessageDialog对话框(3页珍藏版)》请在金锄头文库上搜索。
1、java JOptionPaneshowMessageDialog对话框JOptionPane.showMessageDialog(null, 错误消息!, 错误, JOptionPane.ERROR_MESSAGE); JOptionPane.showMessageDialog(null, 信息消息。,“提示, JOptionPane.INFORMATION_MESSAGE); JOptionPane.showMessageDialog(null, 警告对话框!, 警告, JOptionPane.WARNING_MESSAGE); JOptionPane.showMessageDialog(
2、null, 没有图标的提示!, 信息, JOptionPane.PLAIN_MESSAGE); Icon icon = new ImageIcon(getClass.getResource(middle.gif); JOptionPane.showMessageDialog(null, 自定义图片的信息提示!, 信息, JOptionPane.INFORMATION_MESSAGE, icon); Object options = 是的, 不是, 不确定 ; int n = JOptionPane.showOptionDialog(this, 你喜欢看定影吗?, 自定义询问, JOptionP
3、ane.YES_NO_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, options, options2); Icon icon = new ImageIcon(getClass.getResource(middle.gif); Object options = 是的, 不是, 不确定 ; int n = JOptionPane.showOptionDialog(this, 你喜欢看定影吗?, 自定义询问, JOptionPane.YES_NO_CANCEL_OPTION, icon, options, options2); JOption
4、Pane.QUESTION_MESSAGE, int n = JOptionPane.showConfirmDialog(this, 你喜欢蓝色吗?, 询问, JOptionPane.YES_NO_OPTION); Object options = Yes, please, No way! ; int n = Would you like green eggs and JOptionPane.YES_NO_OPTION, options, / the titles of buttons options0); / default button JOptionPane.showOptionDial
5、og(this, ham?, A Silly Question, JOptionPane.QUESTION_MESSAGE, null, title Object possibilities = 苹果, 香蕉, 橘子 ; String s = (String) JOptionPane.showInputDialog(this, 你喜欢什么样的水果?:n, Customized Dialog, JOptionPane.QUESTION_MESSAGE, null, possibilities, ham); inputValue = String JOptionPane.showInputDialog(请输入一个值:);