Przeglądaj źródła

Merge branch 'master' of https://git.tk.informatik.tu-darmstadt.de/carlos.garcia/praktikum-holons

dominik.rieder 7 lat temu
rodzic
commit
18129597ba

+ 28 - 0
src/ui/view/BackgroundPopUp.java

@@ -62,6 +62,8 @@ public class BackgroundPopUp extends JDialog {
 	private final JRadioButton rdbtnImagePixel = new JRadioButton("Use Image Size");
 	private final JRadioButton rdbtnStretched = new JRadioButton("Strech Image");
 	private final JRadioButton rdbtnCustom = new JRadioButton("Custom Size");
+	private final JButton removeImageBtn = new JButton("Remove Background Image");
+	private boolean imageBtnClearedPressed = false;
 
 	// Modes
 	public static final int IMAGE_PIXELS = 0, STRETCHED = 1, CUSTOM = 2;
@@ -134,6 +136,22 @@ public class BackgroundPopUp extends JDialog {
 		panel.add(imageHeight);
 		imageHeight.setColumns(10);
 
+		// remove BackgroundImage Button
+		removeImageBtn.setBackground(Color.WHITE);
+		removeImageBtn.addActionListener(new ActionListener() {
+			@Override
+			public void actionPerformed(ActionEvent e) {
+				path = "";
+				textPath.setText("");
+				imageBtnClearedPressed = true;
+				lblImage.setIcon(null);
+			}
+		});
+		JPanel removePanel = new JPanel();
+		removePanel.add(removeImageBtn);
+		removePanel.setBackground(Color.WHITE);
+		panelRadio.add(removePanel);
+
 		// Browse Panel
 		getContentPane().add(panelBrowse, BorderLayout.NORTH);
 		panelBrowse.setLayout(new BorderLayout(0, 0));
@@ -209,6 +227,16 @@ public class BackgroundPopUp extends JDialog {
 								Integer.parseInt(imageHeight.getText()));
 					}
 					dispose();
+				} else if (imageBtnClearedPressed) {
+					if (canvas != null) {
+						controller.setBackgroundImage(path, mode, Integer.parseInt(imageWidth.getText()),
+								Integer.parseInt(imageHeight.getText()));
+						canvas.repaint();
+					} else if (uNode != null) {
+						uNode.setBackgroundImage(path, mode, Integer.parseInt(imageWidth.getText()),
+								Integer.parseInt(imageHeight.getText()));
+					}
+					dispose();
 				} else {
 					JOptionPane.showMessageDialog(null, "No image selected!", "Warning!", JOptionPane.WARNING_MESSAGE);
 				}

+ 0 - 2
src/ui/view/GUI.java

@@ -675,7 +675,6 @@ public class GUI<E> implements CategoryListener {
 			@Override
 			public void stateChanged(ChangeEvent e) {
 				controller.setScale(sizeSlider.getValue());
-				tree.setRowHeight(50);
 				canvas.repaint();
 			}
 		});
