edu.princeton.repeatedgames.rgsolve.components
Class RGGui

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Window
              extended by java.awt.Frame
                  extended by javax.swing.JFrame
                      extended by edu.princeton.repeatedgames.rgsolve.components.RGGui
All Implemented Interfaces:
RGSolveProgressUpdater, java.awt.event.ActionListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public final class RGGui
extends javax.swing.JFrame
implements java.awt.event.ActionListener, RGSolveProgressUpdater, java.awt.event.WindowListener, java.io.Serializable

See Also:
Serialized Form

Nested Class Summary
static class RGGui.RgsolveMenuItem
           
 
Nested classes/interfaces inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes/interfaces inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes/interfaces inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 javax.swing.JMenuItem ABOUT
           
 javax.swing.JMenuItem ALL_LH
           
(package private)  boolean appletIsPoppedOut
           
 javax.swing.JMenuItem ARMS_RACE
           
 javax.swing.JMenuItem AS_EXAMPLE_1
           
 javax.swing.JMenuItem AS_EXAMPLE_2
           
 javax.swing.JMenuItem BATTLE_OF_THE_SEXES
           
 javax.swing.JMenuItem BERTRAND_DUOPOLY
           
private static java.lang.String BERTRAND_EXAMPLE
           
static int BIG_GAME_DIMENSION
           
 javax.swing.JMenuItem COURNOT_DUOPOLY
           
(package private)  java.lang.String curFileExt
           
(package private)  java.lang.String curFileName
           
 javax.swing.JMenuItem EXIT
           
 javax.swing.JMenuItem FICT_PLAY
           
(package private) static java.lang.String frameTitle
           
(package private)  GameComponents_new gameComp
           
 javax.swing.JMenuItem GET_BR
           
 javax.swing.JMenuItem GET_IESDS
           
 javax.swing.JMenuItem GET_PSNE
           
 javax.swing.JMenuItem GRAB_THE_DOLLAR
           
(package private)  RGGui gui_reference
           
 javax.swing.JMenuItem HAWK_DOVE
           
 javax.swing.JMenuItem HELP
           
static java.lang.String help_file
           
(package private)  boolean isApplet
           
 javax.swing.JMenuItem KEEP_SOLVING
           
 javax.swing.JMenuItem LATEX_TABLE
           
 javax.swing.JMenuItem LATEX_VSTAR_EQNS
           
 javax.swing.JMenuItem LOAD_GAME
           
 javax.swing.JMenuItem LOAD_SOLN
           
(package private)  javax.swing.JSplitPane mainVertSplit
           
 javax.swing.JMenuItem MATHEMATICA
           
 javax.swing.JMenuItem MATLAB
           
 javax.swing.JMenuItem NEW_WINDOW
           
(package private)  javax.swing.JButton openAppletInFrame
           
static java.awt.Font optionFont
           
 javax.swing.JMenuItem POP_OUT_SOLUTION
           
 javax.swing.JMenuItem PRIS_DILEMMA
           
static int progBarMax
           
(package private)  javax.swing.JProgressBar progressBar
           
(package private)  javax.swing.JPanel ProgressPanel
           
(package private)  javax.swing.JSplitPane progSplitPane
           
 javax.swing.JTextArea progText
           
(package private)  javax.swing.JScrollPane progTextScroll
           
 javax.swing.JMenuItem RAND_NORM
           
 javax.swing.JMenuItem RAND_UNIFORM
           
 RGSolution rgSoln
           
static java.lang.String rgsolve_web
           
 RGSolveApplet rgsolveapplet
           
 javax.swing.JMenuItem RULE_GAME_WINDOW
           
 javax.swing.JMenuItem SAVE_AS_GAME
           
 javax.swing.JMenuItem SAVE_GAME
           
 javax.swing.JMenuItem SAVE_SOLN
           
private static long serialVersionUID
           
 javax.swing.JMenuItem SET_MAX_FRAC_CONVERGENTS
           
