/[svn]/jsampler/trunk/src/org/jsampler/view/NumberCellEditor.java
ViewVC logotype

Diff of /jsampler/trunk/src/org/jsampler/view/NumberCellEditor.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 910 by iliev, Mon Oct 10 16:03:12 2005 UTC revision 911 by iliev, Mon Aug 7 18:25:58 2006 UTC
# Line 38  import javax.swing.table.TableCellEditor Line 38  import javax.swing.table.TableCellEditor
38    
39    
40  /**  /**
41   *   * This method implements a cell editor for numbers, using a spinner component.
42   * @author Grigor Iliev   * @author Grigor Iliev
43   */   */
44  public class NumberCellEditor extends AbstractCellEditor implements TableCellEditor {  public class NumberCellEditor extends AbstractCellEditor implements TableCellEditor {
45          private final JSpinner editor = new JSpinner();          private final JSpinner editor = new JSpinner();
46          private SpinnerNumberModel spinnerModel;          private SpinnerNumberModel spinnerModel;
47                    
48            /** Creates a new instance of <code>NumberCellEditor</code>. */
49          public          public
50          NumberCellEditor() {          NumberCellEditor() {
51                  editor.setBorder(BorderFactory.createEmptyBorder());                  editor.setBorder(BorderFactory.createEmptyBorder());
# Line 60  public class NumberCellEditor extends Ab Line 61  public class NumberCellEditor extends Ab
61                  return false;                  return false;
62          }          }
63                    
64            /**
65             * Gets the value contained in the editor.
66             * @return Te value contained in the editor.
67             */
68          public Object          public Object
69          getCellEditorValue() { return editor.getValue(); }          getCellEditorValue() { return editor.getValue(); }
70                    
# Line 75  public class NumberCellEditor extends Ab Line 80  public class NumberCellEditor extends Ab
80                  return editor;                  return editor;
81          }          }
82                    
83            /**
84             * Gets the <code>SpinnerNumberModel</code> used by this editor.
85             * @return The <code>SpinnerNumberModel</code> used by this editor.
86             */
87          public SpinnerNumberModel          public SpinnerNumberModel
88          getModel() { return spinnerModel; }          getModel() { return spinnerModel; }
89                    
90            /**
91             * Sets the <code>SpinnerNumberModel</code> to be used by this editor.
92             * @param model The <code>SpinnerNumberModel</code> to be used by this editor.
93             */
94          public void          public void
95          setModel(SpinnerNumberModel model) {          setModel(SpinnerNumberModel model) {
96                  spinnerModel = model;                  spinnerModel = model;
97                  editor.setModel(spinnerModel);                  editor.setModel(spinnerModel);
98          }          }
99                    
100            /**
101             * Sets the minimum value allowed.
102             * @param minimum The new minimum value.
103             */
104          public void          public void
105          setMinimum(Comparable minimum) { getModel().setMinimum(minimum); }          setMinimum(Comparable minimum) { getModel().setMinimum(minimum); }
106                    
107            /**
108             * Sets the maximum value allowed.
109             * @param maximum The new maximum value.
110             */
111          public void          public void
112          setMaximum(Comparable maximum) { getModel().setMaximum(maximum); }          setMaximum(Comparable maximum) { getModel().setMaximum(maximum); }
113  }  }

Legend:
Removed from v.910  
changed lines
  Added in v.911

  ViewVC Help
Powered by ViewVC