Ajout d'effet sonnore dans le menu principal)
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package fr.monkhanny.dorfromantik.gui;
|
||||
|
||||
import fr.monkhanny.dorfromantik.Options;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
public class ButtonHoverAnimator {
|
||||
|
||||
private final JButton button;
|
||||
private final Color originalColor;
|
||||
private final Font originalFont;
|
||||
private Timer animationTimer;
|
||||
private float currentScale = 1.0f;
|
||||
|
||||
public ButtonHoverAnimator(JButton button) {
|
||||
this.button = button;
|
||||
this.originalColor = button.getForeground();
|
||||
this.originalFont = button.getFont();
|
||||
}
|
||||
|
||||
public void startAnimation(boolean entering) {
|
||||
if (animationTimer != null && animationTimer.isRunning()) {
|
||||
animationTimer.stop();
|
||||
}
|
||||
|
||||
// Create a new ActionListener instance
|
||||
animationTimer = new Timer(Options.ANIMATION_DELAY, new ButtonHoverAnimationListener(entering, button, originalColor, originalFont));
|
||||
animationTimer.start();
|
||||
}
|
||||
}
|
@@ -33,13 +33,13 @@ public class ButtonPanel extends JPanel {
|
||||
|
||||
// Ajouter les boutons au panneau
|
||||
this.add(newGameButton);
|
||||
this.add(Box.createVerticalStrut(20)); // Espace entre les boutons
|
||||
this.add(Box.createVerticalStrut(10)); // Espace entre les boutons
|
||||
this.add(continueGameButton);
|
||||
this.add(Box.createVerticalStrut(20));
|
||||
this.add(Box.createVerticalStrut(10));
|
||||
this.add(howToPlayButton);
|
||||
this.add(Box.createVerticalStrut(20));
|
||||
this.add(Box.createVerticalStrut(10));
|
||||
this.add(settingsButton);
|
||||
this.add(Box.createVerticalStrut(20));
|
||||
this.add(Box.createVerticalStrut(25));
|
||||
this.add(exitButton);
|
||||
|
||||
// Espacement extensible pour maintenir les icônes en bas
|
||||
|
Reference in New Issue
Block a user