1
package latexDraw.ui.dialog;
4
import java.awt.event.ActionEvent;
7
import javax.swing.border.CompoundBorder;
8
import javax.swing.border.EmptyBorder;
9
import javax.swing.border.TitledBorder;
10
import javax.swing.event.ChangeEvent;
12
import latexDraw.figures.Axe;
13
import latexDraw.figures.Figure;
14
import latexDraw.figures.GridShape;
15
import latexDraw.lang.LaTeXDrawLang;
16
import latexDraw.psTricks.PSTricksConstants;
17
import latexDraw.ui.DrawPanel;
21
* This class defines the frame allowing to modify axes.<br>
23
* This file is part of LaTeXDraw.<br>
24
* Copyright (c) 2005-2008 Arnaud BLOUIN<br>
26
* LaTeXDraw is free software; you can redistribute it and/or modify
27
* it under the terms of the GNU General Public License as published by
28
* the Free Software Foundation; either version 2 of the License, or
29
* any later version.<br>
31
* LaTeXDraw is distributed without any warranty; without even the
32
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
33
* PURPOSE. See the GNU General Public License for more details.<br>
36
* @author Arnaud BLOUIN<br>
40
public class ParametersAxeFrame extends AbstractGridShapeFrame
42
private static final long serialVersionUID = 1L;
44
protected JCheckBox drawXLabel;
46
protected JCheckBox drawYLabel;
48
protected JCheckBox drawXTicks;
50
protected JCheckBox drawYTicks;
52
protected JCheckBox defineLabelDistCB;
54
protected JComboBox axeShapeChoice;
56
protected JComboBox ticksShapeChoice;
58
protected JSpinner ticksSizeField;
60
protected JSpinner labelXDistField;
62
protected JSpinner labelYDistField;
64
/** Allows to change the increment of the X labels. */
65
protected JSpinner labelXIncrement;
67
/** Allows to change the increment of the Y labels. */
68
protected JSpinner labelYIncrement;
70
/** Allows to change the origin of the X labels. */
71
protected JSpinner labelXOrigin;
73
/** Allows to change the origin of the Y labels. */
74
protected JSpinner labelYOrigin;
76
protected JCheckBox showOriginCB;
78
public static final String LABEL_DRAW_X_LABELS = "dispXLab";//$NON-NLS-1$
80
public static final String LABEL_DEF_LABELS_DIST = "defDist";//$NON-NLS-1$
82
public static final String LABEL_DRAW_Y_LABELS = "dispYLab";//$NON-NLS-1$
84
public static final String LABEL_DRAW_X_TICKS = "dispXTicks";//$NON-NLS-1$
86
public static final String LABEL_DRAW_Y_TICKS = "dispYTicks";//$NON-NLS-1$
88
public static final String LABEL_Y_LABEL_DIST = "xLabSep";//$NON-NLS-1$
90
public static final String LABEL_X_LABEL_DIST = "yLabSep";//$NON-NLS-1$
92
public static final String LABEL_TICKS_SIZE_FIELD = "ticksSizeField";//$NON-NLS-1$
94
public static final String LABEL_LABEL_X_INCR = "labXInc";//$NON-NLS-1$
96
public static final String LABEL_LABEL_Y_INCR = "labYInc";//$NON-NLS-1$
98
public static final String LABEL_LABEL_X_ORIG = "labXOrig";//$NON-NLS-1$
100
public static final String LABEL_LABEL_Y_ORIG = "labYOrig";//$NON-NLS-1$
102
public static final String LABEL_SHOW_ORIGIN = "showOrig";//$NON-NLS-1$
107
public ParametersAxeFrame(Frame parent, DrawPanel d, boolean attachToMainFrame)
109
super(parent, d, attachToMainFrame);
113
Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
114
JTabbedPane tabbedPane = new JTabbedPane();
115
JPanel pButton = createButtonsPanel(this);
116
JPanel pGeneral = new JPanel();
117
JPanel pAxes = new JPanel();
118
JPanel pOther = new JPanel(new FlowLayout(FlowLayout.LEFT));
119
pAxes.setLayout(new BoxLayout(pAxes, BoxLayout.Y_AXIS));
120
JPanel positionP = createPositionPanel(false);
122
pGeneral.setLayout(new BoxLayout(pGeneral, BoxLayout.Y_AXIS));
123
pGeneral.add(positionP);
124
pGeneral.add(createBordersPanel(false));
125
pGeneral.add(pOther);
127
pOther.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.0"))); //$NON-NLS-1$
129
axeShapeChoice = Axe.createAxeStyleChoice();
130
axeShapeChoice.addActionListener(this);
131
pOther.add(axeShapeChoice);
133
showOriginCB = new JCheckBox(LaTeXDrawLang.getString1_8("ParametersAxeFrame.1"), true); //$NON-NLS-1$
134
showOriginCB.setActionCommand(LABEL_SHOW_ORIGIN);
135
showOriginCB.setName(LABEL_SHOW_ORIGIN);
136
showOriginCB.addActionListener(this);
137
pOther.add(showOriginCB);
139
String axesS = LaTeXDrawLang.getString1_8("ParametersAxeFrame.2"); //$NON-NLS-1$
140
pOther.setBorder(new CompoundBorder(new TitledBorder(null, axesS,
141
TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0)));
143
pAxes.add(createLabelsPanel());
144
pAxes.add(createTicksPanel());
146
tabbedPane.addTab(TITLE_TABBED_PANE_GENERAL, pGeneral);
147
tabbedPane.addTab(axesS, pAxes);
148
tabbedPane.addTab(NAME_TABBEDPANE_ARROW, createArrowPanel(true, false));
149
BoxLayout bl = new BoxLayout(getContentPane(), BoxLayout.Y_AXIS);
150
getContentPane().setLayout(bl);
151
getContentPane().add(glimpsePanelZoom);
152
getContentPane().add(tabbedPane);
153
getContentPane().add(pButton);
155
setLocation(dim.width/2-getWidth()/2, dim.height/2-getHeight()/2);
161
ExceptionFrameDialog.showExceptionDialog(e);
168
protected JPanel createLabelsPanel()
170
JPanel pLabels = new JPanel(new GridBagLayout());
171
GridBagConstraints constraint = new GridBagConstraints();
173
constraint.gridx = 0;
174
constraint.gridy = 0;
175
constraint.gridwidth = 1;
176
constraint.gridheight = 1;
177
constraint.weightx = 0.1;
178
constraint.weighty = 0.1;
179
constraint.fill = GridBagConstraints.NONE;
180
constraint.anchor = GridBagConstraints.WEST;
182
drawXLabel = new JCheckBox(LaTeXDrawLang.getString1_8("ParametersAxeFrame.3"), true); //$NON-NLS-1$
183
drawXLabel.setActionCommand(LABEL_DRAW_X_LABELS);
184
drawXLabel.setName(LABEL_DRAW_X_LABELS);
185
drawXLabel.addActionListener(this);
187
pLabels.add(drawXLabel, constraint);
189
drawYLabel = new JCheckBox(LaTeXDrawLang.getString1_8("ParametersAxeFrame.4"), true); //$NON-NLS-1$
190
drawYLabel.setActionCommand(LABEL_DRAW_Y_LABELS);
191
drawYLabel.setName(LABEL_DRAW_Y_LABELS);
192
drawYLabel.addActionListener(this);
194
pLabels.add(drawYLabel, constraint);
196
constraint.gridx = 0; constraint.gridy++;
197
constraint.gridwidth=2;
198
invertXLabelsCB = new JCheckBox(LABEL_ISXLABEL);
199
invertXLabelsCB.setText(LABEL_ISXLABEL);
200
invertXLabelsCB.setSelected(GridShape.DEFAULT_ISYLABELWEST);
201
invertXLabelsCB.setActionCommand(LABEL_ISXLABEL);
202
invertXLabelsCB.addActionListener(this);
203
pLabels.add(invertXLabelsCB, constraint);
206
invertYLabelsCB = new JCheckBox(LABEL_ISYLABEL);
207
invertYLabelsCB.setText(LABEL_ISYLABEL);
208
invertYLabelsCB.setSelected(GridShape.DEFAULT_ISXLABELSOUTH);
209
invertYLabelsCB.addActionListener(this);
210
invertYLabelsCB.setActionCommand(LABEL_ISYLABEL);
211
pLabels.add(invertYLabelsCB, constraint);
215
defineLabelDistCB = new JCheckBox(LABEL_DEF_LABELS_DIST);
216
defineLabelDistCB.setText(LaTeXDrawLang.getString1_8("ParametersAxeFrame.5")); //$NON-NLS-1$
217
defineLabelDistCB.setSelected(false);
218
defineLabelDistCB.addActionListener(this);
219
defineLabelDistCB.setActionCommand(LABEL_DEF_LABELS_DIST);
220
pLabels.add(defineLabelDistCB, constraint);
222
constraint.gridwidth=1;
225
pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.6")), constraint); //$NON-NLS-1$
227
SpinnerModel model = new SpinnerNumberModel(0.01,0.01,1000,0.05);
228
labelXDistField = new JSpinner(model);
229
labelXDistField.setEditor(new JSpinner.NumberEditor(labelXDistField, "0.00"));//$NON-NLS-1$
230
labelXDistField.addChangeListener(this);
231
labelXDistField.setName(LABEL_X_LABEL_DIST);
232
labelXDistField.setEnabled(false);
234
pLabels.add(labelXDistField, constraint);
237
pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.7")), constraint); //$NON-NLS-1$
239
model = new SpinnerNumberModel(0.01,0.01,1000,0.05);
240
labelYDistField = new JSpinner(model);
241
labelYDistField.setEditor(new JSpinner.NumberEditor(labelYDistField, "0.00"));//$NON-NLS-1$
242
labelYDistField.addChangeListener(this);
243
labelYDistField.setEnabled(false);
244
labelYDistField.setName(LABEL_Y_LABEL_DIST);
246
pLabels.add(labelYDistField, constraint);
250
pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.8")), constraint); //$NON-NLS-1$
252
model = new SpinnerNumberModel(0.0001,0.0001,1000,1);
253
labelXIncrement = new JSpinner(model);
254
labelXIncrement.setEditor(new JSpinner.NumberEditor(labelXIncrement, "0.000"));//$NON-NLS-1$
255
labelXIncrement.addChangeListener(this);
256
labelXIncrement.setName(LABEL_LABEL_X_INCR);
258
pLabels.add(labelXIncrement, constraint);
261
pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.9")), constraint); //$NON-NLS-1$
263
model = new SpinnerNumberModel(0.0001,0.0001,1000,1);
264
labelYIncrement = new JSpinner(model);
265
labelYIncrement.setEditor(new JSpinner.NumberEditor(labelYIncrement, "0.000"));//$NON-NLS-1$
266
labelYIncrement.addChangeListener(this);
267
labelYIncrement.setName(LABEL_LABEL_Y_INCR);
269
pLabels.add(labelYIncrement, constraint);
273
pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.10")), constraint); //$NON-NLS-1$
275
model = new SpinnerNumberModel(1,-1000,1000,1);
276
labelXOrigin = new JSpinner(model);
277
labelXOrigin.setEditor(new JSpinner.NumberEditor(labelXOrigin, "0"));//$NON-NLS-1$
278
labelXOrigin.addChangeListener(this);
279
labelXOrigin.setName(LABEL_LABEL_X_ORIG);
281
pLabels.add(labelXOrigin, constraint);
284
pLabels.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.11")), constraint); //$NON-NLS-1$
286
model = new SpinnerNumberModel(1,-1000,1000,1);
287
labelYOrigin = new JSpinner(model);
288
labelYOrigin.setEditor(new JSpinner.NumberEditor(labelYOrigin, "0"));//$NON-NLS-1$
289
labelYOrigin.addChangeListener(this);
290
labelYOrigin.setName(LABEL_LABEL_Y_ORIG);
292
pLabels.add(labelYOrigin, constraint);
294
pLabels.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_8("ParametersAxeFrame.12"), //$NON-NLS-1$
295
TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0)));
302
protected JPanel createTicksPanel()
304
JPanel pTicks = new JPanel(new GridBagLayout());
305
GridBagConstraints constraint = new GridBagConstraints();
307
constraint.gridx = 0;
308
constraint.gridy = 0;
309
constraint.gridwidth = 1;
310
constraint.gridheight = 1;
311
constraint.weightx = 0.1;
312
constraint.weighty = 0.1;
313
constraint.fill = GridBagConstraints.NONE;
314
constraint.anchor = GridBagConstraints.WEST;
316
pTicks.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.13")), constraint); //$NON-NLS-1$
318
SpinnerModel model = new SpinnerNumberModel(1,1,1000,0.5);
319
ticksSizeField = new JSpinner(model);
320
ticksSizeField.setEditor(new JSpinner.NumberEditor(ticksSizeField, "0.00"));//$NON-NLS-1$
321
ticksSizeField.addChangeListener(this);
322
ticksSizeField.setName(LABEL_TICKS_SIZE_FIELD);
324
pTicks.add(ticksSizeField, constraint);
327
pTicks.add(new JLabel(LaTeXDrawLang.getString1_8("ParametersAxeFrame.14")), constraint); //$NON-NLS-1$
329
ticksShapeChoice = Axe.createTicksStyleChoice();
330
ticksShapeChoice.addActionListener(this);
332
pTicks.add(ticksShapeChoice, constraint);
334
drawXTicks = new JCheckBox(LaTeXDrawLang.getString1_8("ParametersAxeFrame.15"), true); //$NON-NLS-1$
335
drawXTicks.setActionCommand(LABEL_DRAW_X_TICKS);
336
drawXTicks.setName(LABEL_DRAW_X_TICKS);
337
drawXTicks.addActionListener(this);
338
constraint.gridx=0; constraint.gridy++;
339
pTicks.add(drawXTicks, constraint);
341
drawYTicks = new JCheckBox(LaTeXDrawLang.getString1_8("ParametersAxeFrame.16"), true); //$NON-NLS-1$
342
drawYTicks.setActionCommand(LABEL_DRAW_Y_TICKS);
343
drawYTicks.setName(LABEL_DRAW_Y_TICKS);
344
drawYTicks.addActionListener(this);
346
pTicks.add(drawYTicks, constraint);
349
pTicks.setBorder(new CompoundBorder(new TitledBorder(null, LaTeXDrawLang.getString1_8("ParametersAxeFrame.17"), //$NON-NLS-1$
350
TitledBorder.LEFT, TitledBorder.TOP), new EmptyBorder(0,0,0,0)));
358
public void setVisible(boolean visible, Figure selected, boolean deleteOnCancel, boolean isFramedBox)
362
if(!(selected instanceof Axe))
363
throw new ClassCastException();
365
super.setVisible(visible, selected, deleteOnCancel, isFramedBox);
369
ex.printStackTrace();
370
ExceptionFrameDialog.showExceptionDialog(ex);
378
public void setFigureFrameField()
380
super.setFigureFrameField();
383
int labelsDisplayed = a.getLabelsDisplayed();
384
int ticksDisplayed = a.getTicksDisplayed();
386
if(labelsDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || labelsDisplayed==Axe.LABELS_DISPLAYED_X_VALUE)
387
drawXLabel.setSelected(true);
389
if(labelsDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || labelsDisplayed==Axe.LABELS_DISPLAYED_Y_VALUE)
390
drawYLabel.setSelected(true);
392
if(ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || ticksDisplayed==Axe.LABELS_DISPLAYED_X_VALUE)
393
drawXTicks.setSelected(true);
395
if(ticksDisplayed==Axe.LABELS_DISPLAYED_ALL_VALUE || ticksDisplayed==Axe.LABELS_DISPLAYED_Y_VALUE)
396
drawYTicks.setSelected(true);
398
String style = a.getAxesStyleToken();
400
if(style.equals(PSTricksConstants.TOKEN_AXES_STYLE_AXES))
401
axeShapeChoice.setSelectedItem(Axe.LABEL_STYLE_AXE);
403
if(style.equals(PSTricksConstants.TOKEN_AXES_STYLE_FRAME))
404
axeShapeChoice.setSelectedItem(Axe.LABEL_STYLE_FRAME);
406
if(style.equals(PSTricksConstants.TOKEN_AXES_STYLE_NONE))
407
axeShapeChoice.setSelectedItem(Axe.LABEL_STYLE_NONE);
409
style = a.getTicksStyleToken();
411
if(style.equals(PSTricksConstants.TOKEN_TICKS_STYLE_FULL))
412
ticksShapeChoice.setSelectedItem(Axe.LABEL_STYLE_TICKS_FULL);
414
if(style.equals(PSTricksConstants.TOKEN_TICKS_STYLE_BOTTOM))
415
ticksShapeChoice.setSelectedItem(Axe.LABEL_STYLE_TICKS_BOTTOM);
417
if(style.equals(PSTricksConstants.TOKEN_TICKS_STYLE_TOP))
418
ticksShapeChoice.setSelectedItem(Axe.LABEL_STYLE_TICKS_TOP);
420
ticksSizeField.setValue(a.getTicksSize());
421
boolean ok = a.getDistLabelsX()!=0 || a.getDistLabelsY()!=0;
423
defineLabelDistCB.setSelected(ok);
424
labelXDistField.setEnabled(ok);
425
labelYDistField.setEnabled(ok);
426
labelXDistField.removeChangeListener(this);
427
labelYDistField.removeChangeListener(this);
428
labelXDistField.setValue(a.getDistLabelsX()==0 ? a.getIncrement().x : a.getDistLabelsX());
429
labelYDistField.setValue(a.getDistLabelsY()==0 ? a.getIncrement().y : a.getDistLabelsY());
430
labelXDistField.addChangeListener(this);
431
labelYDistField.addChangeListener(this);
432
labelXIncrement.setValue(a.getIncrement().x);
433
labelYIncrement.setValue(a.getIncrement().y);
434
labelXOrigin.setValue((int)a.getOrigin().x);
435
labelYOrigin.setValue((int)a.getOrigin().y);
436
showOriginCB.setSelected(a.isShowOrigin());
438
glimpsePanel.repaint();
445
public void setDefaultsValues()
447
super.setDefaultsValues();
449
drawXLabel.setSelected(true);
450
drawYLabel.setSelected(true);
451
drawXTicks.setSelected(true);
452
drawYTicks.setSelected(true);
453
Axe axe = (Axe)glimpsePanel.glimpseFigure;
455
axe.setLabelsDisplayed(Axe.LABELS_DISPLAYED_ALL_VALUE);
456
axeShapeChoice.setSelectedIndex(0);
457
ticksShapeChoice.setSelectedIndex(0);
458
ticksSizeField.setValue(PSTricksConstants.DEFAULT_TICKS_SIZE);
459
defineLabelDistCB.setSelected(false);
460
labelXDistField.setEnabled(false);
461
labelYDistField.setEnabled(false);
462
axe.setDistLabelsX(0);
463
axe.setDistLabelsY(0);
464
axe.setIncrementX(PSTricksConstants.DEFAULT_DX);
465
axe.setIncrementY(PSTricksConstants.DEFAULT_DY);
466
axe.setOriginX(PSTricksConstants.DEFAULT_OX);
467
axe.setOriginY(PSTricksConstants.DEFAULT_OY);
468
axe.setShowOrigin(PSTricksConstants.DEFAULT_SHOW_ORIGIN);
471
glimpsePanel.repaint();
478
public void saveParameters()
480
super.saveParameters();
483
double xVal = Float.valueOf(labelXDistField.getValue().toString()).doubleValue();
484
double yVal = Float.valueOf(labelYDistField.getValue().toString()).doubleValue();
486
if(drawXLabel.isSelected())
487
if(drawYLabel.isSelected())
488
a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_ALL_VALUE);
489
else a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_X_VALUE);
491
if(drawYLabel.isSelected())
492
a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_Y_VALUE);
493
else a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_NON_VALUE);
495
if(drawXTicks.isSelected())
496
if(drawYTicks.isSelected())
497
a.setTicksDisplayed(Axe.LABELS_DISPLAYED_ALL_VALUE);
498
else a.setTicksDisplayed(Axe.LABELS_DISPLAYED_X_VALUE);
500
if(drawYTicks.isSelected())
501
a.setTicksDisplayed(Axe.LABELS_DISPLAYED_Y_VALUE);
502
else a.setTicksDisplayed(Axe.LABELS_DISPLAYED_NON_VALUE);
504
String selected = axeShapeChoice.getSelectedItem().toString();
506
if(selected.equals(Axe.LABEL_STYLE_AXE))
507
a.setAxesStyle(Axe.AXES_STYLE_AXES_VALUE);
509
if(selected.equals(Axe.LABEL_STYLE_FRAME))
510
a.setAxesStyle(Axe.AXES_STYLE_FRAME_VALUE);
512
if(selected.equals(Axe.LABEL_STYLE_NONE))
513
a.setAxesStyle(Axe.AXES_STYLE_NONE_VALUE);
515
selected = ticksShapeChoice.getSelectedItem().toString();
517
if(selected.equals(Axe.LABEL_STYLE_TICKS_FULL))
518
a.setTicksStyle(Axe.TICKS_STYLE_FULL_VALUE);
520
if(selected.equals(Axe.LABEL_STYLE_TICKS_TOP))
521
a.setTicksStyle(Axe.TICKS_STYLE_TOP_VALUE);
523
if(selected.equals(Axe.LABEL_STYLE_TICKS_BOTTOM))
524
a.setTicksStyle(Axe.TICKS_STYLE_BOTTOM_VALUE);
526
a.setTicksSize(Float.valueOf(ticksSizeField.getValue().toString()).doubleValue());
527
a.setDistLabelsX(defineLabelDistCB.isSelected() ? xVal : 0);
528
a.setDistLabelsY(defineLabelDistCB.isSelected() ? yVal : 0);
529
a.setIncrementX(Float.valueOf(labelXIncrement.getValue().toString()).doubleValue());
530
a.setIncrementY(Float.valueOf(labelYIncrement.getValue().toString()).doubleValue());
531
a.setOriginX(Float.valueOf(labelXOrigin.getValue().toString()).intValue());
532
a.setOriginY(Float.valueOf(labelYOrigin.getValue().toString()).intValue());
533
a.setShowOrigin(showOriginCB.isSelected());
536
drawPanel.getFrameParent().setExportAsMenu(true);
537
drawPanel.getDraw().updateBorders();
538
drawPanel.updateDraw(true);
545
public void actionPerformed(ActionEvent e)
549
Object o = e.getSource();
550
Axe a = (Axe)glimpsePanel.getGlimpseFigure();
552
if(o instanceof JCheckBox)
554
String label = ((JCheckBox)o).getActionCommand();
556
if(label.equals(LABEL_SHOW_ORIGIN))
559
a.setShowOrigin(showOriginCB.isSelected());
560
glimpsePanel.repaint();
565
if(label.equals(LABEL_DEF_LABELS_DIST))
567
double xVal = Float.valueOf(labelXDistField.getValue().toString()).doubleValue();
568
double yVal = Float.valueOf(labelYDistField.getValue().toString()).doubleValue();
569
boolean isSelected = defineLabelDistCB.isSelected();
572
labelXDistField.setEnabled(isSelected);
573
labelYDistField.setEnabled(isSelected);
574
a.setDistLabelsX(isSelected ? xVal : 0);
575
a.setDistLabelsY(isSelected ? yVal : 0);
577
glimpsePanel.repaint();
582
if(label.equals(LABEL_DRAW_X_LABELS) || label.equals(LABEL_DRAW_Y_LABELS))
584
if(drawXLabel.isSelected())
585
if(drawYLabel.isSelected())
586
a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_ALL_VALUE);
587
else a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_X_VALUE);
589
if(drawYLabel.isSelected())
590
a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_Y_VALUE);
591
else a.setLabelsDisplayed(Axe.LABELS_DISPLAYED_NON_VALUE);
594
glimpsePanel.repaint();
598
if(label.equals(LABEL_DRAW_X_TICKS) || label.equals(LABEL_DRAW_Y_TICKS))
600
if(drawXTicks.isSelected())
601
if(drawYTicks.isSelected())
602
a.setTicksDisplayed(Axe.LABELS_DISPLAYED_ALL_VALUE);
603
else a.setTicksDisplayed(Axe.LABELS_DISPLAYED_X_VALUE);
605
if(drawYTicks.isSelected())
606
a.setTicksDisplayed(Axe.LABELS_DISPLAYED_Y_VALUE);
607
else a.setTicksDisplayed(Axe.LABELS_DISPLAYED_NON_VALUE);
610
glimpsePanel.repaint();
615
if(o instanceof JComboBox)
617
String label = ((JComboBox)o).getActionCommand();
619
if(label.equals(Axe.ACTION_CMD_AXE_STYLE_CHOICE))
621
String selected = axeShapeChoice.getSelectedItem().toString();
623
if(selected.equals(Axe.LABEL_STYLE_AXE))
624
a.setAxesStyle(Axe.AXES_STYLE_AXES_VALUE);
626
if(selected.equals(Axe.LABEL_STYLE_FRAME))
627
a.setAxesStyle(Axe.AXES_STYLE_FRAME_VALUE);
629
if(selected.equals(Axe.LABEL_STYLE_NONE))
630
a.setAxesStyle(Axe.AXES_STYLE_NONE_VALUE);
633
boolean ok = selected.equals(Axe.LABEL_STYLE_AXE);
634
arrow1Choice.setEnabled(ok);
635
arrow2Choice.setEnabled(ok);
636
glimpsePanel.repaint();
640
if(label.equals(Axe.ACTION_CMD_TICKS_STYLE_CHOICE))
642
String selected = ticksShapeChoice.getSelectedItem().toString();
644
if(selected.equals(Axe.LABEL_STYLE_TICKS_FULL))
645
a.setTicksStyle(Axe.TICKS_STYLE_FULL_VALUE);
647
if(selected.equals(Axe.LABEL_STYLE_TICKS_TOP))
648
a.setTicksStyle(Axe.TICKS_STYLE_TOP_VALUE);
650
if(selected.equals(Axe.LABEL_STYLE_TICKS_BOTTOM))
651
a.setTicksStyle(Axe.TICKS_STYLE_BOTTOM_VALUE);
654
glimpsePanel.repaint();
663
ex.printStackTrace();
664
ExceptionFrameDialog.showExceptionDialog(ex);
667
super.actionPerformed(e);
673
public void stateChanged(ChangeEvent e)
677
Object o = e.getSource();
678
Axe a = (Axe)glimpsePanel.getGlimpseFigure();
680
if(o instanceof JSpinner)
682
String name = ((JSpinner)o).getName();
684
if(name.equals(LABEL_TICKS_SIZE_FIELD))
687
a.setTicksSize(Float.valueOf(ticksSizeField.getValue().toString()).doubleValue());
689
glimpsePanel.repaint();
693
if(name.equals(LABEL_LABEL_X_INCR))
696
a.setIncrementX(Float.valueOf(labelXIncrement.getValue().toString()).doubleValue());
697
glimpsePanel.repaint();
701
if(name.equals(LABEL_LABEL_Y_INCR))
704
a.setIncrementY(Float.valueOf(labelYIncrement.getValue().toString()).doubleValue());
705
glimpsePanel.repaint();
709
if(name.equals(LABEL_LABEL_X_ORIG))
712
a.setOriginX(Float.valueOf(labelXOrigin.getValue().toString()).intValue());
713
glimpsePanel.repaint();
717
if(name.equals(LABEL_LABEL_Y_ORIG))
720
a.setOriginY(Float.valueOf(labelYOrigin.getValue().toString()).intValue());
721
glimpsePanel.repaint();
725
if(name.equals(LABEL_X_LABEL_DIST))
728
a.setDistLabelsX(Float.valueOf(labelXDistField.getValue().toString()).doubleValue());
730
glimpsePanel.repaint();
734
if(name.equals(LABEL_Y_LABEL_DIST))
737
a.setDistLabelsY(Float.valueOf(labelYDistField.getValue().toString()).doubleValue());
739
glimpsePanel.repaint();
746
ex.printStackTrace();
747
ExceptionFrameDialog.showExceptionDialog(ex);
750
super.stateChanged(e);