Class AgentGUI

java.lang.Object
  |
  +--java.awt.event.WindowAdapter
        |
        +--AgentGUI

public class AgentGUI
extends java.awt.event.WindowAdapter
implements java.awt.event.ItemListener

Project: DECAF
Class: AgentGUI
Description: This class is meant to make Agent GUI creation easier.


Field Summary
private  java.lang.String agentName
           
private  java.util.Hashtable checks
           
private  javax.swing.JDesktopPane desktop
           
private  java.util.Hashtable frames
           
private  javax.swing.JCheckBoxMenuItem income
           
private  javax.swing.JInternalFrame incoming
           
private  int MAXX
           
private  int MAXY
           
private  javax.swing.JMenuBar menuBar
           
private  java.util.Hashtable scrolls
           
private  java.util.Hashtable textAreas
           
private  javax.swing.JMenu view
           
private  int winxy
           
 
Constructor Summary
AgentGUI(java.lang.String agentName)
          Constructor that takes only the name of the agent, and sets up a blank desktop.
AgentGUI(java.lang.String agentName, java.lang.String windows)
          Constructor to set up a desktop with text windows.
 
Method Summary
 void addMenu(javax.swing.JMenu menu)
          Add a menu to the menu bar.
 void itemStateChanged(java.awt.event.ItemEvent e)
          Listens to the check boxes in the view menu.
 void message(java.lang.String name, java.lang.String message)
          Prints a message to the specified text message window.
 void newWindow(javax.swing.JInternalFrame newframe)
          Insert a customized window onto the desktop.
 void newWindow(java.lang.String name)
          Insert a text message window on the desktop.
 void removeMenu(java.lang.String name)
          Remove a menu from the menu bar.
 void removeWindow(java.lang.String name)
          Remove a window from the desktop.
private  void setupDesktop()
           
private  void setupDesktop(java.lang.String windows)
           
private  void setupMenuBar()
           
 void windowClosing(java.awt.event.WindowEvent e)
          Sends a KQML shutdown message when the close button is pressed.
 
Methods inherited from class java.awt.event.WindowAdapter
windowActivated, windowClosed, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

MAXX

private int MAXX

MAXY

private int MAXY

agentName

private java.lang.String agentName

desktop

private javax.swing.JDesktopPane desktop

incoming

private javax.swing.JInternalFrame incoming

menuBar

private javax.swing.JMenuBar menuBar

view

private javax.swing.JMenu view

income

private javax.swing.JCheckBoxMenuItem income

frames

private java.util.Hashtable frames

textAreas

private java.util.Hashtable textAreas

scrolls

private java.util.Hashtable scrolls

checks

private java.util.Hashtable checks

winxy

private int winxy
Constructor Detail

AgentGUI

public AgentGUI(java.lang.String agentName)
Constructor that takes only the name of the agent, and sets up a blank desktop.
Parameters:
agentName - The name of the agent appears in the window title.

AgentGUI

public AgentGUI(java.lang.String agentName,
                java.lang.String windows)
Constructor to set up a desktop with text windows.
Parameters:
agentName - The name of the agent appears in the window title.
windows - A '|' separated list of window names.
Method Detail

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Sends a KQML shutdown message when the close button is pressed.
Overrides:
windowClosing in class java.awt.event.WindowAdapter
Parameters:
e - A window event.

setupDesktop

private void setupDesktop()

setupDesktop

private void setupDesktop(java.lang.String windows)

setupMenuBar

private void setupMenuBar()

addMenu

public void addMenu(javax.swing.JMenu menu)
Add a menu to the menu bar.
Parameters:
menu - The menu to be added.

removeMenu

public void removeMenu(java.lang.String name)
Remove a menu from the menu bar.
Parameters:
menu - The name of the menu to be removed.

removeWindow

public void removeWindow(java.lang.String name)
Remove a window from the desktop.
Parameters:
name - The name of the window to be removed.

newWindow

public void newWindow(javax.swing.JInternalFrame newframe)
Insert a customized window onto the desktop.
Parameters:
newframe - The frame to be added.

newWindow

public void newWindow(java.lang.String name)
Insert a text message window on the desktop.
Parameters:
name - The title of the window.

itemStateChanged

public void itemStateChanged(java.awt.event.ItemEvent e)
Listens to the check boxes in the view menu.
Specified by:
itemStateChanged in interface java.awt.event.ItemListener
Parameters:
e - An item event indicating a state change.

message

public void message(java.lang.String name,
                    java.lang.String message)
Prints a message to the specified text message window.
Parameters:
name - The name of the window.
message - The message to be displayed.