|
@@ -12,6 +12,7 @@ import java.awt.event.*;
|
|
|
import java.awt.geom.CubicCurve2D;
|
|
|
import java.awt.geom.GeneralPath;
|
|
|
import java.awt.geom.Line2D;
|
|
|
+import java.awt.geom.Path2D;
|
|
|
import java.util.ArrayDeque;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Iterator;
|
|
@@ -58,6 +59,11 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
private int textWidth = 0;
|
|
|
|
|
|
private IGraphedElement current;
|
|
|
+
|
|
|
+ //NEW ERA
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* Constructor.
|
|
@@ -85,8 +91,26 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
*/
|
|
|
public void paintComponent(Graphics g) {
|
|
|
super.paintComponent(g);
|
|
|
-//
|
|
|
-// System.out.println("paint");
|
|
|
+
|
|
|
+ System.out.println("paint");
|
|
|
+ Graphics2D g2D = (Graphics2D) g;
|
|
|
+ g2D.setColor(Color.BLACK);
|
|
|
+ int höhe = this.getHeight();
|
|
|
+ int breite = this.getWidth();
|
|
|
+ g2D.setRenderingHints(new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON));
|
|
|
+ g2D.setStroke(new BasicStroke(1));
|
|
|
+ // g2D.drawLine(0, 0,breite, höhe);
|
|
|
+ //generate Path --> maybe als Methode auslagern
|
|
|
+
|
|
|
+ //Good Source for basic understanding for Bezier Curves
|
|
|
+ //http://www.theappguruz.com/blog/bezier-curve-in-games
|
|
|
+
|
|
|
+
|
|
|
+ Path2D.Double mypath = new Path2D.Double();
|
|
|
+ mypath.moveTo(0, 0);
|
|
|
+ mypath.curveTo(breite, breite, breite, breite, breite, höhe);
|
|
|
+
|
|
|
+ g2D.draw(mypath);
|
|
|
// g2 = (Graphics2D) g;
|
|
|
// RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
|
|
// g2.setRenderingHints(rh);
|
|
@@ -528,6 +552,7 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
public void componentResized(ComponentEvent e) {
|
|
|
System.out.println("componentResized");
|
|
|
// Wenn ein anderes Element genommen wird
|
|
|
+ /*
|
|
|
if (init) {
|
|
|
init = false;
|
|
|
// for scale on the first initialisation
|
|
@@ -546,6 +571,7 @@ public class UnitGraph extends JPanel implements MouseListener, MouseMotionListe
|
|
|
// Scale
|
|
|
scaleX = (this.getWidth() - (border * 2)) / width;
|
|
|
scaleY = (this.getHeight() - (border * 2)) / height;
|
|
|
+ */
|
|
|
repaint();
|
|
|
}
|
|
|
|