Java Swing:多个窗口 [英] Java Swing: multiple windows
本文介绍了Java Swing:多个窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是GUI编程的新手,但需要创建一个多窗口GUI.有谁知道在线上有什么好的教程,或者您能显示一个简单的代码来启动2个窗口吗?
I'm new to GUI programming, but need to create a multiple window GUI. Does anyone know of any good tutorial online or could you please show a simple code that will launch 2 windows?
推荐答案
只需创建两个JFrame对象,如下所示:
Just create two JFrame objects like this:
public static void main(String[] args) throws Exception {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
new JFrame("frame1").setVisible(true);
new JFrame("frame2").setVisible(true);
}
});
}
这篇关于Java Swing:多个窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文