(package private)  SettingsPanel settingsPanel
           
 javax.swing.JMenuItem SHOW_V_STAR
           
 javax.swing.JMenuItem SINGLE_LH
           
 javax.swing.JMenuItem SMOOTH_BERTRAND
           
(package private)  javax.swing.JPanel solutionPanel
           
(package private)  javax.swing.JButton STOP
           
(package private)  javax.swing.JTabbedPane tabs
           
 javax.swing.JMenuItem TEXT_GAME_WINDOW
           
 java.awt.Container thisContainer
           
 javax.swing.JMenuBar thisMenu
           
(package private)  TopComponent topComp
           
(package private)  javax.swing.JPanel topProgPanel
           
 boolean wasStopped
           
 javax.swing.JMenuItem WEBSITE
           
 
Fields inherited from class javax.swing.JFrame
accessibleContext, EXIT_ON_CLOSE, rootPane, rootPaneCheckingEnabled
 
Fields inherited from class java.awt.Frame
CROSSHAIR_CURSOR, DEFAULT_CURSOR, E_RESIZE_CURSOR, HAND_CURSOR, ICONIFIED, MAXIMIZED_BOTH, MAXIMIZED_HORIZ, MAXIMIZED_VERT, MOVE_CURSOR, N_RESIZE_CURSOR, NE_RESIZE_CURSOR, NORMAL, NW_RESIZE_CURSOR, S_RESIZE_CURSOR, SE_RESIZE_CURSOR, SW_RESIZE_CURSOR, TEXT_CURSOR, W_RESIZE_CURSOR, WAIT_CURSOR
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface edu.princeton.repeatedgames.rgsolve.RGSolveProgressUpdater
statusPrinter
 
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, HIDE_ON_CLOSE
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
RGGui(boolean isApplet, boolean suppressSplash)
           
RGGui(RGSolveApplet rgsolveapplet, boolean isApplet, boolean suppressSplash)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void clearProgress()
          clears the progress update location
private  javax.swing.JMenuBar get_J_Menu_Bar()
           
private  void getProgressPanel()
           
 void getSpecialGame(int gameType)
           
static void main(java.lang.String[] ars)
           
static void openWebpage(java.net.URI uri)
           
static void openWebpage(java.net.URL url)
           
 void printProgress(java.lang.String progressString)
          Prints progressString to wherever the GUI is displaying progress updates
 void setProgress(int iter, int maxIter)
          Sets the state of the solver into the GUI
(package private) static void showVStarInformation(RGSolution rgSoln, java.lang.String curFileName)
           
private  void solve(Point[] W0, Point punishment)
           
private  void triggerExit()
           
 boolean wasStopped()
          returns whether the solver thread has been stopped by the GUI and the algorithm should cease
 void windowActivated(java.awt.event.WindowEvent e)
           
 void windowClosed(java.awt.event.WindowEvent e)
           
 void windowClosing(java.awt.event.WindowEvent e)
           
 void windowDeactivated(java.awt.event.WindowEvent e)
           
 void windowDeiconified(java.awt.event.WindowEvent e)
           
 void windowIconified(java.awt.event.WindowEvent e)
           
 void windowOpened(java.awt.event.WindowEvent e)
           
private  java.io.File writeBertrandExample()
           
private  java.io.File writeHelpFile()
           
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
 
Methods inherited from class java.awt.Frame
addNotify, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setMaximizedBounds, setMenuBar, setResizable, setState, setTitle, setUndecorated
 
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getGraphicsConfiguration, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOwnedWindows, getOwner, getOwnerlessWindows, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, hide, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isShowing, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImages, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setVisible, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resize, resize, setBackground, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

rgsolveapplet

public RGSolveApplet rgsolveapplet

thisMenu

public javax.swing.JMenuBar thisMenu

thisContainer

public java.awt.Container thisContainer

openAppletInFrame

javax.swing.JButton openAppletInFrame

