好象是这里了,提示是参数错误。f.add (tf, "BorderLayout.SOUTH"); BorderLayout.SOUTH是个静态变量,去掉双引号再试试。

解决方案 »

  1.   

    是多了双引号的原因,去掉后可以运行:import java.awt.*;
    import java.awt.event.*; class TwoListen implements MouseMotionListener, MouseListener { 
    private Frame f; 
    private TextField tf; public static void main(String args[]) { 
    TwoListen two = new TwoListen(); 
    two.go();
    } public void go() {
    f = new Frame("Two listeners example");
    //去掉引号后
    f.add (new Label("Click and drag the mouse"),BorderLayout.NORTH); 
    tf = new TextField (30); 
    //去掉引号后
    f.add (tf,BorderLayout.SOUTH); f.addMouseMotionListener(this); 
    f.addMouseListener (this); 
    f.setSize(300, 200); 
    f.setVisible(true); 

    // These are MouseMotionListener events 
    public void mouseDragged (MouseEvent e) { 
    String s = "Mouse dragging: X = " + e.getX() + " Y = " + e.getY(); 
    tf.setText (s); 

    public void mouseMoved (MouseEvent e) { 

    // These are MouseListener events 
    public void mouseClicked (MouseEvent e) { 

    public void mouseEntered (MouseEvent e) { 
    String s = "The mouse entered"; 
    tf.setText (s); 
    }public void mouseExited (MouseEvent e) { 
    String s = "The mouse has left the building"; 
    tf.setText (s); 

    public void mousePressed (MouseEvent e){} 
    public void mouseReleased (MouseEvent e){} 

      

  2.   

    去掉双引号后编译也不能通过了,他提示没有双引号的地方出错了,提示为--------------------Configuration: xue - j2sdk <Default>--------------------
    d:\JCreator Pro\MyProjects\xue\Xue.java:16: illegal character: \65292
    f.add (new Label ("Click and drag the mouse"), BorderLayout.NORTH); 
                                                 ^
    1 errorProcess completed.