Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

having problems with setting the color of a buffered Imaghe

 
j mcd
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I created a buffered image in my programme and I want it to have a green (orany color other than black)background however i have been unable to get it to change from black to any other other color.hers the code i have been working with .

public static void create(){
image=new BufferedImage(1350,650,BufferedImage.TYPE_INT_RGB);


}


static Color bimage=new Color(250,255,20,250);
public void paint(Graphics g ){
super.paint(g);

Graphics2D graphi=(Graphics2D)g;
graphi.setColor(new Color(200,0,200,150));
graphi.fillRect(x, y, 250, 250);
bimage=Color.green;
g.setColor(Color.green);
g.drawImage(image, 0,0,this);
g.setColor(Color.green);
}
 
Darryl Burke
Bartender
Posts: 5155
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Snippets of code out of context don't reveal what you're painting to. To get better help sooner, post a SSCCE (Short, Self Contained, Correct (Compilable), Example) that demonstrates the problem.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!