📄 board.java
字号:
import java.awt.*;import java.awt.event.*;/** * Creates a representation of the board for the games and keeps track * of the neighbouring fields and if any token occupy them, it tells * the field View and Field Controller where the tokens are on the * board, so they can depict it */class Board extends Panel{ private Grid _grid; public Board(int width, int height, FieldFactory factory) { _grid = new Grid(width, height, factory); setLayout(new GridLayout(width,height)); for(int v = 0; v < height; v++) for(int h = 0; h < width; h++) { Component view; view = factory.createView((Field)_grid.getCell(h,v)); add(view); } } public void clear() { _grid.clear(); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -