📄 myframewithcomponents.java
字号:
import java.awt.Container;
import javax.swing.JButton;
import javax.swing.JFrame;
/*
* MyFrameWithComponents.java
*
* Created on 2007年10月20日, 下午10:25
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
/**
*
* @author admin
*/
public class MyFrameWithComponents {
public static void main(String[] args) {
JFrame frame = new JFrame("Adding Components into the Frame");
//向窗口中添加一个按钮
Container container = frame.getContentPane();
JButton jbtOK = new JButton("OK");
container.add(jbtOK);
frame.setSize(400,300);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -