frame.setBounds(600, 300, 550,615);
frame.setLayout(null);
frame.setTitle("欢迎来到黄旭的五子棋");
NowCol1 = new JTextField("黑方下棋",30);
NowCol1.setEditable(false);
Font f = new Font("宋体",Font.BOLD,20);
NowCol1.setFont(f);
NowCol2 = new JTextField("",30);
NowCol2.setEditable(false);
NowCol2.setFont(f);
frame.add(NowCol1);
NowCol1.setBounds(50, 25, 90, 30);
frame.add(NowCol2);
NowCol2.setBounds(380, 25, 90, 30);
frame.setVisible(true);
menuBar = new JMenuBar();
menu = new JMenu("开始");
exitItem = new JMenuItem("退出");
restarItem = new JMenuItem("重新开始");
menu.add(restarItem);
menu.addSeparator();
menu.add(exitItem);
exitItem.addActionListener(this);
restarItem.addActionListener(this);
menuBar.add(menu);
frame.setJMenuBar(menuBar);
panel = new JPanel()
{
public void paint(Graphics g)
{
for(int i=40;i<460;i=i+30)
{
g.drawLine(40,i, 460, i);
}
g.drawLine(40,460, 460, 460);
for(int i=40;i<460;i=i+30)
{
g.drawLine(i,40, i, 460);
}
g.drawLine(460,40, 460, 460);
super.setBackground(Color.ORANGE);
}
};
panel.setBounds(10,30, 520, 520);
panel.addMouseListener(this);
frame.add(panel);
//橘黄色就是显示不出来