- Joined
- Dec 15, 2009
- Messages
- 1
- Reaction score
- 0
Hi
I'm trying to make a BMTron game using color detection and i cant seem to get the getRGB() method to work.
Ive never used this before but it doesn't seem to hard from what I've seen on the internet, the only thing is i don't know why Ii cant get it to work.
I have two variables in order to buffer my screen
and then I buffer my screen with
and when i try to get an RBG value with .getRGB using
I get an error message that says
Error: cannot find symbol
symbol : method getRGB(int,int)
location: class java.awt.Image
can anyone tell me what I'm doing wrong or what I have to include in order to make this work?
I'm trying to make a BMTron game using color detection and i cant seem to get the getRGB() method to work.
Ive never used this before but it doesn't seem to hard from what I've seen on the internet, the only thing is i don't know why Ii cant get it to work.
I have two variables in order to buffer my screen
Code:
Image dbImage;
Graphics dbg;
and then I buffer my screen with
Code:
public void update (Graphics g)
{
if (dbImage == null)
{
dbImage = createImage (this.getSize().width, this.getSize().height);
dbg = dbImage.getGraphics ();
}
dbg.setColor (getForeground());
paint (dbg);
g.drawImage (dbImage, 0, 0, this);
}
and when i try to get an RBG value with .getRGB using
Code:
int pixel = dbImage.getRGB(50, 50);
I get an error message that says
Error: cannot find symbol
symbol : method getRGB(int,int)
location: class java.awt.Image
can anyone tell me what I'm doing wrong or what I have to include in order to make this work?