日期:2014-05-20 浏览次数:20650 次
import javax.swing.*; import java.awt.*; import java.awt.event.*; import java.net.*; import java.io.*; public class FiveChess extends JFrame{ private JPanel gamePanel = new JPanel(); public FiveChess(){ super(); this.setTitle("五子棋游戏"); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); this.setBounds(200,20,800,700); this.setResizable(false); this.getContentPane().setLayout(new BorderLayout()); this.getContentPane().add(gamePanel, BorderLayout.CENTER); gamePanel.setBackground(new Color(112,122,12)); this.setVisible(true); initGamePanel(gamePanel.getGraphics()); } public void initGamePanel(Graphics g){ g.setColor(Color.red); g.fill3DRect(0, 0, 200, 200, true); //gamePanel.repaint(); } public static void main(String[] args) { // TODO Auto-generated method stub new FiveChess(); } }