Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Change Grey rectangle behind the JDiagram canvas (Read 2498 times)
Patrick Guerin
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Dec 11th, 2014
Change Grey rectangle behind the JDiagram canvas
Dec 18th, 2014 at 7:58pm
Print Post  
Hi,
Is there a way to change the background color of the JDiagram canvas. Look at the screenshot in the current post. We have the "white" part of the graph (the canvas size) where you can use the function diagram.resizeToFitItems(margins); But outside the graph canvas, there is a grey part. This part can be change when you drag the mouse resize the canvas. We want to put the grey part "white" (Same color then the graph canvas). Does anybody know how to do this ?

We use Eclipse 4.3 and java 1.7

I pay Pepsi to the first answering me to that question Roll Eyes He He...

Thank you for your great help...
  

Screen.png (Attachment deleted)
Back to top
 
IP Logged
 
Stoyo
God Member
*****
Offline


MindFusion support

Posts: 13230
Joined: Jul 20th, 2005
Re: Change Grey rectangle behind the JDiagram canvas
Reply #1 - Dec 19th, 2014 at 11:09am
Print Post  
Try this:

Code
Select All
for (Component child : ruler.getComponents())
{
	if (child instanceof JScrollPane)
	{
		JScrollPane scrollPane = (JScrollPane)child;
		scrollPane.getViewport().setBackground(Color.white);
	}
} 



Alternatively, set initial diagram size as big as the viewport. You can convert from Java points to diagram's MeasureUnit by calling DiagramView.deviceToDoc method.

I hope that helps,
Stoyan

  
Back to top
 
IP Logged
 
Patrick Guerin
YaBB Newbies
*
Offline


I Love MindFusion!

Posts: 21
Joined: Dec 11th, 2014
Re: Change Grey rectangle behind the JDiagram canvas
Reply #2 - Dec 19th, 2014 at 3:26pm
Print Post  
This is for you Stoyo...  This solution is exactly what we were looking for!  Cheesy
Thanks again and drink for this great answer !

  

pepsi.png (Attachment deleted)
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint