我的第一个JavaSwing程序,第一个javaswing
分享于 点击 41500 次 点评:227
我的第一个JavaSwing程序,第一个javaswing
我的第一个 Java Swing 程序,来源:http://docs.oracle.com/javase/tutorial/displayCode.html?code=http://docs.oracle.com/javase/tutorial/uiswing/examples/start/HelloWorldSwingProject/src/start/HelloWorldSwing.java
package com.xjh.swing;
import javax.swing.JFrame;
import javax.swing.JLabel;
/**
*
* @author xiejiaohui
*
*/
public class HelloWorldSwing {
private static void createAndShowGUI() {
JFrame frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
frame.pack();
frame.setVisible(true);
// frame.setSize(800, 600);
}
public static void main(String[] args) {
javax.swing.SwingUtilities.invokeLater(new Runnable() {
public void run() {
createAndShowGUI();
}
});
}
}
相关文章
- 暂无相关文章
用户点评