|
|
@@ -15,6 +15,7 @@ import static java.lang.Math.*; |
|
|
|
import java.util.concurrent.ExecutorService; |
|
|
|
import java.util.concurrent.Executors; |
|
|
|
import java.util.concurrent.Future; |
|
|
|
import java.util.logging.Logger; |
|
|
|
import javax.swing.JComponent; |
|
|
|
|
|
|
|
/** |
|
|
@@ -23,10 +24,11 @@ import javax.swing.JComponent; |
|
|
|
*/ |
|
|
|
public class Zeiger extends JComponent implements Runnable |
|
|
|
{ |
|
|
|
private Logger lg = Logger.getLogger("grafik"); |
|
|
|
private static final float DICKE = 4f; |
|
|
|
private Line2D.Float linie; |
|
|
|
private BasicStroke stift; |
|
|
|
private volatile float radius; |
|
|
|
private volatile double radius; |
|
|
|
private volatile float xMitte; |
|
|
|
private volatile float yMitte; |
|
|
|
private volatile double xAussen; |
|
|
@@ -56,7 +58,7 @@ public class Zeiger extends JComponent implements Runnable |
|
|
|
{ |
|
|
|
synchronized(this) |
|
|
|
{ |
|
|
|
alpha += 0.1; |
|
|
|
alpha += 0.08; |
|
|
|
xAussen = xMitte +cos(2*PI*alpha) * radius; |
|
|
|
yAussen = yMitte + sin(2*PI*alpha) * radius; |
|
|
|
} |
|
|
@@ -67,7 +69,7 @@ public class Zeiger extends JComponent implements Runnable |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
//lg.severe(ex.toString()); |
|
|
|
lg.severe(ex.toString()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@@ -85,19 +87,21 @@ public class Zeiger extends JComponent implements Runnable |
|
|
|
super.paintComponent(g); |
|
|
|
Graphics2D g2 = (Graphics2D)g; |
|
|
|
|
|
|
|
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, |
|
|
|
RenderingHints.VALUE_ANTIALIAS_ON); |
|
|
|
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); |
|
|
|
|
|
|
|
float breite = this.getWidth() - 1; |
|
|
|
float hoehe = this.getHeight() - 1; |
|
|
|
|
|
|
|
|
|
|
|
float radius = (min(hoehe, breite)/2 - 50) * 1/ zeigerlaenge; |
|
|
|
radius = (min(hoehe, breite)/2 *0.9) * 1/ zeigerlaenge; |
|
|
|
|
|
|
|
xMitte = breite/2; |
|
|
|
yMitte = hoehe/2; |
|
|
|
xAussen = xMitte +cos(2*PI*alpha) * radius; |
|
|
|
yAussen = yMitte + sin(2*PI*alpha) * radius; |
|
|
|
|
|
|
|
synchronized(this) |
|
|
|
{ |
|
|
|
xAussen = xMitte +cos(2*PI*alpha) * radius; |
|
|
|
yAussen = yMitte + sin(2*PI*alpha) * radius; |
|
|
|
} |
|
|
|
|
|
|
|
linie.setLine(xMitte, yMitte, xAussen, yAussen); |
|
|
|
|