breakoutjframe.java

来自「一款小游戏 希望能帮助初学者 一些基本的知识 是作业作品」· Java 代码 · 共 39 行

JAVA
39
字号
/**
  * JFrame definition for
  * the BreakOut game.
  *
  * @author		Adriana Ferraro
  * @version  	S2, 2007
*/
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

public class BreakOutJFrame extends JFrame {
	public BreakOutJFrame(String title, int x, int y, int width, int height) {

		// Set the title, top left location, 
		//and close operation for the frame
		setTitle(title);
		setLocation(x, y);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

		// Create an instance of the JPanel class, 
		//and set this to define the
		// content of the window
		JPanel frameContent = new BreakOutJPanel();
		
		Container visibleArea = getContentPane();
		visibleArea.add(frameContent);

		// Set the size of the content pane of the window, 
		//resize and validate the
		// window to suit, obtain keyboard focus, 
		//and then make the window visible
		frameContent.setPreferredSize(new Dimension(width, height));
		pack();
		frameContent.requestFocusInWindow();
		setVisible(true);
	}
}

⌨️ 快捷键说明

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