ajout des actions accélérer/rallentir et correction de la condition de dérapage (>=) (Car)

This commit is contained in:
Chahrazad650
2025-12-13 08:00:08 +01:00
parent c222ec3c8d
commit bf41c6269e
2 changed files with 46 additions and 2 deletions

View File

@@ -54,7 +54,10 @@ public class Dashboard extends GameView {
*/
public Dashboard(Game game, Car car, String title, int width, int height, int x, int y) {
super(game, "Dashboard: " + title, width, height, x, y);
this.car = car;
// Fond de la fenêtre = couleur de la voiture
frame.setBackground(car.getColor());
@@ -64,12 +67,15 @@ public class Dashboard extends GameView {
centerPanel.add(infoLabel);
centerPanel.add(stateLabel);
centerPanel.add(messageLabel);
//pour rendre le panel transparent
centerPanel.setOpaque(false);
// ----- Partie boutons -----
JPanel buttonPanel = new JPanel(new GridLayout(1, 3));
buttonPanel.add(decelerateButton);
buttonPanel.add(pauseButton);
buttonPanel.add(accelerateButton);
setLayout(new BorderLayout());
add(centerPanel, BorderLayout.CENTER);