如何在java中呈现简单的警报消息? [英] How to present a simple alert message in java?
本文介绍了如何在java中呈现简单的警报消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
来自.NET我习惯在桌面应用程序中调用Alert()。但是在这个java桌面应用程序中,我只想提醒一条消息谢谢你使用java我必须经历这么多痛苦:
Coming from .NET i am so used calling Alert() in desktop apps. However in this java desktop app, I just want to alert a message saying "thank you for using java" I have to go through this much suffering:
(使用JOptionPane )
(using a JOptionPane)
有更简单的方法吗?
推荐答案
我会是第一个承认Java非常冗长的人,但我不认为这是不合理的:
I'll be the first to admit Java can be very verbose, but I don't think this is unreasonable:
JOptionPane.showMessageDialog(null, "My Goodness, this is so concise");
如果你静态导入 JOptionPane.showMessageDialog
这个进一步减少到
If you statically import JOptionPane.showMessageDialog
this further reduces to
showMessageDialog(null, "This is even shorter");
这篇关于如何在java中呈现简单的警报消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文