chap11-1.txt
来自「清华大学出版社经典教材系列」· 文本 代码 · 共 23 行
TXT
23 行
// 程序11-1
import java.awt.*;
import java.applet.Applet;
import javax.swing.*;
public class showJFrame{
public static void main(String args[ ]){
showJFrame obj=new showJFrame( );
obj.testJFrame( );
}
public void testJFrame( ){
JFrame frame=new subJFrame("TestJFrame"); // 生成一个带标题的框架
Container contentPane=frame.getContentPane( );// 取得内容格
contentPane.setLayout(new FlowLayout( )); // 设置布局管理器
contentPane.add(new JButton(" OK ")); // 添加组件
contentPane.add(new JTextField(10));
frame.setSize(200,100); // 设置框架显示的页面
frame.show( ); // 显示框架
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?