Quinn-Curtis Forums
Quinn-Curtis Forums
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Tools for Java
 QCChart2D for Java
 ChartView setBackground() cancels border
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rixmith

33 Posts

Posted - 27 Sep 2010 :  15:02:57  Show Profile  Reply with Quote
Is it possible to set a Background for a ChartView object and to conserve the ChartView border? It appears that setting the ChartView background prevents the Chartview border from being painted.

I'm using the constructor Background(timeCoords, bgtype, color). I tried both background types and neither results in the border being painted.



Rick

quinncurtis

1586 Posts

Posted - 27 Sep 2010 :  18:13:35  Show Profile  Reply with Quote
What is the setBackground reference in your topic?

Are you referring to the Background setBorderEnable method of drawing the border ?

We see that there is a bug in this. The line thickness of the border is not set when it is drawn, so it stays at the default value of 1 and can barely be seen. It is a simple fix. If you have the source we can tell you what to do. Otherwise we will put it in an update next month.
Go to Top of Page

rixmith

33 Posts

Posted - 27 Sep 2010 :  19:44:37  Show Profile  Reply with Quote
To be clear, let me show you a simple test that illustrates the
problem. Run the code below and the ChartView border is drawn correctly.
Uncomment the line that adds the background to the ChartView and
run again: the border is not painted.
The println() at the end of the code confirms that the border is set correctly.

public static void main(String[] args) {
JFrame f = new JFrame("Test ChartView Border");
f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
f.setSize(300,300);
TimeCoordinates timeCoords = new TimeCoordinates();

ChartView cv = new ChartView();
Background background = new Background( timeCoords, ChartConstants.PLOT_BACKGROUND,
new Color(6,255,77));
// cv.addChartObject(background); //***** uncomment this line
cv.setBorder(BorderFactory.createLineBorder(Color.red, 3));
f.add(cv);
f.setVisible(true);
System.out.println("Thickness >> " + ((LineBorder)cv.getBorder()).getThickness());


}

Rick
Go to Top of Page

quinncurtis

1586 Posts

Posted - 27 Sep 2010 :  22:32:41  Show Profile  Reply with Quote
In that case, yes the ChartView will always hide the border. We have no provision in the software to take into account the border of the subclassed JPanel. The software has never had that feature. Your only alternative is to create JPanel, add a border to it, then place the ChartView as a child of the JPanel, positioned inside the border.
Go to Top of Page

rixmith

33 Posts

Posted - 28 Sep 2010 :  07:54:49  Show Profile  Reply with Quote
I just wanted to confirm thst I had not missed an option or setting that would have gotten the job without the extra JPanel. Thank you for the quick response.

Rick
Go to Top of Page

quinncurtis

1586 Posts

Posted - 28 Sep 2010 :  09:33:32  Show Profile  Reply with Quote
Given the border in your example is a simple line border, you can just use the built in border of the Background class, as previously mentioned, setBorderEnable(true). That is, once we update the software to include the fix for the border line width bug. That will take place before the end of next month.
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Quinn-Curtis Forums © 2000-2018 Quinn-Curtis, Inc. Go To Top Of Page
Powered By: Snitz Forums 2000 Version 3.4.07