Author |
Topic |
|
rixmith
33 Posts |
Posted - 27 Sep 2010 : 15:02:57
|
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
|
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. |
|
|
rixmith
33 Posts |
Posted - 27 Sep 2010 : 19:44:37
|
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 |
|
|
quinncurtis
1586 Posts |
Posted - 27 Sep 2010 : 22:32:41
|
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. |
|
|
rixmith
33 Posts |
Posted - 28 Sep 2010 : 07:54:49
|
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 |
|
|
quinncurtis
1586 Posts |
Posted - 28 Sep 2010 : 09:33:32
|
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. |
|
|
|
Topic |
|