3.按钮
public class AwtTest {
//创建框架
public static void main(String[] args) {
Frame frame = new Frame("我的GUI");
frame.setLayout(null);
frame.setBounds(0,0, 300,400);
Button button = new Button("提交");
button.setBounds(200, 100,100,20);
frame.add(button);
frame.setVisible(true);
}
}
本文介绍了一个使用 Java AWT 库创建简单 GUI 的示例代码,通过该示例可以了解如何创建窗口并添加按钮组件。
433

被折叠的 条评论
为什么被折叠?



