final JMenuItem regressionLineCheckBox = new JCheckBoxMenuItem(BUNDLE.getString("RegressionLineLabel"),false);
final JMenu regressionMenu = new JMenu(subMenuText2);
SpinnerModel pointsModel = new SpinnerNumberModel(legendEntry.getNumberRegressionPoints(), 2,
PlotConstants.MAX_NUMBER_REGRESSION_POINTS, 1);
final JSpinner spinner = new MenuItemSpinner(pointsModel, regressionMenu);
spinner.setPreferredSize(new Dimension(50, 20));
spinner.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(ChangeEvent e) {
legendEntry.setNumberRegressionPoints(Integer.parseInt(((JSpinner)e.getSource()).getValue().toString()));
}
});
addPopupMenuListener(new PopupMenuListener() {
@Override
public void popupMenuWillBecomeVisible(PopupMenuEvent e) {
// TODO Auto-generated method stub
}
@Override
public void popupMenuWillBecomeInvisible(PopupMenuEvent e) {
if (spinnerValue != Integer.parseInt(spinner.getValue().toString())) {
manifestation.persistPlotLineSettings();
}
}