📄 chap11-1.txt
字号:
// 程序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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -