Browse Source

timer weg

Kevin Trometer 8 years ago
parent
commit
c403786f5f
2 changed files with 12 additions and 12 deletions
  1. 0 8
      src/ui/view/StatisticGraph.java
  2. 12 4
      src/ui/view/StatisticGraphPanel.java

+ 0 - 8
src/ui/view/StatisticGraph.java

@@ -59,14 +59,6 @@ public class StatisticGraph extends JPanel {
 		this.model = model;
 
 		this.setBackground(Color.WHITE);
-
-		Timer timer = new Timer(200, new ActionListener() {
-			@Override
-			public void actionPerformed(ActionEvent ae) {
-				repaint();
-			}
-		});
-		timer.start();
 	}
 
 	/**

+ 12 - 4
src/ui/view/StatisticGraphPanel.java

@@ -7,8 +7,11 @@ import ui.controller.Control;
 import ui.model.Model;
 import javax.swing.JLabel;
 import javax.swing.BoxLayout;
+import javax.swing.JButton;
 import javax.swing.SwingConstants;
 import java.awt.BorderLayout;
+import javax.swing.border.LineBorder;
+import java.awt.Color;
 
 public class StatisticGraphPanel extends JPanel {
 
@@ -22,6 +25,8 @@ public class StatisticGraphPanel extends JPanel {
 	private StatisticGraph sGraph;
 	private final JLabel graphNameLabel;
 	private final JLabel maximumLabel = new JLabel("0");
+	private JPanel topPanel = new JPanel();
+	private JButton closeButton = new JButton("X");
 
 	// Variables
 	String graphName;
@@ -37,19 +42,22 @@ public class StatisticGraphPanel extends JPanel {
 	 */
 	public StatisticGraphPanel(Model mod, Control cont, String name) {
 		super();
+		setBorder(new LineBorder(new Color(0, 0, 0), 1, true));
 		this.model = mod;
 		this.controller = cont;
 		this.sGraph = new StatisticGraph(mod, cont);
 		this.graphName = name;
 		setLayout(new BorderLayout(0, 0));
 
-		/**** add everything *****/
+		//********** add everything **********//
 		// Statistic Graph
 		this.add(sGraph);
-		// Graph Name
+		// Graph Name and Close Button
 		graphNameLabel = new JLabel(graphName);
-		graphNameLabel.setHorizontalAlignment(SwingConstants.CENTER);
-		this.add(graphNameLabel, BorderLayout.NORTH);
+		topPanel.add(graphNameLabel);
+		topPanel.add(closeButton);
+		topPanel.setBorder(null);
+		this.add(topPanel, BorderLayout.NORTH);
 		// Y Maximum
 		maximumLabel.setVerticalAlignment(SwingConstants.TOP);
 		this.add(maximumLabel, BorderLayout.WEST);