⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 myframewithcomponents.java

📁 java课件
💻 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 + -