public class DrawLine extends DrawPanel{
public DrawLine(){}
public void paint (final Graphics g){
final Graphics2D g2d = (Graphics2D) g;
final Line2D aLine = new Line2D.Double(10 , 10 , 70 , 70);
g2d.draw(aLine);
}
public static void main (final String[] args){
DrawFrame.display ("DrawLine" , new DrawLine());
}}
这是我的代码,我正在导入整个java.awt。* - 包。 的错误信息是:Java - 使用awt -pack进行绘图
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
DrawFrame cannot be resolved
at DrawLine.main(DrawLine.java:11)
我的IDE就是Eclipse,最新版本,并在cmd中做Java的版本时,我有 “1.7.0_02”。
Environmentvariables:
路径:
C:\Users\Administrator\Desktop\Java Work;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Windows Live\Shared;C:\Program Files (x86)\Common Files\Roxio Shared\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\DLLShared\;C:\Program Files (x86)\Common Files\Roxio Shared\OEM\12.0\DLLShared\;C:\Program Files (x86)\Roxio\OEM\AudioCore\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.7.0_02\bin;.;
类路径:
.;C:\Program Files (x86)\Java\jre6\lib\ext\QTJava.zip;C:\Program Files (x86)\Java\jre6\bin;C:\Users\Administrator\Desktop\Java Work;.;
简单的程序,如输入输出,你好世界,计算工作。我试图制作大量的图形程序,看起来DrawFrame是个问题。它是我失踪的一些包吗?因为我可以编译其他程序,所以我不相信它的环境变量 - java非常麻烦(我只在Python & Scheme中编程)。
你从哪里得到'DrawPanel'?看起来'DrawFrame'应该在同一个API中。 –