java - Jfreechart:displaying multiple charts -
i new java , jfreecharts , using jfreechart create many charts(barcharts , piecharts). display charts , when created. charts generated gets stacked upon other , last chart on top. if close last 1 charts gets closed. want know if possible have 1 frame , charts can navigated using 'next' , 'previous'button. if has experience in this, please share. in advance
the following more started. better use gui editor of netbeans ide. mind following typed, without seeing compiler.
fields:
private static final int charts = 6; private int currentchartno = 0; private jbutton previousbutton = new jbutton("<"); private jbutton nextbutton = new jbutton(">"); private jpanel currentchartpanel = new jpanel(); private jpanel[] chartpanels = new jpanel[charts];
initialisation in frame:
// getcontentpane(), having per default borderlayout. add(currentchartpanel , borderlayout.center); add(previousbutton, borderlayout.west); add(nextbutton, borderlayout.east); previousbutton.addactionlistener(new actionlistener() { @override public void actionperformed(actionevent event) { if (currentchartno > 0) { getcontentpane().remove(currentchartpanel); --currentchartno; currentchartpanel = chartpanels[currentchartno]; getcontentpane().add(currentchartpanel, borderlayout.center); repaint(100l); } } });
it can made nicer, chart containing panel.
Comments
Post a Comment