用 java swing 开发客户端的第一步,新建一个基础窗口,代码如下:
import java.awt.FlowLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
public class Application{
public static void main(String[] args) {
JFrame frame = new JFrame();
JButton button = new JButton("测试");
frame.setBounds(500, 350, 500, 350);// 横坐标、纵坐标、宽度、高度
frame.getContentPane().setLayout(new FlowLayout());
frame.getContentPane().add(button);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}