public PlotPanel() {
// setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
setLayout(new BorderLayout());
JPanel panel;
Box section;
Box content = Box.createVerticalBox();
setName(resources.getString("PlotProperties"));
XYPlot plot = chart.getXYPlot();
// Create the title section
section=Box.createHorizontalBox();
section.add(new JLabel(resources.getString("PlotTitle:")));
section.add(tfTitle = new JTextField());
tfTitle.setText(chart.getTitle().getText());
content.add(section);
// X axis section
section = new Box(BoxLayout.Y_AXIS);
section.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),resources.getString("XAxis")));
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
CyclicNumberAxis cna = null;
if (plot.getDomainAxis() instanceof CyclicNumberAxis) cna = (CyclicNumberAxis)plot.getDomainAxis();
panel.add(cbcyclex = new ActionCheckBox(resources.getString("CyclicAxis"), cna!=null) {
public void actionPerformed(ActionEvent e) {
CardLayout cl = (CardLayout)(xcards.getLayout());
if (isSelected()) cl.show(xcards, "cyclic");
else cl.show(xcards, "normal");
}
});
panel.add(cbinvertx = new ActionCheckBox(resources.getString("Inverted"), plot.getDomainAxis().isInverted()) {
public void actionPerformed(ActionEvent e) {
}
});
section.add(panel);
xcards = new JPanel();
xcards.setLayout(new CardLayout());
Box hbox = Box.createHorizontalBox();
hbox.add(new JLabel(resources.getString("Period")));
hbox.add(nfperiodx = new NumberField(cna==null ? 0 : cna.getPeriod()));
hbox.add(Box.createHorizontalGlue());
hbox.add(new JLabel(resources.getString("Offset")));
hbox.add(nfoffsetx = new NumberField(cna==null ? 0 : cna.getOffset()));
xcards.add(hbox,"cyclic");
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
double autorange = plot.getDomainAxis().getFixedAutoRange();
panel.add(cbfixedautox = new ActionCheckBox(resources.getString("FixedRange"),autorange!=0) {
public void actionPerformed(ActionEvent e) {
nffixedautox.setEnabled(isSelected() && isEnabled());
}
});
panel.add(nffixedautox = new NumberField(autorange,10));
xcards.add(panel,"normal");
section.add(xcards);
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
panel.add(cbautox = new ActionCheckBox(resources.getString("Auto-update"), plot.getDomainAxis().isAutoRange()) {
public void actionPerformed(ActionEvent e) {
cbfixedautox.setEnabled(isSelected());
cbfixedautox.apply();
lpxmin.setEnabled(!isSelected());
lpxmax.setEnabled(!isSelected());
tfpxmin.setEnabled(!isSelected());
tfpxmax.setEnabled(!isSelected());
}
});
panel.add(lpxmin = new JLabel(resources.getString("minLabel")));
panel.add(tfpxmin = new NumberField(10));
tfpxmin.setValue(plot.getDomainAxis().getLowerBound());
panel.add(lpxmax = new JLabel(resources.getString("maxLabel")));
panel.add(tfpxmax = new NumberField(10));
tfpxmax.setValue(plot.getDomainAxis().getUpperBound());
cbautox.apply();
section.add(panel);
content.add(section);
// Now handle Y axis
section = new Box(BoxLayout.Y_AXIS);
section.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),resources.getString("YAxis")));
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
cna = null;
if (plot.getRangeAxis() instanceof CyclicNumberAxis) cna = (CyclicNumberAxis)plot.getRangeAxis();
panel.add(cbcycley = new ActionCheckBox(resources.getString("CyclicAxis"), cna!=null) {
public void actionPerformed(ActionEvent e) {
CardLayout cl = (CardLayout)(ycards.getLayout());
if (isSelected()) cl.show(ycards, "cyclic");
else cl.show(ycards, "normal");
}
});
panel.add(cbinverty = new ActionCheckBox(resources.getString("Inverted"), plot.getRangeAxis().isInverted()) {
public void actionPerformed(ActionEvent e) {
}
});
section.add(panel);
ycards = new JPanel();
ycards.setLayout(new CardLayout());
hbox = Box.createHorizontalBox();
hbox.add(new JLabel(resources.getString("Period")));
hbox.add(nfperiody = new NumberField(cna==null ? 0 : cna.getPeriod()));
hbox.add(Box.createHorizontalGlue());
hbox.add(new JLabel(resources.getString("Offset")));
hbox.add(nfoffsety = new NumberField(cna==null ? 0 : cna.getOffset()));
ycards.add(hbox,"cyclic");
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
autorange = plot.getRangeAxis().getFixedAutoRange();
panel.add(cbfixedautoy = new ActionCheckBox(resources.getString("FixedRange"),autorange!=0) {
public void actionPerformed(ActionEvent e) {
nffixedautoy.setEnabled(isSelected() && isEnabled());
}
});
panel.add(nffixedautoy = new NumberField(autorange,10));
ycards.add(panel,"normal");
section.add(ycards);
panel = new JPanel();
panel.setLayout(new FlowLayout(FlowLayout.LEFT));
panel.add(cbautoy = new ActionCheckBox(resources.getString("Auto-update"), plot.getRangeAxis().isAutoRange()) {
public void actionPerformed(ActionEvent e) {
cbfixedautoy.setEnabled(isSelected());
cbfixedautoy.apply();
lpymin.setEnabled(!isSelected());
lpymax.setEnabled(!isSelected());
tfpymin.setEnabled(!isSelected());
tfpymax.setEnabled(!isSelected());
}
});
panel.add(lpymin = new JLabel(resources.getString("minLabel")));
panel.add(tfpymin = new NumberField(10));
tfpymin.setValue(plot.getRangeAxis().getLowerBound());
panel.add(lpymax = new JLabel(resources.getString("maxLabel")));
panel.add(tfpymax = new NumberField(10));
tfpymax.setValue(plot.getRangeAxis().getUpperBound());
cbautoy.apply();
section.add(panel);
Box box = Box.createHorizontalBox();
box.add(new JLabel(resources.getString("Curves:")));
box.add(pcbxcurves = new JComboBox());
box.add(pcurvecolor = new JButton(" "));
box.add(pcurvedelete = new JButton(resources.getString("Delete")));
section.add(box);
content.add(section);
pcbxcurves.setEditable(true);
noCurveColor = pcurvecolor.getBackground();