@@ -1943,7 +1942,6 @@ public class GUI<E> implements CategoryListener {
 		eraseCategory = tempArray[29];
 		selectObjBeforeErase = tempArray[30];
 		// SimMenu
-		simMenu.simSpeedLabel.setText(Languages.getLanguage()[84]);
 		simMenu.algoFolderButton.setText(Languages.getLanguage()[85]);
 		// TimePanel
 		timePanel.playBtn.setToolTipText(Languages.getLanguage()[89]);

+ 64 - 75
src/ui/view/MyCanvas.java

@@ -434,8 +434,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		if (drawEdge) {
 			g2.setColor(Color.BLACK);
 			g2.setStroke(new BasicStroke(2));
-			g2.drawLine(tempCps.getPosition().x + controller.getScaleDiv2(),
-					tempCps.getPosition().y + controller.getScaleDiv2(), x, y);
+			g2.drawLine(tempCps.getPosition().x, tempCps.getPosition().y, x, y);
 		}
 
 		for (CpsEdge con : model.getEdgesOnCanvas()) {
@@ -445,7 +444,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 					if (con.getState()) {
 						g2.setColor(Color.GREEN);
 						if (con.getCapacity() != -1) {
-							g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+							g2.setStroke(new BasicStroke(Math.min(((con.getFlow() / con.getCapacity() * 3) + 1), 4)));
 						}
 					} else {
 						g2.setColor(Color.RED);
@@ -455,10 +454,8 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 					g2.setColor(Color.DARK_GRAY);
 					g2.setStroke(new BasicStroke(2));
 				}
-				g2.drawLine(con.getA().getPosition().x + controller.getScaleDiv2(),
-						con.getA().getPosition().y + controller.getScaleDiv2(),
-						con.getB().getPosition().x + controller.getScaleDiv2(),
-						con.getB().getPosition().y + controller.getScaleDiv2());
+				g2.drawLine(con.getA().getPosition().x, con.getA().getPosition().y, con.getB().getPosition().x,
+						con.getB().getPosition().y);
 
 				if (con.getCapacity() == -1) {
 					maxCap = Character.toString('\u221e');
@@ -470,16 +467,11 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 				if (showedInformation[0]) {
 					if (con.getConnected() == 0 || con.getConnected() == 1) {
 						g2.drawString(con.getFlow() + "/" + maxCap,
-								(con.getA().getPosition().x + con.getB().getPosition().x) / 2
-										+ controller.getScaleDiv2(),
-								(con.getA().getPosition().y + con.getB().getPosition().y) / 2
-										+ controller.getScaleDiv2());
+								(con.getA().getPosition().x + con.getB().getPosition().x) / 2,
+								(con.getA().getPosition().y + con.getB().getPosition().y) / 2);
 					} else {
-						g2.drawString("not connected",
-								(con.getA().getPosition().x + con.getB().getPosition().x) / 2
-										+ controller.getScaleDiv2(),
-								(con.getA().getPosition().y + con.getB().getPosition().y) / 2
-										+ controller.getScaleDiv2());
+						g2.drawString("not connected", (con.getA().getPosition().x + con.getB().getPosition().x) / 2,
+								(con.getA().getPosition().y + con.getB().getPosition().y) / 2);
 					}
 				}
 			}
@@ -490,7 +482,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			g2.setColor(Color.BLUE);
 			for (CpsEdge con : model.getEdgesOnCanvas()) {
 				if (con.getFlow() <= con.getCapacity()) {
-					g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+					g2.setStroke(new BasicStroke(Math.min(((con.getFlow() / con.getCapacity() * 3) + 1), 4)));
 				} else {
 					g2.setStroke(new BasicStroke(2));
 				}
@@ -499,10 +491,8 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 						|| con.getB().getId() == model.getSelectedObjectID()
 						|| model.getSelectedCpsObjects().contains(con.getB())
 						|| tempSelected.contains(con.getB()) && con != edgeHighlight) {
-					g2.drawLine(con.getA().getPosition().x + controller.getScaleDiv2(),
-							con.getA().getPosition().y + controller.getScaleDiv2(),
-							con.getB().getPosition().x + controller.getScaleDiv2(),
-							con.getB().getPosition().y + controller.getScaleDiv2());
+					g2.drawLine(con.getA().getPosition().x, con.getA().getPosition().y, con.getB().getPosition().x,
+							con.getB().getPosition().y);
 
 					if (con.getCapacity() == -1) {
 						maxCap = Character.toString('\u221e');
@@ -514,16 +504,12 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 					if (showedInformation[0]) {
 						if (con.getConnected() == 0 || con.getConnected() == 1) {
 							g2.drawString(con.getFlow() + "/" + maxCap,
-									(con.getA().getPosition().x + con.getB().getPosition().x) / 2
-											+ controller.getScaleDiv2(),
-									(con.getA().getPosition().y + con.getB().getPosition().y) / 2
-											+ controller.getScaleDiv2());
+									(con.getA().getPosition().x + con.getB().getPosition().x) / 2,
+									(con.getA().getPosition().y + con.getB().getPosition().y) / 2);
 						} else {
 							g2.drawString("not connected",
-									(con.getA().getPosition().x + con.getB().getPosition().x) / 2
-											+ controller.getScaleDiv2(),
-									(con.getA().getPosition().y + con.getB().getPosition().y) / 2
-											+ controller.getScaleDiv2());
+									(con.getA().getPosition().x + con.getB().getPosition().x) / 2,
+									(con.getA().getPosition().y + con.getB().getPosition().y) / 2);
 						}
 					}
 				}
