Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic How to set the background color (Read 2934 times)
cpmjones
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Aug 4th, 2008
How to set the background color
Aug 4th, 2008 at 9:47am
Print Post  
I am currently evaluating jDiagram 2 and am unable to change the background color of my diagrams.

I have tried the following:

fc.setBackBrush(new SolidBrush(Color.WHITE));

and

view.setBackground(Color.WHITE);

I still end up with an orange background.

Any help is greatly appreciated.

Thanks,

Chris
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3233
Joined: Oct 19th, 2005
Re: How to set the background color
Reply #1 - Aug 4th, 2008 at 10:58am
Print Post  
This worked for me:

diagram = new Diagram();
diagramView = new DiagramView(diagram);
...
diagram.setBackBrush(new SolidBrush(Color.red));

The background brush is stored in both the binary-format and xml files. If you call the loadFrom or loadFromXml method after setting the background brush, you will get the brush that was saved in the file.

HTH
  
Back to top
 
IP Logged
 
cpmjones
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Aug 4th, 2008
Re: How to set the background color
Reply #2 - Aug 4th, 2008 at 1:28pm
Print Post  
Hi glavcho,

I think the problem I am having is down to how I use diagram.createImage() as I can see the background white in a JFrame, but not when the BufferedImage is saved as a jpeg. I guess this is not a JDiagram question.

Thanks for you help!

Chris
  
Back to top
 
IP Logged
 
Slavcho
YaBB Moderator
*****
Offline


tech.support

Posts: 3233
Joined: Oct 19th, 2005
Re: How to set the background color
Reply #3 - Aug 4th, 2008 at 2:06pm
Print Post  
Hello Chris,

Seems something is wrong with the jpeg encoder. I can see the orange color too when exporting to jpeg with this code, and the nodes colors are distorted too,

ImageIO.write(image, "jpeg", new File("C:\\test.jpeg"));

while it looks perfectly good when save in png format,

ImageIO.write(image, "png", new File("C:\\test.png"));

g.
  
Back to top
 
IP Logged
 
cpmjones
YaBB Newbies
*
Offline


I love YaBB 1G - SP1!

Posts: 23
Joined: Aug 4th, 2008
Re: How to set the background color
Reply #4 - Aug 4th, 2008 at 2:17pm
Print Post  
Hi g,

I'll stick with the png output for now.

Thanks,

Chris
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint