Explorar o código

#29 should be resolved

Kevin Trometer %!s(int64=7) %!d(string=hai) anos
pai
achega
b175dff9d8

BIN=BIN
res/Button_Images/Thumbs.db


BIN=BIN
res/Button_Images/backward.png


BIN=BIN
res/Button_Images/forward.png


BIN=BIN
res/Button_Images/pause.png


BIN=BIN
res/Button_Images/play.png


BIN=BIN
res/Button_Images/reset.png


+ 14 - 7
src/ui/view/ButtonTabComponent.java

@@ -97,13 +97,7 @@ public class ButtonTabComponent extends JPanel {
 		}
 
 		public void actionPerformed(ActionEvent e) {
-			int i = pane.indexOfTabComponent(ButtonTabComponent.this);
-			if (i != -1) {
-				pane.remove(i);
-				if (pane2.getTabCount() < 0) {
-					pane2.remove(i);
-				}
-			}
+			removeTabs();
 		}
 
 		// we don't want to update UI for this button
@@ -147,4 +141,17 @@ public class ButtonTabComponent extends JPanel {
 			}
 		}
 	};
+	
+	/**
+	 * removes both Tabs 
+	 */
+	public void removeTabs() {
+		int i = pane.indexOfTabComponent(ButtonTabComponent.this);
+		if (i != -1) {
+			pane.remove(i);
+			if (pane2.getTabCount() > 0) {
+				pane2.remove(i);
+			}
+		}
+	}
 }

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

@@ -678,6 +678,8 @@ public class GUI<E> implements CategoryListener {
 						.getComponent(0) instanceof UpperNodeCanvas) {
 					((UpperNodeCanvas) ((JScrollPane) tabbedPane2.getSelectedComponent()).getViewport().getComponent(0))
 							.repaint();
+				} else {
+					canvas.repaint();
 				}
 			}
 		});
@@ -1803,7 +1805,6 @@ public class GUI<E> implements CategoryListener {
 				controller.calculateStateForTimeStep(i);
 				unitGraph.repaint();
 				statSplitPane.repaintGraphs();
-				controller.addTextToConsole("test");
 				contentPane.updateUI();
 			}
 		});
@@ -2107,7 +2108,7 @@ public class GUI<E> implements CategoryListener {
 		} else {
 			tabTemp = tabbedPane2;
 		}
-			if (((JScrollPane) tabTemp.getSelectedComponent()).getViewport().getComponent(0) instanceof MyCanvas) {
+		if (((JScrollPane) tabTemp.getSelectedComponent()).getViewport().getComponent(0) instanceof MyCanvas) {
 			unc = new UpperNodeCanvas(model, controller, (CpsUpperNode) temp, "");
 		} else {
 			unc = new UpperNodeCanvas(model, controller, (CpsUpperNode) temp,

+ 8 - 13
src/ui/view/TimePanel.java

@@ -116,7 +116,6 @@ public class TimePanel extends JPanel {
 		timeSlider.setToolTipText(Languages.getLanguage()[93]);
 		timeSlider.setMaximum(model.getIterations() - 1);
 		timeSlider.setValue(0);
-		timeSlider.setBackground(Color.WHITE);
 		timeSlider.addChangeListener(new ChangeListener() {
 			@Override
 			public void stateChanged(ChangeEvent e) {
@@ -140,15 +139,14 @@ public class TimePanel extends JPanel {
 
 		// Panel
 		timeBtnPanel.setBorder(null);
-		timeBtnPanel.setBackground(Color.WHITE);
-		timeBtnPanel.setLayout(new FlowLayout());
+		timeBtnPanel.setLayout(new FlowLayout(FlowLayout.CENTER));
 
 		// Buttons
 		playBtn.setToolTipText(Languages.getLanguage()[89]);
 
-		playBtn.setBackground(Color.WHITE);
+		playBtn.setContentAreaFilled(false);
 		playBtn.setBorderPainted(false);
-		playBtn.setBorder(new LineBorder(Color.WHITE, 4));
+		playBtn.setBorder(null);
 		playBtn.setIcon(new ImageIcon(new ImageIcon(this.getClass().getResource("/Button_Images/play.png")).getImage()
 				.getScaledInstance(30, 30, Image.SCALE_SMOOTH)));
 		playBtn.addActionListener(new ActionListener() {
@@ -169,9 +167,8 @@ public class TimePanel extends JPanel {
 		});
 		timeResetBtn.setToolTipText(Languages.getLanguage()[90]);
 
-		timeResetBtn.setBorderPainted(false);
-		timeResetBtn.setBackground(Color.WHITE);
-		timeResetBtn.setBorder(new LineBorder(Color.WHITE, 4));
+		timeResetBtn.setContentAreaFilled(false);
+		timeResetBtn.setBorder(null);
 		timeResetBtn.setIcon(new ImageIcon(new ImageIcon(this.getClass().getResource("/Button_Images/reset.png"))
 				.getImage().getScaledInstance(30, 30, Image.SCALE_SMOOTH)));
 		timeResetBtn.addActionListener(new ActionListener() {
@@ -184,9 +181,9 @@ public class TimePanel extends JPanel {
 		});
 		timeForwardBtn.setToolTipText(Languages.getLanguage()[91]);
 
-		timeForwardBtn.setBorderPainted(false);
+
 		timeForwardBtn.setContentAreaFilled(false);
-		timeForwardBtn.setBorder(new LineBorder(Color.WHITE, 4));
+		timeForwardBtn.setBorder(null);
 		timeForwardBtn.setIcon(new ImageIcon(new ImageIcon(this.getClass().getResource("/Button_Images/forward.png"))
 				.getImage().getScaledInstance(30, 30, Image.SCALE_SMOOTH)));
 		timeForwardBtn.addActionListener(new ActionListener() {
@@ -197,9 +194,7 @@ public class TimePanel extends JPanel {
 		});
 		timeBackwardBtn.setToolTipText(Languages.getLanguage()[92]);
 
-		timeBackwardBtn.setBackground(Color.WHITE);
-		timeBackwardBtn.setBorderPainted(false);
-		timeBackwardBtn.setBorder(new LineBorder(Color.WHITE, 4));
+		timeBackwardBtn.setBorder(null);
 		timeBackwardBtn.setIcon(new ImageIcon(new ImageIcon(this.getClass().getResource("/Button_Images/backward.png"))
 				.getImage().getScaledInstance(30, 30, Image.SCALE_SMOOTH)));
 		timeBackwardBtn.addActionListener(new ActionListener() {