@@ -531,14 +517,13 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		} else if (edgeHighlight != null) {
 			g2.setColor(Color.BLUE);
 			if (edgeHighlight.getFlow() <= edgeHighlight.getCapacity()) {
-				g2.setStroke(new BasicStroke(Math.min((edgeHighlight.getFlow() / edgeHighlight.getCapacity() * 4), 4)));
+				g2.setStroke(new BasicStroke(
+						Math.min(((edgeHighlight.getFlow() / edgeHighlight.getCapacity() * 3) + 1), 4)));
 			} else {
 				g2.setStroke(new BasicStroke(2));
 			}
-			g2.drawLine(edgeHighlight.getA().getPosition().x + controller.getScaleDiv2(),
-					edgeHighlight.getA().getPosition().y + controller.getScaleDiv2(),
-					edgeHighlight.getB().getPosition().x + controller.getScaleDiv2(),
-					edgeHighlight.getB().getPosition().y + controller.getScaleDiv2());
+			g2.drawLine(edgeHighlight.getA().getPosition().x, edgeHighlight.getA().getPosition().y,
+					edgeHighlight.getB().getPosition().x, edgeHighlight.getB().getPosition().y);
 
 			if (edgeHighlight.getCapacity() == -1) {
 				maxCap = Character.toString('\u221e');
@@ -549,10 +534,8 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			}
 			if (showedInformation[0]) {
 				g2.drawString(edgeHighlight.getFlow() + "/" + maxCap,
-						(edgeHighlight.getA().getPosition().x + edgeHighlight.getB().getPosition().x) / 2
-								+ controller.getScaleDiv2(),
-						(edgeHighlight.getA().getPosition().y + edgeHighlight.getB().getPosition().y) / 2
-								+ controller.getScaleDiv2());
+						(edgeHighlight.getA().getPosition().x + edgeHighlight.getB().getPosition().x) / 2,
+						(edgeHighlight.getA().getPosition().y + edgeHighlight.getB().getPosition().y) / 2);
 			}
 		}
 
