42 lines
838 B
Java
42 lines
838 B
Java
|
|
package fr.iut_fbleau.Avalam.ui;
|
|||
|
|
|
|||
|
|
import javax.swing.*;
|
|||
|
|
import java.awt.*;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* La classe <code>TurnView</code> affiche le joueur à qui c'est le tour.
|
|||
|
|
*
|
|||
|
|
* Elle agit comme une simple bannière d’information,
|
|||
|
|
* mise à jour par la logique du jeu.
|
|||
|
|
*
|
|||
|
|
* @author
|
|||
|
|
* @version 1.0
|
|||
|
|
*/
|
|||
|
|
public class TurnView extends JPanel {
|
|||
|
|
|
|||
|
|
private JLabel text;
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Constructeur.
|
|||
|
|
*
|
|||
|
|
* @param initial message initial à afficher
|
|||
|
|
*/
|
|||
|
|
public TurnView(String initial) {
|
|||
|
|
setBackground(new Color(220,220,220));
|
|||
|
|
|
|||
|
|
text = new JLabel(initial);
|
|||
|
|
text.setFont(new Font("Arial", Font.BOLD, 20));
|
|||
|
|
|
|||
|
|
add(text);
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
/**
|
|||
|
|
* Met à jour le texte affichant le joueur courant.
|
|||
|
|
*
|
|||
|
|
* @param s message à afficher
|
|||
|
|
*/
|
|||
|
|
public void setTurn(String s) {
|
|||
|
|
text.setText(s);
|
|||
|
|
}
|
|||
|
|
}
|