Class UI

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class UI extends JPanel
This class takes care of all the graphics to display a certain state. Initially, you do not need to modify (or event understand) this class in Phase 1. You will learn more about GUIs in Period 2, in the Introduction to Computer Science 2 course.
See Also:
  • Field Details

    • window

      public JFrame window
  • Constructor Details

    • UI

      public UI(int x, int y, int _size)
      Constructor for the GUI. Sets everything up
      Parameters:
      x - x position of the GUI
      y - y position of the GUI
      _size - size of the GUI
  • Method Details

    • paintComponent

      public void paintComponent(Graphics g)
      This function is called BY THE SYSTEM if required for a new frame, uses the state stored by the UI class.
      Overrides:
      paintComponent in class JComponent
    • setState

      public void setState(int[][] _state)
      This function should be called to update the displayed state (makes a copy)
      Parameters:
      _state - information about the new state of the GUI