Impl mit Translate
This commit is contained in:
parent
53c8ddabb9
commit
9f880d55e2
3
Aufgabe8_Grafik2D/manifest.mf
Normal file
3
Aufgabe8_Grafik2D/manifest.mf
Normal file
@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
X-COMMENT: Main-Class will be added automatically by build
|
||||
|
2
Aufgabe8_Grafik2D/nbproject/private/private.properties
Normal file
2
Aufgabe8_Grafik2D/nbproject/private/private.properties
Normal file
@ -0,0 +1,2 @@
|
||||
compile.on.save=true
|
||||
user.properties.file=C:\\Users\\Js-Sc\\AppData\\Roaming\\NetBeans\\19\\build.properties
|
@ -17,6 +17,7 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @author ahren
|
||||
@ -26,7 +27,7 @@ public class Zeiger extends JComponent implements Runnable
|
||||
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;
|
||||
@ -57,8 +58,6 @@ public class Zeiger extends JComponent implements Runnable
|
||||
synchronized(this)
|
||||
{
|
||||
alpha += 0.1;
|
||||
xAussen = xMitte +cos(2*PI*alpha) * radius;
|
||||
yAussen = yMitte + sin(2*PI*alpha) * radius;
|
||||
}
|
||||
this.repaint();
|
||||
try
|
||||
@ -91,16 +90,16 @@ public class Zeiger extends JComponent implements Runnable
|
||||
float breite = this.getWidth() - 1;
|
||||
float hoehe = this.getHeight() - 1;
|
||||
|
||||
radius = (min(hoehe, breite)/2 * 0.9) * 1/ zeigerlaenge;
|
||||
|
||||
float radius = (min(hoehe, breite)/2 - 50) * 1/ zeigerlaenge;
|
||||
g2.translate(breite/2, hoehe/2);
|
||||
g2.rotate(alpha);
|
||||
|
||||
xMitte = breite/2;
|
||||
yMitte = hoehe/2;
|
||||
xAussen = xMitte +cos(2*PI*alpha) * radius;
|
||||
yAussen = yMitte + sin(2*PI*alpha) * radius;
|
||||
|
||||
linie.setLine(xMitte, yMitte, xAussen, yAussen);
|
||||
xAussen = radius;
|
||||
yAussen = 0;
|
||||
|
||||
linie.setLine(0, 0, xAussen, yAussen);
|
||||
g2.setStroke(stift);
|
||||
g2.setPaint(Color.RED);
|
||||
g2.draw(linie);
|
||||
|
Loading…
x
Reference in New Issue
Block a user