/** * When a checkbox is changed ... * * @param event the event. */ public void actionPerformed(final ActionEvent event) { final ValueAxis[] axes = new ValueAxis[4]; final XYPlot plot = this.chart.getXYPlot(); axes[0] = plot.getDomainAxis(); axes[1] = plot.getRangeAxis(); axes[2] = plot.getDomainAxis(1); axes[3] = plot.getRangeAxis(1); final Object source = event.getSource(); if (source == this.symbolicAxesCheckBox) { final boolean val = this.symbolicAxesCheckBox.isSelected(); for (int i = 0; i < axes.length; i++) { ValueAxis axis = axes[i]; final String label = axis.getLabel(); final int maxTick = (int) axis.getUpperBound(); final String[] tickLabels = new String[maxTick]; final Font ft = axis.getTickLabelFont(); for (int itk = 0; itk < maxTick; itk++) { tickLabels[itk] = "Label " + itk; } axis = val ? new SymbolicAxis(label, tickLabels) : new NumberAxis(label); axis.setTickLabelFont(ft); axes[i] = axis; } plot.setDomainAxis(axes[0]); plot.setRangeAxis(axes[1]); plot.setDomainAxis(1, axes[2]); plot.setRangeAxis(1, axes[3]); } if (source == this.symbolicAxesCheckBox || source == this.verticalTickLabelsCheckBox) { final boolean val = this.verticalTickLabelsCheckBox.isSelected(); for (int i = 0; i < axes.length; i++) { axes[i].setVerticalTickLabels(val); } } else if (source == this.symbolicAxesCheckBox || source == this.horizontalPlotCheckBox) { final PlotOrientation val = this.horizontalPlotCheckBox.isSelected() ? PlotOrientation.HORIZONTAL : PlotOrientation.VERTICAL; this.chart.getXYPlot().setOrientation(val); } else if (source == this.symbolicAxesCheckBox || source == this.fontSizeTextField) { final String s = this.fontSizeTextField.getText(); if (s.length() > 0) { final float sz = Float.parseFloat(s); for (int i = 0; i < axes.length; i++) { final ValueAxis axis = axes[i]; Font ft = axis.getTickLabelFont(); ft = ft.deriveFont(sz); axis.setTickLabelFont(ft); } } } }