-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Beenden des Spiels angepasst -> Server beenden meldet die Clients ab
- Loading branch information
Showing
21 changed files
with
132 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
/client | ||
/server | ||
/lib | ||
/graphik |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
package graphik; | ||
|
||
import java.awt.Color; | ||
import java.awt.Dimension; | ||
import java.awt.Font; | ||
import java.awt.GridLayout; | ||
|
||
import javax.swing.JLabel; | ||
import javax.swing.JPanel; | ||
|
||
public class Meldungen extends JPanel{ | ||
|
||
//Anzeigen | ||
private JLabel[] meldung; | ||
|
||
private int festeAnzeigen = 0; | ||
|
||
public Meldungen(int histLaenge) { | ||
super(); | ||
|
||
this.setLayout(null); | ||
this.setOpaque(true); | ||
this.setBackground(new Color(0,0,0,0)); | ||
this.setSize(200, histLaenge*20); | ||
|
||
meldung = new JLabel[histLaenge]; | ||
for(int i = 0; i < meldung.length; i++) { | ||
meldung[i] = new JLabel(); | ||
this.add(meldung[i]); | ||
meldung[i].setBounds(0, i*20, 480, 20); | ||
meldung[i].setBackground(new Color(0,0,0,0)); | ||
meldung[i].setForeground(Color.white); | ||
} | ||
} | ||
|
||
/** | ||
* Erstellt eine nicht veränderliche Anzeige in der ersten Zeile | ||
* @param text | ||
*/ | ||
public void festeAnzeige(String text) { | ||
//Verdoppelt die letzte Meldung | ||
nachricht(meldung[festeAnzeigen].getText()); | ||
//Und startet die feste Anzeige | ||
meldung[festeAnzeigen].setText(text); | ||
Font schrift = meldung[festeAnzeigen].getFont(); | ||
meldung[festeAnzeigen].setFont(schrift.deriveFont(schrift.BOLD+ schrift.ITALIC)); | ||
} | ||
|
||
/** | ||
* Fügt eine eine neue Nachricht hinzu | ||
* @param text | ||
*/ | ||
public void nachricht(String text) { | ||
for(int i = meldung.length - 1; i > festeAnzeigen; i--) { | ||
//Rückt alle Anzeigen eins nach unten | ||
meldung[i].setText(""); | ||
meldung[i].setText(meldung[i - 1].getText()); | ||
} | ||
//Zeigt die neue Meldung an | ||
meldung[1].setText(text); | ||
} | ||
|
||
/** | ||
* Zeigt an, dass der Spieler an der Reihe ist | ||
*/ | ||
public void dran(boolean ein) { | ||
if(ein) { | ||
//Spieler einfärben | ||
meldung[0].setForeground(Color.darkGray); | ||
} else { | ||
//Spieler wieder auf normal | ||
meldung[0].setForeground(Color.white); | ||
} | ||
} | ||
|
||
/** | ||
* Setzt alle Meldungen zurück | ||
*/ | ||
public void reset() { | ||
festeAnzeigen = 0; | ||
for(int i = 0; i < meldung.length; i++) { | ||
meldung[i].setText(""); | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters