Class ExampleUI<T extends Algorithm>

Type Parameters:
T - the type of algorithm
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, RootPaneContainer, WindowConstants, ControllerListener

public abstract class ExampleUI<T extends Algorithm> extends JFrame implements ControllerListener
Abstract class for building example GUIs. This abstract class handles running the algorithm in a background thread, invoking update(Algorithm, int) after each iteration, and stopping when the window is closed.
See Also:
  • Constructor Details

    • ExampleUI

      public ExampleUI(String title, T algorithm)
      Constructs a new example GUI.
      Parameters:
      title - the title of this window
      algorithm - the algorithm
  • Method Details

    • start

      public void start()
      Triggers the start of this example.
    • update

      public abstract void update(T algorithm, int iteration)
      Invoked on the event dispatch thread to update the GUI after each iteration.
      Parameters:
      algorithm - the algorithm
      iteration - the current iteration
    • controllerStateChanged

      public void controllerStateChanged(ControllerEvent event)
      Description copied from interface: ControllerListener
      Invoked by the controller to indicate its state changed.
      Specified by:
      controllerStateChanged in interface ControllerListener
      Parameters:
      event - details of the controller event