📄 superframe.java
字号:
package com.exam.ui;
import java.awt.Image;
import java.awt.Toolkit;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
public class SuperFrame extends JFrame {
private static final long serialVersionUID = 1L;
public SuperFrame(){
ImageIcon icon = new ImageIcon("images/exam.jpg");
Image img = icon.getImage();
this.setIconImage(img);
}
public void setCenter() {
Toolkit tool = Toolkit.getDefaultToolkit();
float fwidth = tool.getScreenSize().width;
float fheight = tool.getScreenSize().height;
int swidth = this.getWidth();
int sheight = this.getHeight();
int x = (int) ((fwidth - swidth) / 2);
int y = (int) ((fheight - sheight) / 2);
this.setLocation(x, y);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -