Topic: 求助!!这个程序错在哪里!!!急急急

  Print this page

1.求助!!这个程序错在哪里!!!急急急 Copy to clipboard
Posted by: jeson168
Posted on: 2007-05-18 14:15

import java.awt.*;
import java.awt.event.*;
public class TwoListenInner
{
 private Frame f;
 private TextField tf;
 public static void main(String args[])
{
   TwoListenInner that=new TwoListenInner();
   that.go();
  }

 public void go()
{
   f=new Frame("Two listeners example");
   f.add("North",new Label("Click and drag the mouse"));
   tf=new TextField(30);
   f.add("South",tf);
   f.addMouseMotionListener(new MouseMotionHandler());
   f.addMouseListener(new MouseEventHandler());
   f.setSize(300,300);
   f.setVisible(true);
  }
 public class MouseMotionHandler extends MouseMotionAdapter
{
   public void mouseDragged(MouseEvent e)
{
      String s="Mouse draggingKisses="+e.getX()+"Y="+e.getY();
      tf.setTextMoon;
    }
  }
 public class MouseEventHandler extends MouseAdapter
{
   public void mouseEntered(MouseEvent e)
{
    String s=new String("The mouse entered");
      tf.setTextMoon;
    }
  public void mouseExited(MouseEvent e)
{
      String s="The mouse left the building";
      tf.setTextMoon;
    }
  }
}

2.Re:求助!!这个程序错在哪里!!!急急急 [Re: jeson168] Copy to clipboard
Posted by: aaarong
Posted on: 2007-05-18 15:38

import java.awt.*;
import java.awt.event.*;
public class TwoListenInner{
  private Frame f;
  private TextField tf;
  public static void main(String[] args){
    TwoListenInner that=new TwoListenInner();
    that.go();
  }
  public void go(){
    f=new Frame("Two listeners example");
    f.add("North",new Label("Click and drag the mouse"));
    tf=new TextField(30);
    f.add("South",tf);
    f.addMouseMotionListener(new MouseMotionHandler());
    f.addMouseListener(new MouseEventHandler());
    f.setSize(300,300);
    f.setVisible(true);
  }
   public class MouseEventHandler extends MouseAdapter{
    public void mouseEntered(MouseEvent e){
      String s=new String("the mouse entered");
      tf.setTextMoon;
    }
    public void mouseExited(MouseEvent e){
      String x=new String("The mouse left the building");
      tf.setTextFight;
    }
  }
  public class MouseMotionHandler extends MouseMotionAdapter{
    public void mouseDragged(MouseEvent e){
      String o="Mouse dragging x="+e.getX()+"y="+e.getY();
      tf.setTextClock;
    }
  }
}

3.Re:求助!!这个程序错在哪里!!!急急急 [Re: jeson168] Copy to clipboard
Posted by: aaarong
Posted on: 2007-05-18 15:46

重新对比了一下并调试了一下
发现并没有错呀........

4.Re:求助!!这个程序错在哪里!!!急急急 [Re: jeson168] Copy to clipboard
Posted by: jeson168
Posted on: 2007-05-18 20:09

这个是我在网上看到的 自己而觉得没有什么错误 就复制下来了
不过编译时 出现一些无用字符的错误
我想可能是因为复制下来的缘故吧

5.Re:求助!!这个程序错在哪里!!!急急急 [Re: jeson168] Copy to clipboard
Posted by: aaarong
Posted on: 2007-05-18 22:05

是呀 第一次重新复制也不能编译 我就自己动手打 后来编译发现没有错误

6.Re:求助!!这个程序错在哪里!!!急急急 [Re: jeson168] Copy to clipboard
Posted by: jeson168
Posted on: 2007-05-18 23:55

下次还是老老实实写程序
谢谢楼上的前辈

7.Re:求助!!这个程序错在哪里!!!急急急 [Re: jeson168] Copy to clipboard
Posted by: death2019
Posted on: 2007-05-21 07:39

import java.awt.*;
import java.awt.event.*;
public class TwolistenInner
{
private Frame f;
private TextFileld tf;
public static void main(String args[])
{
Twolisteninner that=new TwolistenInner();
that.go();
}
public void go()
{
f=new Frame("Two listeners example");
f.add("North",new Label ("Click and drag the mouse"));
tf=new Textfild(30);
f.add("South",tf);
f.addmousemotionListener(new MouseMotionhandler());
f.addMoseListener(new MouseEventhandler());
f.setSize(300.300);
f.setVisible(ture);
}
public class MouseMotionHandler extends MouseMotionAdapter
{
public class mouseDraagged (MouseEvent e);
{
String s ="Mouse dragging="e+.getX()+"Y="+e.getY();
tf.setText;
}
}
public class MouseEventhandler extends MouseAdapter
{
public void mouseEntered(MouseEvent e)
{
String s=new String("The mouse entered"):
tf.setText;
}
public void mouseExited(mouseEvent e)
{
String s="The mouse left the buliding";
tf.setText;
}
}
}

TwoListenInner.java:25: 需要 '{'
public class mouseDraagged (MouseEvent e);
^
TwoListenInner.java:27: 需要 ';'
String s ="Mouse dragging="e+.getX()+"Y="+e.getY();
^
TwoListenInner.java:28: 不是语句
tf.setText;
^
TwoListenInner.java:35: 需要 ';'
String s=new String("The mouse entered"):
^
TwoListenInner.java:41: 不是语句
tf.setText;
^
5 错误
Exit code: 1
There were errors

8.Re:求助!!这个程序错在哪里!!!急急急 [Re: jeson168] Copy to clipboard
Posted by: death2019
Posted on: 2007-05-21 07:41

为什么啊?

9.Re:求助!!这个程序错在哪里!!!急急急 [Re: jeson168] Copy to clipboard
Posted by: fanli82
Posted on: 2007-05-25 21:04

import java.awt.*;
import java.awt.event.*;
public class fanli{
private Frame f;
private TextField tf;
public static void main(String[] args){
fanli that=new fanli();
that.go();
}
public void go(){
f=new Frame("Two listeners example");
f.add("North",new Label("Click and drag the mouse"));
tf=new TextField(30);
f.add("South",tf);
f.addMouseMotionListener(new MouseMotionHandler());
f.addMouseListener(new MouseEventHandler());
f.setSize(300,300);
f.setVisible(true);
}
public class MouseEventHandler extends MouseAdapter{
public void mouseEntered(MouseEvent e){
String s=new String("the mouse entered");
tf.setTextMoon;
}
public void mouseExited(MouseEvent e){
String x=new String("The mouse left the building");
tf.setTextFight;
}
}
public class MouseMotionHandler extends MouseMotionAdapter{
public void mouseDragged(MouseEvent e){
String o="Mouse dragging x="+e.getX()+"y="+e.getY();
tf.setTextClock;
}
}
}


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923