framedarea.java
来自「初级学习资料必读本」· Java 代码 · 共 40 行
JAVA
40 行
import java.awt.*;public class FramedArea extends Panel { private PhilosopherArea philosopherArea; public FramedArea(PhilAnimator controller) { super(); //Set layout to one that makes its contents as big as possible. setLayout(new GridLayout(1,0)); philosopherArea = new PhilosopherArea(controller); add(philosopherArea); validate(); } public Insets insets() { return new Insets(4,4,5,5); } public void paint(Graphics g) { Dimension d = size(); Color bg = getBackground(); g.setColor(bg); g.draw3DRect(0, 0, d.width - 1, d.height - 1, true); g.draw3DRect(3, 3, d.width - 7, d.height - 7, false); } public void stopButton() { philosopherArea.stopPhilosophers(); philosopherArea.createPhilosophersAndChopsticks(); philosopherArea.repaint(); } public void startButton() { philosopherArea.startPhilosophers(); }}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?