📄 viewpanel.java
字号:
package com.xmu.typot.ui;import java.awt.Dimension;import java.awt.Graphics;import java.awt.Graphics2D;import javax.swing.WindowConstants;import javax.swing.JFrame;import javax.swing.*;import com.xmu.typot.domain.*;public class ViewPanel extends javax.swing.JPanel { private Timer timer; private MonopolyGame game; { //Set Look & Feel try { javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); } catch(Exception e) { e.printStackTrace(); } } /** * Auto-generated main method to display this * JPanel inside a new JFrame. */ public static void main(String[] args) { JFrame frame = new JFrame(); frame.getContentPane().add(new ViewPanel()); frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE); frame.pack(); frame.setVisible(true); } public ViewPanel() { super(); initGUI(); } public ViewPanel(MonopolyGame game) { super(); initGUI(); this.game = game; } private void initGUI() { try { setPreferredSize(new Dimension(600, 500)); this.setBackground(new java.awt.Color(181,255,181)); } catch (Exception e) { e.printStackTrace(); } } public void paint(Graphics g) { game.draw((Graphics2D) g); } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -