diff options
| author | Paul Buetow <paul@buetow.org> | 2008-06-25 23:41:54 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-06-25 23:41:54 +0000 |
| commit | 18729d5c4b1b8282e293466cf2a802337ba7e397 (patch) | |
| tree | 5b9aaf192ed16afae458660b7ff23ddf98b9a040 /sources/simulator/VSSimulator.java | |
| parent | 64d02bcf7fed715b9fee74d3a635791beb8131d1 (diff) | |
bugfix
Diffstat (limited to 'sources/simulator/VSSimulator.java')
| -rw-r--r-- | sources/simulator/VSSimulator.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sources/simulator/VSSimulator.java b/sources/simulator/VSSimulator.java index 9b0ef2a..ae3c2db 100644 --- a/sources/simulator/VSSimulator.java +++ b/sources/simulator/VSSimulator.java @@ -34,6 +34,7 @@ import javax.swing.table.*; import core.*; import events.*; import events.internal.*; +import exceptions.*; import prefs.*; import prefs.editors.*; import serialize.*; @@ -515,6 +516,8 @@ public class VSSimulator extends JPanel implements VSSerializable { public void actionPerformed(ActionEvent ae) { try { Long val = Long.valueOf(valField.getText()); + if (val.longValue() < 0) + throw new VSNegativeNumberException(); VSTask task = model.removeTaskAtRow(row); task.setTaskTime(val.longValue()); taskManager.addTask(task, VSTaskManager.PROGRAMMED); @@ -532,7 +535,11 @@ public class VSSimulator extends JPanel implements VSSerializable { } catch (NumberFormatException exc) { valField.setBackground(Color.RED); isRed = true; - } + + } catch (VSNegativeNumberException exc) { + valField.setBackground(Color.RED); + isRed = true; + } } }); return valField; |
