Environment Plotter

Class EnvPlotterGUI

EnvPlotterGUI

public class EnvPlotterGUI

Environment-Based Applications:
The EnvPlotterGUI class provides the graphical user interface for a program that draws in an environment by placing color blocks in its cells.

Version:
1 January 2003

Field Summary
protected static java.awt.Color BACKGROUND_COLOR
           
protected  ColorChoiceDDMenu backgroundColorMenu
           
protected  ColorChoiceDDMenu drawingColorMenu
           
protected  java.util.List drawingMethods
           
protected static int ENV_COLS
           
protected static int ENV_ROWS
           
protected  EnvChoiceDialog envChoiceDialog
           
protected static java.awt.Color HIGHLIGHT_COLOR
           
protected static int MIN_CELL_SIZE
           
protected  EnvPlotter plotter
           
 
Constructor Summary
EnvPlotterGUI(java.lang.String title, int viewingWidth, int viewingHeight, int maxDelayMSecs, int minDelayMsecs)
          Constructs the graphical user interface for the Environment Plotter program.
 
Method Summary
protected  void defineContent(java.awt.Color bgColor, int viewingWidth, int viewingHeight, int minCellSize)
          Defines contents of main window panel.
protected  void draw(java.lang.String buttonLabel)
          Draws according to button pressed (called by action listener).
protected  java.lang.reflect.Method getDrawingMethod(java.lang.String buttonLabel)
          Gets the EnvPlotter drawing method associated with the specified button label.
protected  void getDrawingMethods()
          Builds a list of drawing methods that can be used by drawing buttons.
protected  java.awt.Component makeColorChooserPanel()
          Provides Color tools for choosing background color and drawing color.
protected  java.awt.Component makeControlPanel()
          Creates the control panel.
protected  java.awt.Component makeDrawingButtons()
          Creates a panel containing the drawing buttons based on the methods provided in the EnvPlotter class.
protected  void newEnv()
          Creates a new environment.
protected  void resetEnv()
          Resets the environment.
protected  void setBackground()
          Changes the background color.
 

Field Detail

ENV_ROWS

protected static final int ENV_ROWS

ENV_COLS

protected static final int ENV_COLS

BACKGROUND_COLOR

protected static final java.awt.Color BACKGROUND_COLOR

HIGHLIGHT_COLOR

protected static final java.awt.Color HIGHLIGHT_COLOR

MIN_CELL_SIZE

protected static final int MIN_CELL_SIZE

envChoiceDialog

protected EnvChoiceDialog envChoiceDialog

backgroundColorMenu

protected ColorChoiceDDMenu backgroundColorMenu

drawingColorMenu

protected ColorChoiceDDMenu drawingColorMenu

plotter

protected EnvPlotter plotter

drawingMethods

protected java.util.List drawingMethods
Constructor Detail

EnvPlotterGUI

public EnvPlotterGUI(java.lang.String title,
                     int viewingWidth,
                     int viewingHeight,
                     int maxDelayMSecs,
                     int minDelayMsecs)
Constructs the graphical user interface for the Environment Plotter program.
Parameters:
title - frame title
viewingWidth - the width of the viewing area
viewingHeight - the height of the viewing area
maxDelayMsecs - longest delay value for slider, in milliseconds
minDelayMsecs - shortest delay value for slider, in milliseconds
Method Detail

getDrawingMethods

protected void getDrawingMethods()
Builds a list of drawing methods that can be used by drawing buttons.

defineContent

protected void defineContent(java.awt.Color bgColor,
                             int viewingWidth,
                             int viewingHeight,
                             int minCellSize)
Defines contents of main window panel. Should be redefined in subclasses that require panels other than (or in addition to) a control panel and a display.
Parameters:
backgroundColor - color to paint background of environment
viewingWidth - the width of the viewing area
viewingHeight - the height of the viewing area
minCellSize - minimum environment cell side length

makeControlPanel

protected java.awt.Component makeControlPanel()
Creates the control panel.

newEnv

protected void newEnv()
Creates a new environment.

resetEnv

protected void resetEnv()
Resets the environment.

makeColorChooserPanel

protected java.awt.Component makeColorChooserPanel()
Provides Color tools for choosing background color and drawing color.

setBackground

protected void setBackground()
Changes the background color.

makeDrawingButtons

protected java.awt.Component makeDrawingButtons()
Creates a panel containing the drawing buttons based on the methods provided in the EnvPlotter class.

draw

protected void draw(java.lang.String buttonLabel)
Draws according to button pressed (called by action listener).
Parameters:
buttonLabel - the label on the button pressed

getDrawingMethod

protected java.lang.reflect.Method getDrawingMethod(java.lang.String buttonLabel)
Gets the EnvPlotter drawing method associated with the specified button label.
Parameters:
buttonLabel - the label on the button pressed

Environment Plotter