在Java Swing中显示警报对话框
发布时间:2020-12-15 02:05:33 所属栏目:Java 来源:网络整理
导读:我想在出现异常时发出警报,例如在代码中: try{ //the code here}catch(Exception e){ //show an alert dialog here} 我需要一个示例或代码片段. 解决方法 您可以将JOptionPane.showMessageDialog与WARNING_MESSAGE一起使用: JOptionPane.showMessageDialog
我想在出现异常时发出警报,例如在代码中:
try { //the code here } catch(Exception e) { //show an alert dialog here } 我需要一个示例或代码片段. 解决方法
您可以将JOptionPane.showMessageDialog与WARNING_MESSAGE一起使用:
JOptionPane.showMessageDialog(yourFrame,"WARNING.","Warning",JOptionPane.WARNING_MESSAGE); 关于如何制作对话框的更多信息here. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |