Browse Source

no negative values by edge's capacity

Edgardo Palza 8 years ago
parent
commit
34f681d4e3
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/ui/view/GUI.java

+ 6 - 1
src/ui/view/GUI.java

@@ -784,7 +784,12 @@ public class GUI<E> implements CategoryListener {
 						temp = tableModelProperties.getValueAt(mousePos.y / tableProperties.getRowHeight(),
 								mousePos.x / (tableProperties.getWidth() / 2));
 						if (mousePos.y / tableProperties.getRowHeight() == 2) {
-							Float ftemp = Float.parseFloat(temp.toString());
+							Float ftemp;
+							if (Float.parseFloat(temp.toString()) >= 0.0) {
+								ftemp = Float.parseFloat(temp.toString());
+							} else {
+								ftemp = model.getSelectedEdge().getCapacity();
+							}
 							model.getSelectedEdge().setCapacity(ftemp);
 						} else if (mousePos.y / tableProperties.getRowHeight() == 3) {
 							Boolean bTemp = Boolean.parseBoolean(temp.toString());