标题:各位大侠帮我看看出了什么问题?
取消只看楼主
huxiangwenhu
Rank: 4
等 级:业余侠客
威 望:1
帖 子:191
专家分:262
注 册:2010-6-1
结帖率:90.91%
已结贴  问题点数:20 回复次数:0 
各位大侠帮我看看出了什么问题?
以下是我建立的一个五子棋的程序,但是运行时不能通过,提示如下错误信息:

帮我看下怎么改过来啊,谢谢了
import java.awt.*;
import java.awt.Event.*;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.EventListener;
import java.util.Vector;
public class LoadPic extends Frame implements MouseListener
{
    Vector v=new Vector();
    public LoadPic()
    {
        super("五子棋棋盘");
        this.addMouseListener(this);
        this.setSize(435,465);
    }
    public void paint(Graphics g)
    {
        Toolkit toolkit =Toolkit.getDefaultToolkit();
        Image img1=toolkit.getImage("blue.jpg");
        Image imgwhite=toolkit.getImage("green.jpg");
        g.drawImage(img1,0,20,this);
        for(int i=0;i<v.size();i++)
        {
            String str=(String)v.get(i);
            String tmp[]=str.split("-");
            int a=Integer.parseInt(tmp[0]);
            int b=Integer.parseInt(tmp[1]);
            g.drawImage(imgwhite, a, b, this);
        }
    }
    public static void main(String args[])
    {
        new LoadPic().show();
    }
    public void mouseCliked(MouseEvent e)
    {
        int x=e.getX();
        int y=e.getY();
        if(!v.contains(x+"-"+y))
        {
            v.add(x+"-"+y);
        }
        this.repaint();
    }
    public void mousePressed(MouseEvent e){}
    public void mouseReleased(MouseEvent e){}
    public void mouseEntered(MouseEvent e){}
    public void mouseExited(MouseEvent e){}
}
搜索更多相关主题的帖子: 五子棋 Vector public import super 
2010-08-02 21:12



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-314638-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.537984 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved