search
Class SearchFrame

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--search.SearchFrame

public class SearchFrame
extends javax.swing.JFrame
implements java.lang.Runnable

This is the frame for the application which demonstrates the five basic search algorithms: depth-first, breadth-first, iterated, best-first, and genetic.

See Also:
Serialized Form

Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AWTTreeLock
 
Field Summary
(package private)  javax.swing.JMenuItem AboutMenuItem
           
(package private)  javax.swing.JMenu AlgorithmMenu
           
static int BEST_FIRST
           
(package private)  javax.swing.JRadioButtonMenuItem BestFirstRadioButtonMenuItem
           
(package private)  javax.swing.JRadioButtonMenuItem BFSRadioButtonMenuItem
           
(package private)  java.awt.BorderLayout borderLayout1
           
(package private)  java.awt.BorderLayout borderLayout2
           
static int BREADTH_FIRST
           
(package private)  javax.swing.JMenuItem ClearMenuItem
           
static int DEPTH_FIRST
           
(package private)  javax.swing.JRadioButtonMenuItem DFSRadioButtonMenuItem
           
(package private)  javax.swing.JMenuItem ExitMenuItem
           
(package private)  javax.swing.JMenu FileMenu
           
(package private)  javax.swing.JTextField FitnessThresholdTextField
           
static int GENETIC_SEARCH
           
(package private)  javax.swing.JComboBox GeneticObjClassComboBox
           
(package private)  GeneticSearch geneticSearch
           
(package private)  javax.swing.JRadioButtonMenuItem GeneticSearchRadioButtonMenuItem
           
(package private)  javax.swing.JComboBox goalComboBox
           
(package private)  SearchGraph graph
           
(package private)  javax.swing.JMenu HelpMenu
           
static int ITERATED
           
(package private)  javax.swing.JRadioButtonMenuItem IteratedRadioButtonMenuItem
           
(package private)  javax.swing.JLabel jLabel1
           
(package private)  javax.swing.JLabel jLabel2
           
(package private)  javax.swing.JLabel jLabel3
           
(package private)  javax.swing.JLabel jLabel4
           
(package private)  javax.swing.JLabel jLabel5
           
(package private)  javax.swing.JLabel jLabel6
           
(package private)  javax.swing.JMenuBar jMenuBar1
           
(package private)  javax.swing.JPanel jPanel1
           
(package private)  javax.swing.JPanel jPanel2
           
(package private)  javax.swing.JScrollPane jScrollPane1
           
(package private)  javax.swing.JComboBox NumGenerationsComboBox
           
(package private)  javax.swing.JComboBox PopulationSizeComboBox
           
(package private)  javax.swing.ButtonGroup radioButtonGroup
           
(package private)  javax.swing.JComboBox startComboBox
           
(package private)  javax.swing.JMenuItem StartMenuItem
           
(package private)  javax.swing.JTextArea traceTextArea
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, icon, ICONIFIED, mbManagement, menuBar, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, ownedWindows, resizable, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, title, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Window
inputContext, OPENED, ownedWindowList, state, warningString, windowListener
 
Fields inherited from class java.awt.Container
component, containerListener, layoutMgr, ncomponents
 
Fields inherited from class java.awt.Component
actionListenerK, adjustmentListenerK, appContext, background, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, componentListener, componentListenerK, componentOrientation, containerListenerK, cursor, dropTarget, enabled, eventMask, focusListener, focusListenerK, font, foreground, hasFocus, height, incRate, inputMethodListener, inputMethodListenerK, isInc, isPacked, itemListenerK, keyListener, keyListenerK, LEFT_ALIGNMENT, locale, LOCK, minSize, mouseListener, mouseListenerK, mouseMotionListener, mouseMotionListenerK, newEventsOnly, ownedWindowK, parent, peer, peerFont, popups, prefSize, RIGHT_ALIGNMENT, textListenerK, TOP_ALIGNMENT, valid, visible, width, windowListenerK, x, y
 
Constructor Summary
SearchFrame()
          Constructs the frame for the search application.
 
Method Summary
(package private)  void AboutMenuItem_actionPerformed(java.awt.event.ActionEvent e)
          Displays the "About" dialog when the option is selected.
(package private)  void BestFirstRadioButtonMenuItem_actionPerformed(java.awt.event.ActionEvent e)
          Sets the search to BEST_FIRST when the best-first search radio button is selected.
(package private)  void BFSRadioButtonMenuItem_actionPerformed(java.awt.event.ActionEvent e)
          Sets the search to BREADTH_FIRST when the breadth-first search radio button is selected.
static SearchGraph buildTestGraph()
          Build a test graph of the cities in the midwestern United States.
(package private)  void ClearMenuItem_actionPerformed(java.awt.event.ActionEvent e)
          Clears the text box when CLEAR is selected.
(package private)  void DFSRadioButtonMenuItem_actionPerformed(java.awt.event.ActionEvent e)
          Sets the search to DEPTH_FIRST when the depth-first search radio button is selected.
(package private)  void ExitMenuItem_actionPerformed(java.awt.event.ActionEvent e)
          Ends the application when EXIT is selected.
(package private)  void GeneticSearchRadioButtonMenuItem_actionPerformed(java.awt.event.ActionEvent e)
          Sets the search to GENETIC_SEARCH when the genetic search radio button is selected.
(package private)  void IteratedRadioButtonMenuItem_actionPerformed(java.awt.event.ActionEvent e)
          Sets the search to ITERATED when the iterated search radio button is selected.
protected  void processWindowEvent(java.awt.event.WindowEvent e)
          Processes window events and is overridden to exit when window closes.
 void run()
          Runs the selected algorithm in a separate thread, writing some trace information into the the text area of the application window.
(package private)  void StartMenuItem_actionPerformed(java.awt.event.ActionEvent e)
          Starts a thread when START is selected.
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
, addNotify, addToFrameList, constructComponentName, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, postProcessKeyEvent, remove, removeFromFrameList, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addOwnedWindow, addWindowListener, applyResourceBundle, applyResourceBundle, connectOwnedWindow, dispatchEventImpl, dispose, eventEnabled, getFocusOwner, getInputContext, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, isActive, isShowing, nextFocus, pack, postEvent, postWindowEvent, preProcessKeyEvent, processEvent, removeOwnedWindow, removeWindowListener, setFocusOwner, show, toBack, toFront, transferFocus
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyOrientation, countComponents, deliverEvent, dispatchEventToSelf, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents_NoClientCode, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getMouseEventTarget, getPreferredSize, getWindow, insets, invalidate, invalidateTree, isAncestorOf, layout, lightweightPrint, list, list, locate, minimumSize, paint, paintComponents, postsOldMouseEvents, preferredSize, print, printComponents, processContainerEvent, proxyEnableEvents, proxyRequestFocus, remove, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, areInputMethodsEnabled, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont_NoClientCode, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getNativeContainer, getParent_NoClientCode, getParent, getPeer, getSize, getSize, getToolkitImpl, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, isEnabledImpl, isFocusTraversable, isLightweight, isOpaque, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

borderLayout1

java.awt.BorderLayout borderLayout1

jPanel1

javax.swing.JPanel jPanel1

jPanel2

javax.swing.JPanel jPanel2

jScrollPane1

javax.swing.JScrollPane jScrollPane1

traceTextArea

javax.swing.JTextArea traceTextArea

jLabel1

javax.swing.JLabel jLabel1

jLabel2

javax.swing.JLabel jLabel2

startComboBox

javax.swing.JComboBox startComboBox

goalComboBox

javax.swing.JComboBox goalComboBox

radioButtonGroup

javax.swing.ButtonGroup radioButtonGroup

borderLayout2

java.awt.BorderLayout borderLayout2

graph

SearchGraph graph

geneticSearch

GeneticSearch geneticSearch

jMenuBar1

javax.swing.JMenuBar jMenuBar1

FileMenu

javax.swing.JMenu FileMenu

StartMenuItem

javax.swing.JMenuItem StartMenuItem

ClearMenuItem

javax.swing.JMenuItem ClearMenuItem

ExitMenuItem

javax.swing.JMenuItem ExitMenuItem

AlgorithmMenu

javax.swing.JMenu AlgorithmMenu

HelpMenu

javax.swing.JMenu HelpMenu

AboutMenuItem

javax.swing.JMenuItem AboutMenuItem

DFSRadioButtonMenuItem

javax.swing.JRadioButtonMenuItem DFSRadioButtonMenuItem

BFSRadioButtonMenuItem

javax.swing.JRadioButtonMenuItem BFSRadioButtonMenuItem

IteratedRadioButtonMenuItem

javax.swing.JRadioButtonMenuItem IteratedRadioButtonMenuItem

BestFirstRadioButtonMenuItem

javax.swing.JRadioButtonMenuItem BestFirstRadioButtonMenuItem

GeneticSearchRadioButtonMenuItem

javax.swing.JRadioButtonMenuItem GeneticSearchRadioButtonMenuItem

jLabel3

javax.swing.JLabel jLabel3

jLabel4

javax.swing.JLabel jLabel4

GeneticObjClassComboBox

javax.swing.JComboBox GeneticObjClassComboBox

NumGenerationsComboBox

javax.swing.JComboBox NumGenerationsComboBox

jLabel5

javax.swing.JLabel jLabel5

PopulationSizeComboBox

javax.swing.JComboBox PopulationSizeComboBox

jLabel6

javax.swing.JLabel jLabel6

FitnessThresholdTextField

javax.swing.JTextField FitnessThresholdTextField

DEPTH_FIRST

public static final int DEPTH_FIRST

BREADTH_FIRST

public static final int BREADTH_FIRST

ITERATED

public static final int ITERATED

BEST_FIRST

public static final int BEST_FIRST

GENETIC_SEARCH

public static final int GENETIC_SEARCH
Constructor Detail

SearchFrame

public SearchFrame()
Constructs the frame for the search application.
Method Detail

processWindowEvent

protected void processWindowEvent(java.awt.event.WindowEvent e)
Processes window events and is overridden to exit when window closes.
Parameters:
e - the WindowEvent to be processed
Overrides:
processWindowEvent in class javax.swing.JFrame

buildTestGraph

public static SearchGraph buildTestGraph()
Build a test graph of the cities in the midwestern United States. The graph is created using SearchNodes and links.
Returns:
a graph of the cities in the midwest

DFSRadioButtonMenuItem_actionPerformed

void DFSRadioButtonMenuItem_actionPerformed(java.awt.event.ActionEvent e)
Sets the search to DEPTH_FIRST when the depth-first search radio button is selected.
Parameters:
e - the ActionEvent for the radio button

BFSRadioButtonMenuItem_actionPerformed

void BFSRadioButtonMenuItem_actionPerformed(java.awt.event.ActionEvent e)
Sets the search to BREADTH_FIRST when the breadth-first search radio button is selected.
Parameters:
e - the ActionEvent for the radio button

IteratedRadioButtonMenuItem_actionPerformed

void IteratedRadioButtonMenuItem_actionPerformed(java.awt.event.ActionEvent e)
Sets the search to ITERATED when the iterated search radio button is selected.
Parameters:
e - the ActionEvent for the radio button

BestFirstRadioButtonMenuItem_actionPerformed

void BestFirstRadioButtonMenuItem_actionPerformed(java.awt.event.ActionEvent e)
Sets the search to BEST_FIRST when the best-first search radio button is selected.
Parameters:
e - the ActionEvent for the radio button

GeneticSearchRadioButtonMenuItem_actionPerformed

void GeneticSearchRadioButtonMenuItem_actionPerformed(java.awt.event.ActionEvent e)
Sets the search to GENETIC_SEARCH when the genetic search radio button is selected.
Parameters:
e - the ActionEvent for the radio button

StartMenuItem_actionPerformed

void StartMenuItem_actionPerformed(java.awt.event.ActionEvent e)
Starts a thread when START is selected.
Parameters:
e - the ActionEvent for the selection

ClearMenuItem_actionPerformed

void ClearMenuItem_actionPerformed(java.awt.event.ActionEvent e)
Clears the text box when CLEAR is selected.
Parameters:
e - the ActionEvent for the selection

ExitMenuItem_actionPerformed

void ExitMenuItem_actionPerformed(java.awt.event.ActionEvent e)
Ends the application when EXIT is selected.
Parameters:
e - the ActionEvent for the selection

AboutMenuItem_actionPerformed

void AboutMenuItem_actionPerformed(java.awt.event.ActionEvent e)
Displays the "About" dialog when the option is selected.
Parameters:
e - the ActionEvent for the selection

run

public void run()
Runs the selected algorithm in a separate thread, writing some trace information into the the text area of the application window. If debug is set on, additional trace information will be displayed.
Specified by:
run in interface java.lang.Runnable