Browse Source

final fix

dominik.rieder 7 years ago
parent
commit
0cb4a4417d
1 changed files with 30 additions and 4 deletions
  1. 30 4
      src/ui/view/StatPanel2.java

+ 30 - 4
src/ui/view/StatPanel2.java

@@ -530,6 +530,36 @@ public class StatPanel2 extends JSplitPane implements GraphListener {
 		});
 		// ======================BLUE TEXTFIELD END=========================//
 		
+		// ======================GRAPH NR TEXTFIELD=========================//
+		graphNrTxtField = new JTextField();
+		graphNrTxtField.setColumns(10);
+		graphNrTxtField.getDocument().addDocumentListener(new DocumentListener() {
+			/*
+			 * if textField for Red changes, changes will applied in the
+			 * DataStructure "currentProperty" if Value is legit
+			 */
+			@Override
+			public void insertUpdate(DocumentEvent e) {
+				if (currentProperty != null) {
+					currentProperty.setGraph(graphNrTxtField.getText());
+				}
+			}
+
+			@Override
+			public void removeUpdate(DocumentEvent e) {
+				if (currentProperty != null) {
+					currentProperty.setGraph(graphNrTxtField.getText());
+				}
+			}
+
+			@Override
+			public void changedUpdate(DocumentEvent e) {
+
+			}
+		});
+
+		// ======================= GRAPH NR TEXTFIELD END==================//
+		
 		//======================== ADD BUTTON =============================//
 
 		JButton btnAdd = new JButton("Add");
@@ -607,7 +637,6 @@ public class StatPanel2 extends JSplitPane implements GraphListener {
 		lblGraph.setBounds(10, 61, 33, 14);
 		editPanel.add(lblGraph);
 		
-		graphNrTxtField = new JTextField();
 		graphNrTxtField.setColumns(10);
 		graphNrTxtField.setBounds(69, 61, 86, 20);
 		editPanel.add(graphNrTxtField);
@@ -623,7 +652,6 @@ public class StatPanel2 extends JSplitPane implements GraphListener {
 		lblR.setBounds(10, 111, 11, 14);
 		editPanel.add(lblR);
 		
-		redField = new JTextField();
 		redField.setColumns(10);
 		redField.setBounds(20, 108, 37, 20);
 		editPanel.add(redField);
@@ -632,7 +660,6 @@ public class StatPanel2 extends JSplitPane implements GraphListener {
 		lblG.setBounds(58, 111, 11, 14);
 		editPanel.add(lblG);
 		
-		greenField = new JTextField();
 		greenField.setColumns(10);
 		greenField.setBounds(69, 108, 37, 20);
 		editPanel.add(greenField);
@@ -641,7 +668,6 @@ public class StatPanel2 extends JSplitPane implements GraphListener {
 		lblB.setBounds(108, 111, 10, 14);
 		editPanel.add(lblB);
 		
-		blueField = new JTextField();
 		blueField.setColumns(10);
 		blueField.setBounds(116, 108, 39, 20);
 		editPanel.add(blueField);