Yang Chen wrote:
>
> Hello all,
>
>  I have trouble with the drawImage in the below. Does anyone can help?
> Thank you in advance.
>
> Image img = toolkitloadImage("huygens1.thm.gif");
> int iw = img.getWidth(this);
> int ih = img.getHeight(this);
> private static BufferedImage bi = new
> BufferedImage(iw,ih,BufferedImage.TYPE_INT_RGB);
> Graphics2D g2 =  bi.createGraphics();
> g2.drawImage(img , 0, 0, this);
> int[] pixels = (img.getRaster()).getPixels(0,0,r.iw,r.ih,new int[r.iw*r.ih*3]);
>
> Compliation Error
> *******
> Identifier expected.
> g2.drawImage(img, 0, 0, this);
>                 ^
>
> As I change to g2.drawImage(Image img, 0, 0, this); it showed
>
> Type expected
> g2.drawImage(Image img, 0, 0, this);
>                         ^
>
> Then I change to g2.drawImage(Image img, int 0, int 0, this); it showed
>
> Identifier expected
> g2.drawImage(Image img, int 0, int 0, this);
>                                   ^


You probably have some problems with braces ('{', '}'). It seems to me that
your code is interpreted as being outside of a method definition, e.g. on the
class level. The lines above could be interpreted as member variable
declarations by the compiler, so no error happens. The error itself sounds
like that the compiler expects types. This happens only at the definition of a
method (parameter list).


regards,

Klaus Malorny


___________________________________________________________________________
     |       |
     | knipp |                   Knipp  Medien und Kommunikation GmbH
      -------                           Technologiepark
                                        Martin-Schmeisser-Weg 9
                                        44227 Dortmund
     Dipl. Inf. Klaus Malorny           Germany
     [EMAIL PROTECTED]             Tel. +49 231 9703-0  Fax. -200

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to