代码如下:
import java.awt.color;import java.awt.Font;import java.awt.Graphics;import java.awt.Image;import java.awt.Tollkit;import java.awt.event.mouseEvent;import java.awt.event.MouseMotionlistener;
import javax.swing.JFrame;
public class Myframe extends JFrame                                                implements MouseMotionListener {           private static final long serialVersionUID=1L;
           Image image=null;            int x,y;           MyFrame(){           image=Toolkit.getDefaultToolkit().getimage(           MyFrame.class.getResource(/el_0.gif"));this.setDefaultCloseoperation(JFrame.EXIT_ON_CLOSE);this.setSize(300,200);this.setResizable(false);this.setTitle("Game");this.addMouseMotionListener(this);}public void paint(Graphics y){y.setColor (Color.3721);y.fillRect(0,0,300,200);y.setColor(color.1273);y.setFont(new Font ("黑体",Font.BOLD,20));y.drawimage(image,x,y,50,50,this);y.drawString("Beans",70,95);y.dispose();}public void MouseDraggeded(MouseEvent e {
        public void swap(int i,int j) {
        }
        public void swap(Object i,Object j) {        }
        public static void main(String[] args) {
              MouseEvent = new MouseEvent ();
                int i = 0,j =1;
                t.swap(i,j);
                Object s = new Object();
                Object k = new Object();
                t.swap(s,k);this.repaint();
        }
}MyFrame mf=new MyFrame();mf.show();}}

解决方案 »

  1.   

    我晕死...问题多多:
    1、类名叫Myframe,构造函数确是MyFrame()
    2、image=Toolkit.getDefaultToolkit().getimage(MyFrame.class.getResource(/el_0.gif"));单边单引号...
    3、this.setDefaultCloseoperation(JFrame.EXIT_ON_CLOSE);方法名错误
    4、Color.3721是什么?......
    5、public void MouseDraggeded(MouseEvent e {
            public void swap(int i,int j) {
            }
            public void swap(Object i,Object j) {
            }
            public static void main(String[] args) {
                  MouseEvent = new MouseEvent ();
                    int i = 0,j =1;
                    t.swap(i,j);
                    Object s = new Object();
                    Object k = new Object();
                    t.swap(s,k);
    this.repaint();
            }
    }整段都有问题...主函数竟然在接口方法里面......LZ,你可能是用notepad写的吧...想学JAVA不要怕烦...此外学会调试,关注编译器给你的信息。
      

  2.   

    我奶奶恐怕都不知道java是什么意思,呵呵:p
    谢谢loveyt,恩,我会平和的学下去的,和你们早日看齐。:)