Hi,
I want to modify the menu that appears when I right click on a chart. Specifically, I want to keep the 'Save As', 'Print' and zooming options, but I want to remove the first 'properties' option.
Could someone suggest how I could do this?
Cheers,
Arwel
Change to the 'right-click' menu
Check the constructor for org.jfree.chart.ChartPanel. Specifically, pass false for the value of this parameter
Code: Select all
boolean properties,
-
- Posts: 47
- Joined: Thu Dec 11, 2008 7:59 pm
Elaborating of what skunk said, there are two constructors for a ChartPanel to control what shows in the right click menu.
You can also replace the right click menu entirely with your own.
Code: Select all
ChartPanel(JFreeChart chart, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips)
and
ChartPanel(JFreeChart chart, int width, int height, int minimumDrawWidth, int minimumDrawHeight, int maximumDrawWidth, int maximumDrawHeight, boolean useBuffer, boolean properties, boolean save, boolean print, boolean zoom, boolean tooltips)
Code: Select all
ChartPanel.setPopupMenu(JPopupMenu popup)
Re: Change to the 'right-click' menu
you can add menuitem to the list at any index you like. to remove properties option pass false in chartpanel constructor argurments and the rest to true.