第一次接触Java,编译时候出现如下错误,不知如何解决,恳请帮助,谢谢!! (50分)

  • 主题发起人 主题发起人 流浪者_2008
  • 开始时间 开始时间

流浪者_2008

Unregistered / Unconfirmed
GUEST, unregistred user!
第一次接触Java,编译时候出现如下错误,不知如何解决,恳请帮助,谢谢!!
我已经将c:/jdk/bin加入到环境变量Path中了
C:/jdk/Java>javac TextTest.java
TextTest.java:5: package javax.swing.exentdo
es not exist
import javax.swing.exent.*;
^
TextTest.java:8: cannot resolve symbol
symbol : class string
location: class TextTest
public static void main(string[] args)
^
TextTest.java:78: cannot resolve symbol
symbol : classdo
ubel
location: class ClockPanel
privatedo
ubel HOUR_HAND_LENGTH=0.6*RADIUS;
^
TextTest.java:45: cannot resolve symbol
symbol : classdo
cumentListener
location: class TextTestFrame.ClockFieldListener
private class ClockFieldListener implementsdo
cumentListener
^
TextTest.java:47: cannot resolve symbol
symbol : classdo
cumentEvent
location: class TextTestFrame.ClockFieldListener
public void insertUpdate(DocumentEvent e){ setClock();};
^
TextTest.java:48: cannot resolve symbol
symbol : classdo
cumentEvent
location: class TextTestFrame.ClockFieldListener
public void removeUpdate(DocumentEvent e){ setClock();};
^
TextTest.java:49: cannot resolve symbol
symbol : classdo
cumentEvent
location: class TextTestFrame.ClockFieldListener
public void changeUpdate(DocumentEvent e){};
^
TextTest.java:21: cannot resolve symbol
symbol : class container
location: class TextTestFrame
container contentpane=getcontentpane();
^
TextTest.java:21: cannot resolve symbol
symbol : method getcontentpane ()
location: class TextTestFrame
container contentpane=getcontentpane();
^
TextTest.java:22: cannot resolve symbol
symbol : classdo
cumentListener
location: class TextTestFrame
DocumentListener Listener=new ClockFieldListener();
^
TextTest.java:28: cannot resolve symbol
symbol : variable JTextField
location: class TextTestFrame
Panel.add(JTextField);
^
TextTest.java:29: cannot resolve symbol
symbol : variable listener
location: class TextTestFrame
TextField.getDocument().addDocumentListener(listener);
^
TextTest.java:29: cannot resolve symbol
symbol : method getDocument ()
location: class java.awt.TextField
TextField.getDocument().addDocumentListener(listener);
^
TextTest.java:36: cannot resolve symbol
symbol : variable HourField
location: class TextTestFrame
int hours=Integer.parasint(HourField.getText().trim());
^
TextTest.java:37: cannot resolve symbol
symbol : variable MinutesField
location: class TextTestFrame
int minutes=Integer.parasint(MinutesField.getText().trim());
^
TextTest.java:63: missing method body, or declare abstract
public void drawHand(Graphics2D g2,double nagle,double handlength);
^
TextTest.java:65: cannot resolve symbol
symbol : variable RADIU
location: class ClockPanel
Point2D end=new Point2D.Double(RADIU+handlength*Math.cos(angle),
^
TextTest.java:65: cannot resolve symbol
symbol : variable handlength
location: class ClockPanel
Point2D end=new Point2D.Double(RADIU+handlength*Math.cos(angle),
^
TextTest.java:65: cannot resolve symbol
symbol : variable angle
location: class ClockPanel
Point2D end=new Point2D.Double(RADIU+handlength*Math.cos(angle),
^
TextTest.java:66: illegal forward reference
RADIUS-handlength*Math.sin(angle));
^
TextTest.java:66: cannot resolve symbol
symbol : variable handlength
location: class ClockPanel
RADIUS-handlength*Math.sin(angle));
^
TextTest.java:66: cannot resolve symbol
symbol : variable angle
location: class ClockPanel
RADIUS-handlength*Math.sin(angle));
^
TextTest.java:65: cannot resolve symbol
symbol : constructordo
uble (java.lang.String,double)
location: class java.awt.geom.Point2D.Double
Point2D end=new Point2D.Double(RADIU+handlength*Math.cos(angle),
^
TextTest.java:67: illegal forward reference
Point2D center=new Point2D.Double(RADIUS,RADIUS);
^
TextTest.java:67: illegal forward reference
Point2D center=new Point2D.Double(RADIUS,RADIUS);
^
TextTest.java:68: cannot resolve symbol
symbol : variable g2
location: class ClockPanel
g2.draw(new Line2D.Double(center,end));
^
TextTest.java:72: cannot resolve symbol
symbol : variable Minutes
location: class ClockPanel
Minutes=h*60+m;
^
27 errors
我想最重要的错误应该是以下两行,可能就是环境设置的问题吧
不知道还要设置那些呢?
TextTest.java:5: package javax.swing.exentdo
es not exist
import javax.swing.exent.*;
 
import javax.swing.exent.*;

?? 有没有写错? 应该是import javax.swing.event.*;吧
 
main 方法参数写错了,应该是 main(String argu[])
再一个就是类库写错了,
 
呵呵。很正常。就是写错了。仔细对照一下源代码检查一下。
还有就是JVA对大小写很敏感。要注意大小写
 
import javax.swing.event.*;
java区分大小写。
基本语法错的太多。
 
嘿嘿 抄书的把 嘿嘿 书上经常有很多错误
 
一般正规点的书上代码是很少会出错的.因为大部分国内的JAVA书都是翻译的.翻译的书错误大都出现在英文翻译到汉字后的语法上.而代码一般都是照搬.出现编译错误主要应该是你自己写错了或者是大小写没有区分.
 
应该是import javax.swing.event.*;吧
 
Java區分大小寫﹔
如果不太了解什么時候該用大寫什么時候用小寫的話﹐建議裝一個 Jbuild來學習語法。
 
多人接受答案了。
 
后退
顶部