2014-04-17 17:03:45 +00:00
|
|
|
package de.psychose;
|
|
|
|
|
2014-04-17 09:25:14 +00:00
|
|
|
import javax.swing.*;
|
2014-04-18 01:06:41 +00:00
|
|
|
import java.awt.event.ActionEvent;
|
2014-04-17 09:25:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author: lucas
|
|
|
|
* @date: 14.04.14 21:43
|
|
|
|
*/
|
2014-11-21 02:50:27 +00:00
|
|
|
public class MainForm extends JFrame {
|
2014-04-17 09:25:14 +00:00
|
|
|
private JPanel mainPanel;
|
2014-11-21 02:50:27 +00:00
|
|
|
private ActorHeart heart;
|
2014-04-17 09:25:14 +00:00
|
|
|
private ActorDisplay actor1;
|
|
|
|
private ActorDisplay actor2;
|
|
|
|
private ActorDisplay actor3;
|
2014-11-19 02:12:08 +00:00
|
|
|
private JLabel breath;
|
2014-04-23 10:53:48 +00:00
|
|
|
|
2014-11-21 02:50:27 +00:00
|
|
|
public MainForm(final ActorData[] actorDatas) {
|
|
|
|
super("HD Main");
|
|
|
|
setContentPane(mainPanel);
|
|
|
|
setResizable(false);
|
|
|
|
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
|
|
|
|
setUndecorated(true);
|
2014-04-17 09:25:14 +00:00
|
|
|
|
2014-11-21 02:50:27 +00:00
|
|
|
actor1.init(actorDatas[0], false);
|
|
|
|
actor2.init(actorDatas[1], false);
|
|
|
|
actor3.init(actorDatas[2], false);
|
|
|
|
heart.setActorDatas(actorDatas);
|
2014-04-18 01:06:41 +00:00
|
|
|
|
2014-11-21 02:50:27 +00:00
|
|
|
// this is now our main timer to update all and everything gui related
|
|
|
|
final Timer timer = new Timer(50, new AbstractAction() {
|
2014-04-18 01:06:41 +00:00
|
|
|
@Override
|
|
|
|
public void actionPerformed(ActionEvent e) {
|
2014-11-21 02:50:27 +00:00
|
|
|
// update the breath display
|
|
|
|
breath.setText(String.valueOf(actorDatas[0].getAirflow()));
|
|
|
|
|
|
|
|
actor1.update();
|
|
|
|
actor2.update();
|
|
|
|
actor3.update();
|
|
|
|
heart.update();
|
2014-04-18 01:06:41 +00:00
|
|
|
}
|
|
|
|
});
|
|
|
|
timer.start();
|
2014-04-23 10:53:48 +00:00
|
|
|
|
2014-11-21 02:50:27 +00:00
|
|
|
pack();
|
|
|
|
setVisible(true);
|
2014-04-17 09:25:14 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2014-10-27 21:04:11 +00:00
|
|
|
|
2014-04-17 09:25:14 +00:00
|
|
|
}
|