老是出现报错! 我是个新手,在MYECLIPE中老出现这样一个报错“Syntax error, insert ";" to complete Statement”,不知道到底是错在哪个地方。请 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Syntax error, insert ";" to complete Statement”,是你的代码少了 ; 号检查红颜色的代码 你的inset语句,语法可能有错 但我找不出错误的原因啊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 dragging:X="+e.getX()+"Y="+e.getY(); tf.setText(s); }} public class MouseEventHandler extends MouseAdapter { public void mouseEntered(MouseEvent e){ String s="The mouse entered"; tf.setText(s); }public void mouseExited(MouseEvent e){String s="The mouse left the building";tf.setText(s); } }} 我大概修改了一下,你看看,在我这里已经可以运行了。下次记得写frame的结束和关闭事件呀!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 dragging:X="+e.getX()+"Y="+e.getY();tf.setText(s); }}public class MouseEventHandler extends MouseAdapter {public void mouseEntered(MouseEvent e){String s="The mouse entered";tf.setText(s); }public void mouseExited(MouseEvent e){String s="The mouse left the building";tf.setText(s); } }} 100分求助Socket网络编程 java读取大文件并显示的问题 用Java怎么实现一个定时开关机程序?谢谢 请帮我看一下 .bat 执行 java 程序。!! 帮帮忙啊 关于java当中继承内部类的一个麻烦问题,难道不能按照正常的思维方式去理解? 求教会议管理系统问题(jsp或java) java nio byteBuffer与READ事件 并发内存可见性问题,并发大神请进 建立了多表关联的EntityBean,新增数据的时候错误! 请问下JavaBean是做什么用的? www.silver-map.com 电子地图demo下载
是你的代码少了 ; 号检查红颜色的代码
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 dragging:X="+e.getX()+"Y="+e.getY();
tf.setText(s);
}
}
public class MouseEventHandler extends MouseAdapter {
public void mouseEntered(MouseEvent e){
String s="The mouse entered";
tf.setText(s);
}
public void mouseExited(MouseEvent e){
String s="The mouse left the building";
tf.setText(s);
}
}
}
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 dragging:X="+e.getX()+"Y="+e.getY();
tf.setText(s);
}
}
public class MouseEventHandler extends MouseAdapter {
public void mouseEntered(MouseEvent e){
String s="The mouse entered";
tf.setText(s);
}
public void mouseExited(MouseEvent e){
String s="The mouse left the building";
tf.setText(s);
}
}
}