@@ -562,8 +545,8 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			if (showedInformation[3]) {
 				g2.setColor(cps.getBorderColor());
 				if (g2.getColor() != Color.WHITE) {
-					g2.fillRect((int) (cps.getPosition().x - scalediv20 - 3),
-							(int) (cps.getPosition().y - scalediv20 - 3),
+					g2.fillRect((int) (cps.getPosition().x - controller.getScaleDiv2() - scalediv20 - 3),
+							(int) (cps.getPosition().y - controller.getScaleDiv2() - scalediv20 - 3),
 							(int) (controller.getScale() + ((scalediv20 + 3) * 2)),
 							(int) (controller.getScale() + ((scalediv20 + 3) * 2)));
 				}
@@ -584,25 +567,29 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 				if ((cps == tempCps && model.getSelectedCpsObjects().size() == 0 && tempSelected.size() == 0)
 						|| model.getSelectedCpsObjects().contains(cps) || tempSelected.contains(cps)) {
 					g2.setColor(Color.BLUE);
-					g2.fillRect((int) (cps.getPosition().x - scalediv20), (int) (cps.getPosition().y - scalediv20),
+					g2.fillRect((int) (cps.getPosition().x - controller.getScaleDiv2() - scalediv20),
+							(int) (cps.getPosition().y - controller.getScaleDiv2() - scalediv20),
 							(int) (controller.getScale() + (scalediv20 * 2)),
 							(int) (controller.getScale() + (scalediv20 * 2)));
 					if (showedInformation[1] && cps instanceof HolonObject) {
 						g2.setColor(Color.BLACK);
 						float totalEnergy = ((HolonObject) cps).getCurrentEnergyAtTimeStep(model.getCurIteration());
-						g2.drawString(Float.toString(totalEnergy), cps.getPosition().x, cps.getPosition().y - 10);
+						g2.drawString(Float.toString(totalEnergy), cps.getPosition().x - controller.getScaleDiv2(),
+								cps.getPosition().y - controller.getScaleDiv2() - 10);
 					}
 				} else if (cps instanceof HolonObject) {
 					g2.setColor(((HolonObject) cps).getColor());
 
-					g2.fillRect((int) (cps.getPosition().x - scalediv20), (int) (cps.getPosition().y - scalediv20),
+					g2.fillRect((int) (cps.getPosition().x - controller.getScaleDiv2() - scalediv20),
+							(int) (cps.getPosition().y - controller.getScaleDiv2() - scalediv20),
 							(int) (controller.getScale() + (scalediv20 * 2)),
 							(int) (controller.getScale() + (scalediv20 * 2)));
 
 					if (showedInformation[1]) {
 						g2.setColor(Color.BLACK);
 						float totalEnergy = ((HolonObject) cps).getCurrentEnergyAtTimeStep(model.getCurIteration());
-						g2.drawString(Float.toString(totalEnergy), cps.getPosition().x, cps.getPosition().y - 10);
+						g2.drawString(Float.toString(totalEnergy), cps.getPosition().x - controller.getScaleDiv2(),
+								cps.getPosition().y - controller.getScaleDiv2() - 10);
 					}
 				}
 				// draw image
@@ -613,7 +600,8 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 					img = new ImageIcon(this.getClass().getResource(cps.getImage())).getImage();
 				}
 			}
-			g2.drawImage(img, cps.getPosition().x, cps.getPosition().y, controller.getScale(), controller.getScale(),
+			g2.drawImage(img, cps.getPosition().x - controller.getScaleDiv2(),
+					cps.getPosition().y - controller.getScaleDiv2(), controller.getScale(), controller.getScale(),
 					null);
 
 		}
@@ -647,7 +635,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 			g2.drawString(toolTipText, fixXPos + 2, fixYPos + 12);
 		}
 
-		// Dragg Highlighting
+		// Dragged marker Highlighting
 		if (doMark) {
 			g2.setColor(Color.BLACK);
 			g2.setStroke(new BasicStroke(1));
@@ -693,8 +681,8 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		controller.setSelecteEdge(null);
 		// Object Selection
 		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
-			cx = cps.getPosition().x;
-			cy = cps.getPosition().y;
+			cx = cps.getPosition().x - controller.getScaleDiv2();
+			cy = cps.getPosition().y - controller.getScaleDiv2();
 			if (x - controller.getScale() <= cx && y - controller.getScale() <= cy && x >= cx && y >= cy) {
 				tempCps = cps;
 				controller.addTextToConsole("Selected: ", Color.BLACK, 12, false, false, false);
@@ -842,29 +830,29 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 				dragged = true;
 				float xDist, yDist; // Distance
 
-				x = e.getX() - controller.getScaleDiv2();
-				y = e.getY() - controller.getScaleDiv2();
+				x = e.getX();
+				y = e.getY();
 
 				// Make sure its in bounds
 				if (e.getX() < controller.getScaleDiv2())
-					x = 0;
+					x = controller.getScaleDiv2();
 				else if (e.getX() > this.getWidth() - controller.getScaleDiv2())
-					x = this.getWidth() - controller.getScale();
+					x = this.getWidth() - controller.getScaleDiv2();
 				if (e.getY() < controller.getScaleDiv2())
-					y = 0;
+					y = controller.getScaleDiv2();
 				else if (e.getY() > this.getHeight() - controller.getScaleDiv2())
-					y = this.getHeight() - controller.getScale();
+					y = this.getHeight() - controller.getScaleDiv2();
 
 				// Distance
 				xDist = x - tempCps.getPosition().x;
 				yDist = y - tempCps.getPosition().y;
 
 				tempCps.setPosition(x, y); // Drag Position
-				// TipText Position and name
+				// ToolTipText Position and name
 				toolTip = true;
 				toolTipText = tempCps.getName() + ", " + tempCps.getId();
-				toolTipPos.x = tempCps.getPosition().x;
-				toolTipPos.y = tempCps.getPosition().y + model.getScale();
+				toolTipPos.x = tempCps.getPosition().x - controller.getScaleDiv2();
+				toolTipPos.y = tempCps.getPosition().y + controller.getScaleDiv2();
 
 				// All Selected Objects
 				for (AbstractCpsObject cps : model.getSelectedCpsObjects()) {
@@ -873,14 +861,14 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 						y = (int) (cps.getPosition().y + yDist);
 
 						// Make sure its in bounds
-						if (x <= 0)
-							x = 0;
-						else if (x > this.getWidth() - controller.getScale())
-							x = this.getWidth() - controller.getScale();
-						if (y <= 0)
-							y = 0;
-						else if (y > this.getHeight() - controller.getScale())
-							y = this.getHeight() - controller.getScale();
+						if (x <= controller.getScaleDiv2())
+							x = controller.getScaleDiv2();
+						else if (x > this.getWidth() - controller.getScaleDiv2())
+							x = this.getWidth() - controller.getScaleDiv2();
+						if (y <= controller.getScaleDiv2())
+							y = controller.getScaleDiv2();
+						else if (y > this.getHeight() - controller.getScaleDiv2())
+							y = this.getHeight() - controller.getScaleDiv2();
 
 						cps.setPosition(x, y);
 					}
@@ -906,8 +894,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 					y2 = sy;
 				}
 				if (x1 <= cps.getPosition().x + model.getScaleDiv2() && y1 <= cps.getPosition().y + model.getScaleDiv2()
-						&& x2 >= cps.getPosition().x + model.getScaleDiv2()
-						&& y2 >= cps.getPosition().y + model.getScaleDiv2()) {
+						&& x2 >= cps.getPosition().x && y2 >= cps.getPosition().y) {
 					tempSelected.add(cps);
 
 				}
@@ -925,12 +912,12 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		// Everytghing for the tooltip :)
 		boolean on = false;
 		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
-			cx = cps.getPosition().x;
-			cy = cps.getPosition().y;
+			cx = cps.getPosition().x - controller.getScaleDiv2();
+			cy = cps.getPosition().y - controller.getScaleDiv2();
 			if (x - controller.getScale() <= cx && y - controller.getScale() <= cy && x >= cx && y >= cy) {
 				on = true;
-				toolTipPos.x = cps.getPosition().x;
-				toolTipPos.y = cps.getPosition().y + model.getScale();
+				toolTipPos.x = cps.getPosition().x - controller.getScaleDiv2();
+				toolTipPos.y = cps.getPosition().y + controller.getScaleDiv2();
 				toolTipText = cps.getName() + ", " + cps.getId();
 			}
 		}
@@ -954,8 +941,8 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		AbstractCpsObject tempCPS = null;
 
 		for (AbstractCpsObject cps : model.getObjectsOnCanvas()) {
-			cx = cps.getPosition().x;
-			cy = cps.getPosition().y;
+			cx = cps.getPosition().x - controller.getScaleDiv2();
+			cy = cps.getPosition().y - controller.getScaleDiv2();
 			if (x - controller.getScale() <= cx && y - controller.getScale() <= cy && x >= cx && y >= cy
 					&& cps != tempCps) {
 				node = false;
@@ -995,7 +982,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 
 				CpsNode n = new CpsNode("Node");
 
-				n.setPosition(x - model.getScaleDiv2(), y - model.getScaleDiv2());
+				n.setPosition(x, y);
 				controller.addObjectCanvas(n);
 
 				AbstractCpsObject r, k;
@@ -1019,7 +1006,7 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 		if (node) {
 			CpsNode n = new CpsNode("Node");
 
-			n.setPosition(x - model.getScaleDiv2(), y - model.getScaleDiv2());
+			n.setPosition(x, y);
 			controller.addObjectCanvas(n);
 
 			e = new CpsEdge(n, tempCps, model.getMaxCapacity());
@@ -1045,6 +1032,8 @@ public class MyCanvas extends JPanel implements MouseListener, MouseMotionListen
 	 * @return CpsEdge the Mouse is on, null if the mouse is not on an Edge
 	 */
 	public CpsEdge mousePositionOnEdge(int x, int y) {
+		x += controller.getScaleDiv2();
+		y += controller.getScaleDiv2();
 		int lx, ly, hx, hy;
 		for (CpsEdge p : model.getEdgesOnCanvas()) {
 			Line2D l = new Line2D.Float(p.getA().getPosition().x, p.getA().getPosition().y, p.getB().getPosition().x,

+ 8 - 8
src/ui/view/SimulationMenu.java

@@ -40,8 +40,8 @@ public class SimulationMenu extends JMenuBar {
 	private static final long serialVersionUID = 1L;
 
 	private JPanel menuPanel = new JPanel();
-	JLabel simSpeedLabel = new JLabel(Languages.getLanguage()[84]);
-	private JTextField simSpeedText = new JTextField("1000");
+	//JLabel simSpeedLabel = new JLabel(Languages.getLanguage()[84]);
+	//private JTextField simSpeedText = new JTextField("1000");
 	private JComboBox<Object> algoCombo = new JComboBox<>();
 	JButton algoFolderButton = new JButton(Languages.getLanguage()[85]);
 	private HashMap<String, File> algosHash = new HashMap<>();
@@ -66,8 +66,8 @@ public class SimulationMenu extends JMenuBar {
 		this.model = mod;
 		this.controller = cont;
 		
-		simSpeedLabel.setMaximumSize(simSpeedLabel.getPreferredSize());
-		simSpeedLabel.setMinimumSize(simSpeedLabel.getPreferredSize());
+		//simSpeedLabel.setMaximumSize(simSpeedLabel.getPreferredSize());
+		//simSpeedLabel.setMinimumSize(simSpeedLabel.getPreferredSize());
 		algoCombo.addItem("None");
 
 		// Algorithm ComboBox Action
@@ -136,10 +136,10 @@ public class SimulationMenu extends JMenuBar {
 		gbcsimSpeedLabel.insets = new Insets(0, 0, 0, 5);
 		gbcsimSpeedLabel.gridx = 1;
 		gbcsimSpeedLabel.gridy = 0;
-		menuPanel.add(simSpeedLabel, gbcsimSpeedLabel);
+		//menuPanel.add(simSpeedLabel, gbcsimSpeedLabel);
 
 		// timerSpeed
-		simSpeedText.setMaximumSize(new Dimension(300, 300));
+		/*simSpeedText.setMaximumSize(new Dimension(300, 300));
 		// simSpeedText.setMinimumSize(new Dimension(300, 300));
 		simSpeedText.addCaretListener(new CaretListener() {
 			@Override
@@ -151,13 +151,13 @@ public class SimulationMenu extends JMenuBar {
 				}
 
 			}
-		});
+		});*/
 		GridBagConstraints gbcSimSpeedText = new GridBagConstraints();
 		gbcSimSpeedText.anchor = GridBagConstraints.WEST;
 		gbcSimSpeedText.insets = new Insets(0, 0, 0, 5);
 		gbcSimSpeedText.gridx = 2;
 		gbcSimSpeedText.gridy = 0;
-		menuPanel.add(simSpeedText, gbcSimSpeedText);
+		//menuPanel.add(simSpeedText, gbcSimSpeedText);
 		GridBagConstraints gbcAlgoFolderButton = new GridBagConstraints();
 		gbcAlgoFolderButton.anchor = GridBagConstraints.WEST;
 		gbcAlgoFolderButton.insets = new Insets(0, 0, 0, 5);

+ 24 - 7
src/ui/view/TimePanel.java

@@ -2,6 +2,7 @@ package ui.view;
 
 import java.awt.BorderLayout;
 import java.awt.Color;
+import java.awt.FlowLayout;
 import java.awt.Image;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
@@ -10,20 +11,19 @@ import java.awt.event.MouseEvent;
 
 import javax.swing.ImageIcon;
 import javax.swing.JButton;
+import javax.swing.JLabel;
 import javax.swing.JPanel;
 import javax.swing.JSlider;
+import javax.swing.JTextField;
 import javax.swing.Timer;
 import javax.swing.border.LineBorder;
+import javax.swing.event.CaretEvent;
+import javax.swing.event.CaretListener;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
 
-import classes.HolonElement;
-import classes.HolonObject;
-import classes.HolonSwitch;
-import classes.SubNet;
 import ui.controller.Control;
 import ui.model.Model;
-import javax.swing.BoxLayout;
 
 /**
  * This Class represents a Panel where the User can start and stop the
@@ -37,6 +37,8 @@ public class TimePanel extends JPanel {
 	private Model model;
 	private Control controller;
 
+	JLabel simSpeedLabel = new JLabel(Languages.getLanguage()[84]);
+	private JTextField simSpeedText = new JTextField("1000");
 	JSlider timeSlider = new JSlider();
 	private final JPanel timeBtnPanel = new JPanel();
 	final JButton playBtn = new JButton();
@@ -62,7 +64,7 @@ public class TimePanel extends JPanel {
 		this.controller = cont;
 
 		// One Iteration
-		timer = new Timer(model.getTimerSpeed(), new ActionListener() {
+		timer = new Timer(0, new ActionListener() {
 			@Override
 			public void actionPerformed(ActionEvent ae) {
 				timeSlider.setValue(timeSlider.getValue() + 1);
@@ -106,7 +108,7 @@ public class TimePanel extends JPanel {
 		// Panel
 		timeBtnPanel.setBorder(null);
 		timeBtnPanel.setBackground(Color.WHITE);
-		timeBtnPanel.setLayout(new BoxLayout(timeBtnPanel, BoxLayout.X_AXIS));
+		timeBtnPanel.setLayout(new FlowLayout());
 
 		// Buttons
 		playBtn.setToolTipText(Languages.getLanguage()[89]);
@@ -174,6 +176,21 @@ public class TimePanel extends JPanel {
 			}
 		});
 
+		// timerSpeed
+		simSpeedText.addCaretListener(new CaretListener() {
+			@Override
+			public void caretUpdate(CaretEvent e) {
+				try {
+					controller.setTimerSpeed(Integer.parseInt(simSpeedText.getText()));
+				} catch (Exception ex) {
+					// TODO: handle exception
+				}
+
+			}
+		});
+
+		timeBtnPanel.add(simSpeedLabel);
+		timeBtnPanel.add(simSpeedText);
 		timeBtnPanel.add(playBtn);
 		timeBtnPanel.add(timeResetBtn);
 		/*

+ 3 - 3
src/ui/view/UpperNodeCanvas.java

@@ -484,7 +484,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 					if (con.getState()) {
 						g2.setColor(Color.GREEN);
 						if (con.getCapacity() != -1) {
-							g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+							g2.setStroke(new BasicStroke(Math.min(((con.getFlow() / con.getCapacity() * 3)+1), 4)));
 						}
 					} else {
 						g2.setColor(Color.RED);
@@ -529,7 +529,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 			g2.setColor(Color.BLUE);
 			for (CpsEdge con : upperNode.getNodeEdges()) {
 				if (con.getFlow() <= con.getCapacity()) {
-					g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 4), 4)));
+					g2.setStroke(new BasicStroke(Math.min((con.getFlow() / con.getCapacity() * 3)+1, 4)));
 				} else {
 					g2.setStroke(new BasicStroke(2));
 				}
@@ -570,7 +570,7 @@ public class UpperNodeCanvas extends JPanel implements MouseListener, MouseMotio
 		} else if (edgeHighlight != null) {
 			g2.setColor(Color.BLUE);
 			if (edgeHighlight.getFlow() <= edgeHighlight.getCapacity()) {
-				g2.setStroke(new BasicStroke(Math.min((edgeHighlight.getFlow() / edgeHighlight.getCapacity() * 4), 4)));
+				g2.setStroke(new BasicStroke(Math.min((edgeHighlight.getFlow() / edgeHighlight.getCapacity() * 3)+1, 4)));
 			} else {
 				g2.setStroke(new BasicStroke(2));
 			}