appletIsPoppedOut

boolean appletIsPoppedOut

HELP

public javax.swing.JMenuItem HELP

ABOUT

public javax.swing.JMenuItem ABOUT

WEBSITE

public javax.swing.JMenuItem WEBSITE

SAVE_GAME

public javax.swing.JMenuItem SAVE_GAME

SAVE_AS_GAME

public javax.swing.JMenuItem SAVE_AS_GAME

LOAD_GAME

public javax.swing.JMenuItem LOAD_GAME

NEW_WINDOW

public javax.swing.JMenuItem NEW_WINDOW

TEXT_GAME_WINDOW

public javax.swing.JMenuItem TEXT_GAME_WINDOW

RULE_GAME_WINDOW

public javax.swing.JMenuItem RULE_GAME_WINDOW

COURNOT_DUOPOLY

public javax.swing.JMenuItem COURNOT_DUOPOLY

BERTRAND_DUOPOLY

public javax.swing.JMenuItem BERTRAND_DUOPOLY

RAND_NORM

public javax.swing.JMenuItem RAND_NORM

RAND_UNIFORM

public javax.swing.JMenuItem RAND_UNIFORM

PRIS_DILEMMA

public javax.swing.JMenuItem PRIS_DILEMMA

HAWK_DOVE

public javax.swing.JMenuItem HAWK_DOVE

SMOOTH_BERTRAND

public javax.swing.JMenuItem SMOOTH_BERTRAND

GRAB_THE_DOLLAR

public javax.swing.JMenuItem GRAB_THE_DOLLAR

BATTLE_OF_THE_SEXES

public javax.swing.JMenuItem BATTLE_OF_THE_SEXES

ARMS_RACE

public javax.swing.JMenuItem ARMS_RACE

AS_EXAMPLE_1

public javax.swing.JMenuItem AS_EXAMPLE_1

AS_EXAMPLE_2

public javax.swing.JMenuItem AS_EXAMPLE_2

POP_OUT_SOLUTION

public javax.swing.JMenuItem POP_OUT_SOLUTION

KEEP_SOLVING

public javax.swing.JMenuItem KEEP_SOLVING

MATHEMATICA

public javax.swing.JMenuItem MATHEMATICA

MATLAB

public javax.swing.JMenuItem MATLAB

LATEX_VSTAR_EQNS

public javax.swing.JMenuItem LATEX_VSTAR_EQNS

SET_MAX_FRAC_CONVERGENTS

public javax.swing.JMenuItem SET_MAX_FRAC_CONVERGENTS

SAVE_SOLN

public javax.swing.JMenuItem SAVE_SOLN

LOAD_SOLN

public javax.swing.JMenuItem LOAD_SOLN

EXIT

public javax.swing.JMenuItem EXIT

LATEX_TABLE

public javax.swing.JMenuItem LATEX_TABLE

SHOW_V_STAR

public javax.swing.JMenuItem SHOW_V_STAR

GET_PSNE

public javax.swing.JMenuItem GET_PSNE

GET_BR

public javax.swing.JMenuItem GET_BR

GET_IESDS

public javax.swing.JMenuItem GET_IESDS

SINGLE_LH

public javax.swing.JMenuItem SINGLE_LH

ALL_LH

public javax.swing.JMenuItem ALL_LH

FICT_PLAY

public javax.swing.JMenuItem FICT_PLAY

mainVertSplit

javax.swing.JSplitPane mainVertSplit

curFileName

java.lang.String curFileName

curFileExt

java.lang.String curFileExt

rgSoln

public RGSolution rgSoln

frameTitle

static final java.lang.String frameTitle
See Also:
Constant Field Values

help_file

public static final java.lang.String help_file
See Also:
Constant Field Values

rgsolve_web

public static final java.lang.String rgsolve_web
See Also:
Constant Field Values

optionFont

public static final java.awt.Font optionFont

isApplet

boolean isApplet

settingsPanel

SettingsPanel settingsPanel

topComp

TopComponent topComp

gameComp

GameComponents_new gameComp

tabs

javax.swing.JTabbedPane tabs

progressBar

javax.swing.JProgressBar progressBar

ProgressPanel

javax.swing.JPanel ProgressPanel

STOP

javax.swing.JButton STOP

progSplitPane

javax.swing.JSplitPane progSplitPane

progBarMax

public static final int progBarMax
See Also:
Constant Field Values

BIG_GAME_DIMENSION

public static final int BIG_GAME_DIMENSION
See Also:
Constant Field Values

BERTRAND_EXAMPLE

private static final java.lang.String BERTRAND_EXAMPLE
See Also:
Constant Field Values

wasStopped

public boolean wasStopped

topProgPanel

javax.swing.JPanel topProgPanel

solutionPanel

javax.swing.JPanel solutionPanel

progText

public javax.swing.JTextArea progText

progTextScroll

javax.swing.JScrollPane progTextScroll

gui_reference

RGGui gui_reference
Constructor Detail

RGGui

public RGGui(RGSolveApplet rgsolveapplet,
             boolean isApplet,
             boolean suppressSplash)

RGGui

public RGGui(boolean isApplet,
             boolean suppressSplash)
Method Detail

main

public static void main(java.lang.String[] ars)

get_J_Menu_Bar

private javax.swing.JMenuBar get_J_Menu_Bar()

openWebpage

public static void openWebpage(java.net.URI uri)

openWebpage

public static void openWebpage(java.net.URL url)

getSpecialGame

public void getSpecialGame(int gameType)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

solve

private void solve(Point[] W0,
                   Point punishment)

triggerExit

private void triggerExit()

getProgressPanel

private void getProgressPanel()

wasStopped

public boolean wasStopped()
Description copied from interface: RGSolveProgressUpdater
returns whether the solver thread has been stopped by the GUI and the algorithm should cease

Specified by:
wasStopped in interface RGSolveProgressUpdater
Returns:
if the algorithm has been stopped

setProgress

public void setProgress(int iter,
                        int maxIter)
Description copied from interface: RGSolveProgressUpdater
Sets the state of the solver into the GUI

Specified by:
setProgress in interface RGSolveProgressUpdater
Parameters:
iter - the current iterations
maxIter - the max no. of iterations

printProgress

public void printProgress(java.lang.String progressString)
Description copied from interface: RGSolveProgressUpdater
Prints progressString to wherever the GUI is displaying progress updates

Specified by:
printProgress in interface RGSolveProgressUpdater

clearProgress

public void clearProgress()
Description copied from interface: RGSolveProgressUpdater
clears the progress update location

Specified by:
clearProgress in interface RGSolveProgressUpdater

windowClosing

public void windowClosing(java.awt.event.WindowEvent e)
Specified by:
windowClosing in interface java.awt.event.WindowListener

windowOpened

public void windowOpened(java.awt.event.WindowEvent e)
Specified by:
windowOpened in interface java.awt.event.WindowListener

windowClosed

public void windowClosed(java.awt.event.WindowEvent e)
Specified by:
windowClosed in interface java.awt.event.WindowListener

windowIconified

public void windowIconified(java.awt.event.WindowEvent e)
Specified by:
windowIconified in interface java.awt.event.WindowListener

windowDeiconified

public void windowDeiconified(java.awt.event.WindowEvent e)
Specified by:
windowDeiconified in interface java.awt.event.WindowListener

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Specified by:
windowActivated in interface java.awt.event.WindowListener

windowDeactivated

public void windowDeactivated(java.awt.event.WindowEvent e)
Specified by:
windowDeactivated in interface java.awt.event.WindowListener

writeHelpFile

private java.io.File writeHelpFile()

writeBertrandExample

private java.io.File writeBertrandExample()

showVStarInformation

static void showVStarInformation(RGSolution rgSoln,
                                 java.lang.String curFileName)