Package mastermind.gui.panels
Class CodeInput
java.lang.Object
mastermind.gui.panels.CodeInput
Panel for the user to input the code.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addActionListener
(Consumer<List<Integer>> onCodeModified) Listener is invoked after every modification to the code.Draws the buttons for the user to input the code.
-
Constructor Details
-
CodeInput
public CodeInput()Constructs the CodeInput panel. Initializes the panel but does not draw the buttons yet.
-
-
Method Details
-
drawButtons
Draws the buttons for the user to input the code. This method creates and arranges the buttons on a JPanel.- Returns:
- JPanel containing the buttons.
-
addActionListener
Listener is invoked after every modification to the code. This allows the application to react to changes in the user's input.- Parameters:
onCodeModified
- Consumer to be invoked with the code after modification. The code is represented as a list of integers, where each integer represents a color. SeeCode.Color
for mapping of integers to colors.
-