Add button to Chart Properties Dialog
Add button to Chart Properties Dialog
Hi I am using the chart editor on the right-click to edit the charts, however the users are asking for the availability to not only have OK and Cancel buttons but also the "Apply" so that the changes can be applied for the user to review without having to click "OK" and re-open the properties window again if he needs to change something. I cannot seem to find where these buttons are added and how do I add the extra one. If these are added by default, is there any way I can add an extra button? Thanks!
Re: Add button to Chart Properties Dialog
The chart properties dialog box you are referring to, I believe, is shown from the ChartPanel.java's method (I am looking at JFreeChart 1.0.19 source). In looking at that method, the OK and CANCEL buttons you are seeing is from the standard JOptionPane.showConfirmDialog() (link http://docs.oracle.com/javase/tutorial/ ... ialog.html) which is a modal dialog that provides the OK and CANCEL buttons. Adding an APPLY button would require extending the ChartPanel class and overriding the method to show a modeless window (a new class) and take appropriate action when the user clicks the APPLY button.
Code: Select all
public void doEditChartProperties()
Code: Select all
public void doEditChartProperties()
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: Add button to Chart Properties Dialog
This example constructs a JToolBar of buttons that elicit the zoom actions used by the context menu; you can add other actions. On most platforms, the tool bar is detachable, providing a convenient floating palette.

