Class CodeInput

java.lang.Object
mastermind.gui.panels.CodeInput

public class CodeInput extends Object
Panel 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

      public JPanel 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

      public void addActionListener(Consumer<List<Integer>> onCodeModified)
      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. See Code.Color for mapping of integers to colors.