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