java.awt.Graphics
Tao
tx11@cornell.edu
Fri Jan 26 17:06:00 GMT 2001
Hi:
i am a graduate in Cornell University.
I download the gcj 2.96-22-i386.rpm for my redhat linux 7.0 from
the Update agent. If I type gcj --help, it gave me the instruction. I
have a set of files which runs fine in Windows Codeworrier. When I put
them on my linux box terminal like this:
gcj --main=<the main file> -o rs file1.java file2.javai
this is my comand:
gcj --main=CUCSGraphicsApplication.java -o rs Mars.java
CUCSDrawing.java Robot.java
and these are the error message, here below:
Mars.java: In class `Mars':
Mars.java: In method `myGraphics()':
Mars.java:147: Can't find method `translate(II)' in type
`java.awt.Graphics'.
g.translate(d.getInsets().left-pen,d.getInsets().top-pen);
^
Mars.java: In method `paintCell(java.awt.Graphics,int,int)':
Mars.java:213: Can't find method `setColor(Ljava/awt/Color;)' in type
`java.awt.Graphics'.
g.setColor(unknown && i == bumpy && j == bumpx ?
^
Mars.java:215: Can't find method `fillRect(IIII)' in type
`java.awt.Graphics'.
g.fillRect(x,y,pen,pen);
^
Mars.java:217: Can't find method `clearRect(IIII)' in type
`java.awt.Graphics'.
g.clearRect(x+2,y+2,pen-4,pen-4);
^
Mars.java: In method `erase(java.awt.Graphics,int,int)':
Mars.java:235: Can't find method `clearRect(IIII)' in type
`java.awt.Graphics'.
g.clearRect(j*pen,i*pen,pen,pen);
^
Mars.java: In method `drawGnat(java.awt.Graphics)':
Mars.java:241: Can't find method `clearRect(IIII)' in type
`java.awt.Graphics'.
g.clearRect(x,y,pen,pen);
^
Mars.java:242: Can't find method `setColor(Ljava/awt/Color;)' in type
`java.awt.Graphics'.
g.setColor(Color.black);
^
Mars.java:243: Can't find method `fillOval(IIII)' in type
`java.awt.Graphics'.
g.fillOval(x+1,y+1,pen-2,pen-2);
^
Mars.java: In method `drawRobot(java.awt.Graphics)':
Mars.java:249: Can't find method `clearRect(IIII)' in type
`java.awt.Graphics'.
g.clearRect(x,y,pen,pen);
^
Mars.java:250: Can't find method `setColor(Ljava/awt/Color;)' in type
`java.awt.Graphics'.
g.setColor(Color.blue);
^
Mars.java:251: Can't find method `drawOval(IIII)' in type
`java.awt.Graphics'.
g.drawOval(x+1,y+1,pen-2,pen-2);
^
Mars.java:252: Can't find method `drawOval(IIII)' in type
`java.awt.Graphics'.
g.drawOval(x+2,y+2,pen-4,pen-4);
^
Mars.java: In method `drawPlan(java.awt.Graphics,boolean)':
Mars.java:313: Can't find method `setColor(Ljava/awt/Color;)' in type
`java.awt.Graphics'.
g.setColor(erase ? Color.white : Color.black);
^
Mars.java:314: Can't find method `translate(II)' in type
`java.awt.Graphics'.
g.translate(pen/2,pen/2);
^
Mars.java:316: Can't find method `drawLine(IIII)' in type
`java.awt.Graphics'.
g.drawLine(plan[i][1]*pen, plan[i][0]*pen,
^
Mars.java:318: Can't find method `translate(II)' in type
`java.awt.Graphics'.
g.translate(-pen/2,-pen/2);
^
Mars.java: In method `moveRobot()':
Mars.java:349: Can't find method `translate(II)' in type
`java.awt.Graphics'.
g.translate(tx,ty); paint(g);
^
Mars.java:350: Can't find method `translate(II)' in type
`java.awt.Graphics'.
g.translate(-tx, -ty); paint(g);
^
18 errors
*************************************************************************
It looks like the reason is in Mars.java, I declared a variable
Graphics g=myGraphics(); and uses
g.translate(x, y) et al, which are supposed to be existed in
the java.awt.Graphics class.
myGraphics() is a method which come from my subclass of the
java.awt.Frame class by getGraphics() and return it.
and I import the java.awt.* class on all my classes. Is
something wrong with me? or the
java.awt.Graphics in libgcj does not contain those methods
such as setColor, fillOval, which should be there?
Looking forward to your help.
thank you.
More information about the Gcc-bugs
mailing list