kleine verschönerungen
This commit is contained in:
parent
53c8ddabb9
commit
416f890de2
@ -21,7 +21,6 @@ public class Start
|
|||||||
JFrame frm = new JFrame();
|
JFrame frm = new JFrame();
|
||||||
frm.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
frm.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
||||||
Container c = frm.getContentPane();
|
Container c = frm.getContentPane();
|
||||||
|
|
||||||
c.setLayout(new OverlayLayout(c));
|
c.setLayout(new OverlayLayout(c));
|
||||||
for (int zeigerLaenge = 1; zeigerLaenge <=3; zeigerLaenge++)
|
for (int zeigerLaenge = 1; zeigerLaenge <=3; zeigerLaenge++)
|
||||||
{
|
{
|
||||||
|
@ -15,6 +15,7 @@ import static java.lang.Math.*;
|
|||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
import java.util.logging.Logger;
|
||||||
import javax.swing.JComponent;
|
import javax.swing.JComponent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,10 +24,11 @@ import javax.swing.JComponent;
|
|||||||
*/
|
*/
|
||||||
public class Zeiger extends JComponent implements Runnable
|
public class Zeiger extends JComponent implements Runnable
|
||||||
{
|
{
|
||||||
|
private Logger lg = Logger.getLogger("grafik");
|
||||||
private static final float DICKE = 4f;
|
private static final float DICKE = 4f;
|
||||||
private Line2D.Float linie;
|
private Line2D.Float linie;
|
||||||
private BasicStroke stift;
|
private BasicStroke stift;
|
||||||
private volatile float radius;
|
private volatile double radius;
|
||||||
private volatile float xMitte;
|
private volatile float xMitte;
|
||||||
private volatile float yMitte;
|
private volatile float yMitte;
|
||||||
private volatile double xAussen;
|
private volatile double xAussen;
|
||||||
@ -56,7 +58,7 @@ public class Zeiger extends JComponent implements Runnable
|
|||||||
{
|
{
|
||||||
synchronized(this)
|
synchronized(this)
|
||||||
{
|
{
|
||||||
alpha += 0.1;
|
alpha += 0.08;
|
||||||
xAussen = xMitte +cos(2*PI*alpha) * radius;
|
xAussen = xMitte +cos(2*PI*alpha) * radius;
|
||||||
yAussen = yMitte + sin(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)
|
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);
|
super.paintComponent(g);
|
||||||
Graphics2D g2 = (Graphics2D)g;
|
Graphics2D g2 = (Graphics2D)g;
|
||||||
|
|
||||||
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
RenderingHints.VALUE_ANTIALIAS_ON);
|
|
||||||
|
|
||||||
float breite = this.getWidth() - 1;
|
float breite = this.getWidth() - 1;
|
||||||
float hoehe = this.getHeight() - 1;
|
float hoehe = this.getHeight() - 1;
|
||||||
|
|
||||||
|
radius = (min(hoehe, breite)/2 *0.9) * 1/ zeigerlaenge;
|
||||||
float radius = (min(hoehe, breite)/2 - 50) * 1/ zeigerlaenge;
|
|
||||||
|
|
||||||
xMitte = breite/2;
|
xMitte = breite/2;
|
||||||
yMitte = hoehe/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);
|
linie.setLine(xMitte, yMitte, xAussen, yAussen);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user