package pack;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.Timer;
public class Startseite{
public final static int SHOW_TIME_PER_SLIDE = 992;
Timer timer = new Timer(SHOW_TIME_PER_SLIDE, new StartHaendler());
JFrame jf = new JFrame();
JButton play = new JButton("start");
JLabel bild6 = new JLabel();
ImageIcon timerZahlMinuteZehnerstelle = new ImageIcon("bilder/timerzahl2.png");
JLabel bild7 = new JLabel();
ImageIcon timerZahlMinuteEinerstelle = new ImageIcon("bilder/timerzahl0.png");
JLabel bild8 = new JLabel();
ImageIcon timerZahlSekundeZehnerstelle = new ImageIcon("bilder/timerzahl0.png");
JLabel bild9 = new JLabel();
ImageIcon timerZahlSekundeEinerstelle = new ImageIcon("bilder/timerzahl0.png");
JLabel bild10 = new JLabel();
ImageIcon timerDoppelpunkt = new ImageIcon("bilder/doppelpunkt.png");
public static void main(String[] args) {
new Startseite();
}
public Startseite() {
jf.setTitle("BlindTimer");
jf.setSize(1920, 1080);
jf.getContentPane().setBackground(Color.BLACK);
jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
jf.setLayout(null);
jf.setResizable(true);
jf.setLocationRelativeTo(null);
jf.setVisible(true);
bild6.setIcon(timerZahlMinuteZehnerstelle);
bild6.setBounds(625, 440, 133, 200);
jf.add(bild6);
bild7.setIcon(timerZahlMinuteEinerstelle);
bild7.setBounds(778, 440, 133, 200);
jf.add(bild7);
bild8.setIcon(timerZahlSekundeZehnerstelle);
bild8.setBounds(1008, 440, 133, 200);
jf.add(bild8);
bild9.setIcon(timerZahlSekundeEinerstelle);
bild9.setBounds(1161, 440, 133, 200);
jf.add(bild9);
bild10.setIcon(timerDoppelpunkt);
bild10.setBounds(941, 490, 37, 100);
jf.add(bild10);
play.setIcon(null);
play.setBounds(910, 700, 100, 50);
play.addActionListener(new StartHaendler());
jf.add(play);
}
class StartHaendler implements ActionListener{
int timerZifferSekundeEinerstelle = 0;
int timerZifferSekundeZehnerstelle = 0;
int timerZifferMinuteEinerstelle = 0;
int timerZifferMinuteZehnerstelle = 2;
@Override
public void actionPerformed(ActionEvent e) {
if(e.getSource()== play) {
timer.start();
}
timerZifferSekundeEinerstelle = timerZifferSekundeEinerstelle-1;
if(timerZifferSekundeEinerstelle == -1) {
timerZifferSekundeEinerstelle = 9;
}
if(timerZifferSekundeEinerstelle == 9) {
timerZifferSekundeZehnerstelle = timerZifferSekundeZehnerstelle -1;
}
if(timerZifferSekundeEinerstelle == 9 && timerZifferSekundeZehnerstelle == -1) {
timerZifferSekundeZehnerstelle = 5;
timerZifferMinuteEinerstelle = timerZifferMinuteEinerstelle -1;
}
if(timerZifferSekundeEinerstelle == 9 && timerZifferSekundeZehnerstelle == 5 && timerZifferMinuteEinerstelle == -1) {
timerZifferSekundeZehnerstelle = 5;
timerZifferMinuteEinerstelle = 9;
timerZifferMinuteZehnerstelle = timerZifferMinuteZehnerstelle -1;
}
bild6.setIcon(new ImageIcon("bilder/timerzahl" + timerZifferMinuteZehnerstelle + ".png"));
bild7.setIcon(new ImageIcon("bilder/timerzahl" + timerZifferMinuteEinerstelle + ".png"));
bild8.setIcon(new ImageIcon("bilder/timerzahl" + timerZifferSekundeZehnerstelle + ".png"));
bild9.setIcon(new ImageIcon("bilder/timerzahl" + timerZifferSekundeEinerstelle + ".png"));
}
}
}