Skip to content
This repository has been archived by the owner on Jan 18, 2025. It is now read-only.

Commit

Permalink
Make HomeButton static
Browse files Browse the repository at this point in the history
Closes #23
  • Loading branch information
powersagitar committed Jan 9, 2025
1 parent b476a8f commit 9ba0492
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,25 @@
import javax.swing.*;
import mastermind.gui.scenes.GameModeSelector;
import mastermind.gui.scenes.Scene;

public class HomeButton {
final private JButton homeButton;
final private JPanel buttonPanel = new JPanel();
private final static JButton homeButton;
private final static JPanel buttonPanel;

public HomeButton() {
static {
homeButton = new JButton("Home");
buttonPanel = new JPanel();
buttonPanel.add(homeButton);
}

public void registerHomeHandlers() {
homeButton.addActionListener( event -> {
public static void registerHomeHandlers() {
homeButton.addActionListener(event -> {
final JFrame gameModeSelector = Scene.createDefaultScene();
new GameModeSelector(gameModeSelector);
});
}

public void drawHomeButton(final JFrame frame) {
public static void drawHomeButton(final JFrame frame) {
frame.add(buttonPanel);
}


}

0 comments on commit 9ba0492

Please sign in to comment.