Package madkit.gui

Class AgentFrame

All Implemented Interfaces:
ImageObserver, MenuContainer, Printable, Serializable, Accessible, RootPaneContainer, WindowConstants, PrintableFrame

public class AgentFrame extends JFrame implements PrintableFrame
The default frame which is used for the agents in the GUI engine of MaDKit. Subclasses could be defined to obtain customized frames.
Since:
MaDKit 5.0.0.9
Version:
0.92
Author:
Fabien Michel
See Also:
  • Constructor Details

    • AgentFrame

      protected AgentFrame(AbstractAgent agent)
      TThis constructor is protected because this class should not be directly instantiated as it is used by the MaDKit GUI manager.
      Parameters:
      agent - the considered agent
  • Method Details

    • dispose

      public void dispose()
      Overrides:
      dispose in class Window
    • getLastSavedDimensionPreference

      public Dimension getLastSavedDimensionPreference()
    • getLastSavedLocationPreference

      public Point getLastSavedLocationPreference()
    • getLastSavedBackgroundPreference

      public Color getLastSavedBackgroundPreference()
    • restoreUIPreferences

      public void restoreUIPreferences()
    • createMenuBar

      public JMenuBar createMenuBar()
      Builds the menu bar that will be used for this frame. By default it creates a JMenuBar featuring:
      Returns:
      a menu bar
    • createJToolBar

      public JToolBar createJToolBar()
      Builds the tool bar that will be used. By default, it returns null so that there is no toll bar in the default agent frames.
      Returns:
      a tool bar
    • setLocation

      public void setLocation(int x, int y)
      Overrides:
      setLocation in class Window
    • setSize

      public void setSize(int width, int height)
      Overrides:
      setSize in class Window
    • pack

      public void pack()
      Overrides:
      pack in class Window
    • getAgent

      public AbstractAgent getAgent()
      Returns:
      the agent for which this frame has been created.
    • createAgentFrame

      public static AgentFrame createAgentFrame(AbstractAgent agent)
      Override to customize the agent frame that should be created by the GUI engine.
      Parameters:
      agent - the related agent
      Returns:
      the created frame
    • toString

      public String toString()
      Overrides:
      toString in class Component
    • getPrintableContainer

      public Container getPrintableContainer()
      Specified by:
      getPrintableContainer in interface PrintableFrame
    • setBackground

      public void setBackground(Color bgColor)
      Overrides:
      setBackground in class Frame