updato
This commit is contained in:
parent
4d2e61d687
commit
795873c502
|
|
@ -19,6 +19,7 @@ public class Main {
|
||||||
for(int i = 0; i < 5400; i++){
|
for(int i = 0; i < 5400; i++){
|
||||||
spiel.tick();
|
spiel.tick();
|
||||||
System.out.println(spiel.getSpielzeit());
|
System.out.println(spiel.getSpielzeit());
|
||||||
|
sf.refresh();
|
||||||
// try {
|
// try {
|
||||||
// Thread.sleep(200);
|
// Thread.sleep(200);
|
||||||
// } catch (InterruptedException e) {
|
// } catch (InterruptedException e) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@ package fussballmanager;
|
||||||
|
|
||||||
public class Position {
|
public class Position {
|
||||||
|
|
||||||
double x,y;
|
public double x;
|
||||||
|
public double y;
|
||||||
|
|
||||||
public Position(double x,double y){
|
public Position(double x,double y){
|
||||||
this.x = x;
|
this.x = x;
|
||||||
|
|
|
||||||
|
|
@ -11,10 +11,10 @@ import fussballmanager.personen.*;
|
||||||
public class Spiel {
|
public class Spiel {
|
||||||
int spielzeit;
|
int spielzeit;
|
||||||
int verlängerung;
|
int verlängerung;
|
||||||
Team heimteam;
|
public Team heimteam;
|
||||||
Team auswärtsteam;
|
public Team auswärtsteam;
|
||||||
Schiedsrichter schiri;
|
Schiedsrichter schiri;
|
||||||
Ball b;
|
public Ball b;
|
||||||
//true = heim | false = auswärts
|
//true = heim | false = auswärts
|
||||||
boolean ballBesitz;
|
boolean ballBesitz;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ import fussballmanager.personen.*;
|
||||||
public class Team {
|
public class Team {
|
||||||
String name;
|
String name;
|
||||||
Trainer trainer;
|
Trainer trainer;
|
||||||
Spieler[] spieler = new Spieler[10];
|
public Spieler[] spieler = new Spieler[10];
|
||||||
Torwart torwart;
|
Torwart torwart;
|
||||||
int siege = 0;
|
int siege = 0;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
package fussballmanager.gui;
|
package fussballmanager.gui;
|
||||||
|
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
|
import fussballmanager.Position;
|
||||||
|
|
||||||
public class JLabelSpieler extends JLabel{
|
public class JLabelSpieler extends JLabel{
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
@ -10,5 +13,15 @@ public class JLabelSpieler extends JLabel{
|
||||||
// 0 SpielerA
|
// 0 SpielerA
|
||||||
// 1 SpielerB
|
// 1 SpielerB
|
||||||
// 2 Ball
|
// 2 Ball
|
||||||
int id;
|
private static final ImageIcon spielerA = new ImageIcon("resources/nocoin.png");
|
||||||
|
private static final ImageIcon spielerB = new ImageIcon("resources/coin.png");
|
||||||
|
private static final ImageIcon ball = new ImageIcon("resources/nocoin.png");
|
||||||
|
private static final ImageIcon[] icons = {spielerA,spielerB,ball};
|
||||||
|
private int id;
|
||||||
|
|
||||||
|
public JLabelSpieler(int id,Position p) {
|
||||||
|
super(icons[id]);
|
||||||
|
this.id = id;
|
||||||
|
this.setBounds((int)p.x, (int)p.y, 10, 10);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,6 +8,8 @@ import javax.swing.JPanel;
|
||||||
import javax.swing.border.EmptyBorder;
|
import javax.swing.border.EmptyBorder;
|
||||||
|
|
||||||
import fussballmanager.Spiel;
|
import fussballmanager.Spiel;
|
||||||
|
import fussballmanager.personen.Spieler;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import javax.swing.JLabel;
|
import javax.swing.JLabel;
|
||||||
|
|
@ -19,7 +21,7 @@ public class SpielFrame extends JFrame {
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -6668792380368209035L;
|
private static final long serialVersionUID = -6668792380368209035L;
|
||||||
private JPanel contentPane;
|
private JPanel contentPane;
|
||||||
private JPanel panel;
|
private JPanel feld;
|
||||||
private Spiel spiel;
|
private Spiel spiel;
|
||||||
private static final int size = 10;
|
private static final int size = 10;
|
||||||
|
|
||||||
|
|
@ -42,16 +44,19 @@ public class SpielFrame extends JFrame {
|
||||||
setContentPane(contentPane);
|
setContentPane(contentPane);
|
||||||
contentPane.setLayout(null);
|
contentPane.setLayout(null);
|
||||||
|
|
||||||
panel = new JPanel();
|
feld = new JPanel();
|
||||||
panel.setBackground(new Color(34, 139, 34));
|
feld.setBackground(new Color(34, 139, 34));
|
||||||
panel.setMinimumSize(new Dimension(size*90, size*45));
|
feld.setMinimumSize(new Dimension(size*90, size*45));
|
||||||
panel.setMaximumSize(new Dimension(size*90, size*45));
|
feld.setMaximumSize(new Dimension(size*90, size*45));
|
||||||
panel.setBounds(10, 10, size*90, size*45);
|
feld.setBounds(10, 10, size*90, size*45);
|
||||||
contentPane.add(panel);
|
contentPane.add(feld);
|
||||||
panel.setLayout(null);
|
feld.setLayout(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
|
feld.removeAll();
|
||||||
|
for(Spieler s:spiel.heimteam.spieler) {
|
||||||
|
feld.add(new JLabelSpieler(0, s.p));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue