Преглед изворни кода

UnitGraph point paint Information

Kevin Trometer пре 8 година
родитељ
комит
943f10975f
1 измењених фајлова са 17 додато и 7 уклоњено
  1. 17 7
      src/ui/view/UnitGraph.java

+ 17 - 7
src/ui/view/UnitGraph.java

@@ -107,7 +107,7 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
 		if (isElement) {
 			// array fillen
 			fillArrayofValue();
-	
+
 			if (arrayOfFloats != null) {
 				// Draw the Lines
 				g2.setStroke(new BasicStroke(2));
@@ -133,12 +133,12 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
 							this.getHeight() - 10);
 				}
 			}
-			//drag Information
+			// drag Information
 			if (tempP != null) {
 				dragInformation = "" + convertToValueY(getYValueAt((int) tempP.getX()));
-				g2.drawString(dragInformation, (int) (tempP.getX()* scaleX)+10, (int) (tempP.getY()* scaleY)+10);
+				g2.drawString(dragInformation, (int) (tempP.getX() * scaleX) + 10, (int) (tempP.getY() * scaleY) + 10);
 			}
-			
+
 			/*
 			 * // Actual Iteration Point Visualization g2.setColor(Color.RED);
 			 * if (arrayOfValue != null) { for (int i = 0; i <
@@ -179,11 +179,20 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
 				}
 			}
 			if (tempP != null) {
-				dragInformation = "model.get";
-				g2.drawString(dragInformation, (int) (getMousePosition().getX())+10, (int) (getMousePosition().getY())+10);
+				try {
+					int i;
+					for (i = 0; (i * this.getWidth() / (model.getIterations() - 1) < getMousePosition().getX()); i++) {
+
+					}
+					dragInformation = "" + i;
+					g2.drawString(dragInformation, (int) (getMousePosition().getX()) + 10,
+							(int) (getMousePosition().getY()) + 10);
+				} catch (Exception e) {
+					// TODO: handle exception
+				}
 			}
 		}
-		
+
 		// Iteration Line
 		g2.setColor(Color.BLUE);
 		g2.setStroke(new BasicStroke(1));
@@ -423,6 +432,7 @@ class UnitGraph extends JPanel implements MouseListener, MouseMotionListener, Co
 			tempP = null;
 		}
 		dragInformation = "";
+		repaint();
 	}
 
 	public void componentResized(ComponentEvent e) {