📄 gameframe.java
字号:
/**
* GameFrame.java
* Summary 游戏窗体
* Created on 2002-3-2
* @author Dorian
*/
package com.Dorian.Tetris;
import java.awt.Container;
import java.awt.Image;
import java.awt.Point;
import java.awt.Toolkit;
import javax.swing.JFrame;
public class GameFrame extends JFrame{
public GameFrame() {
Toolkit kit = Toolkit.getDefaultToolkit();
// //窗体居中
// Dimension screenSize = kit.getScreenSize();
// int screenWidth = screenSize.width;
// int screenHeight = screenSize.height;
// setSize(screenWidth/2,screenHeight/2);
// setLocation(screenWidth/4,screenHeight/4);
Image imgLogo = kit.getImage("images/logo.jpg");
// ImageIcon icon = new ImageIcon(Game.class.getResource("images/logo.jpg"));
// Image imgLogo = icon.getImage();
setIconImage(imgLogo);
contentPane = this.getContentPane();
panel = new GamePanel();
this.setTitle("俄罗斯方块");
this.setSize(WIDTH,HEIGHT);
this.setUndecorated(true);
this.setResizable(false);
contentPane.add(panel);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
//移动窗体
// public void mouseDragged(MouseEvent e) {
// Point location = this.getLocation();
// this.setLocation(location.x+e.getX()-point.x,
// location.y+e.getY()-point.y);
// }
//
// public void mousePressed(MouseEvent e) {
// this.point.x = e.getX();
// this.point.y = e.getY();
// }
private Container contentPane;
private GamePanel panel;
private Point point;
private final static int WIDTH = 520;
private final static int HEIGHT = 580;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -