From 18729d5c4b1b8282e293466cf2a802337ba7e397 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Wed, 25 Jun 2008 23:41:54 +0000 Subject: bugfix --- sources/simulator/VSSimulator.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'sources/simulator/VSSimulator.java') 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; -- cgit v1.2.3