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

📄 simpleframe.java

📁 java第89章的实验,对学习java很有帮助的.
💻 JAVA
字号:
import javax.swing.*;
import java.awt.*;

public class SimpleFrame  extends JFrame{

    /** Creates a new instance of SimpleFrame */
    public SimpleFrame(int width,int height) {
        setSize(width,height);//设置框架大小
        setTitle("Frame主窗体");//设置框架标题
        //将框架显示在屏幕正中
        Toolkit kit= Toolkit.getDefaultToolkit();
        Dimension screenSize=kit.getScreenSize();
        int x=(screenSize.width-width)/2;
        int y=(screenSize.height-height)/2;
        setLocation(x,y);//设置框架位置
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
     }

    public static void main(String args[]) {
        SimpleFrame frame=new SimpleFrame(800,600);
        frame.setVisible(true);
    }

    private void jbInit() throws Exception {
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -