• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

BufferedImage ( hello, anyone home??? )

 
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
all
i am attempting to draw a polygon (in this case a pentagon) and have succeeded in getting it drawn and displayed on JPanel.
trouble starts when i try to texture it so that the pentagon stands out from the rectangle it is painted on.
please help. SEE "// TROUBLE STARTS HERE" comment
compiler errors so far are
MyPoly7A.java [47:1] cannot resolve symbol
symbol : constructor BufferedImage (int[],int[],int,int)
location: class java.awt.image.BufferedImage
BufferedImage buffImage = new BufferedImage ( xy [ 0 ], xy [ 1 ], 5, BufferedImage.TYPE_INT_RGB );
^
MyPoly7A.java [49:1] cannot resolve symbol
symbol : constructor TexturePaint (java.awt.image.BufferedImage,java.awt.Polygon)
location: class java.awt.TexturePaint
TexturePaint tp = new TexturePaint ( buffImage, new Polygon( xy [ 0 ], xy [ 1 ], 5 ) );
^
MyPoly7A.java [51:1] cannot resolve symbol
symbol : method fillPoly (int,int,int,int)
location: class java.awt.Graphics2D
gg.fillPoly(10,10,200,300);
^
3 errors
Errors compiling MyPoly7A.


[ April 22, 2004: Message edited by: Douglas Braxton ]
 
Ranch Hand
Posts: 1923
Scala Postgres Database Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator



compiler errors so far are
MyPoly7A.java [47:1] cannot resolve symbol
symbol : constructor BufferedImage (int[],int[],int,int)
location: class java.awt.image.BufferedImage
BufferedImage buffImage = new BufferedImage ( xy [ 0 ], xy [ 1 ], 5, BufferedImage.TYPE_INT_RGB );


Let's look at the compilerwarning (cannot resolv symbol: constructor).
There is a constructor:

but the compiler looks for:
constructor BufferedImage (int[],int[],int,int)
For the first parameter, you use:

which is defined like this:

The first element xy[0]of a two-dimensional array xy[][] is the first array.
for instance:
 
reply
    Bookmark Topic Watch Topic
  • New Topic