koala.dynamicjava.gui
Class Main

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Window
                    |
                    +--java.awt.Frame
                          |
                          +--javax.swing.JFrame
                                |
                                +--koala.dynamicjava.gui.Main
All Implemented Interfaces:
javax.accessibility.Accessible, ActionMap, java.awt.image.ImageObserver, java.awt.MenuContainer, javax.swing.RootPaneContainer, java.io.Serializable, javax.swing.WindowConstants

public class Main
extends javax.swing.JFrame
implements ActionMap

A Graphical User Interface for DynamicJava

See Also:
Serialized Form

Inner Class Summary
protected  class Main.AboutAction
          Pop the About dialog
protected  class Main.ClearAction
          To clear the output
protected  class Main.EditorCaretListener
          To listen to the editor caret
protected  class Main.EvalAction
          To evaluate the content of the buffer
protected  class Main.EvalSelectionAction
          To evaluate the content of the selection
protected  class Main.ExitAction
          To exit the application
protected  class Main.InterpreterThread
          To run the interpreter
protected  class Main.OptionsAction
          To pop the Options dialog
protected  class Main.ReinitAction
          Reinitializes the interpreter
protected  class Main.ScrollBarModelChangeListener
          To listen to the changes in the output area vertical scroll bar model
protected  class Main.StopAction
          To stop the interpreter thread
 
Inner classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Inner classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Inner classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Inner classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Inner classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent
 
Field Summary
static java.lang.String ABOUT_ACTION
           
protected static java.util.ResourceBundle bundle
          The resource bundle
static java.lang.String CLEAR_ACTION
           
static java.lang.String COPY_ACTION
           
static java.lang.String CUT_ACTION
           
protected  Editor editor
          The editor
protected  java.io.PrintStream err
          The current error stream
static java.lang.String EVAL_ACTION
           
static java.lang.String EVAL_S_ACTION
           
protected  Main.EvalAction evalAction
          The evaluator
protected  Main.EvalSelectionAction evalSelection
          The selection evaluator
static java.lang.String EXIT_ACTION
           
protected static int instances
          The number of instances of this class
protected  Interpreter interpreter
          The DynamicJava current interpreter
protected  boolean isRunning
          Is the interpreter running?
protected  java.util.Map listeners
          The map that contains the listeners
static java.lang.String OPEN_ACTION
           
protected  OptionsDialog options
          The options dialog
static java.lang.String OPTIONS_ACTION
           
protected  OptionsDialog.OptionSet optionSet
          The object used to store the options
protected  java.io.PrintStream out
          The current output stream
protected  javax.swing.JTextArea output
          The text area used to display the output
static java.lang.String PASTE_ACTION
           
static java.lang.String REDO_ACTION
           
static java.lang.String REINIT_ACTION
           
protected static java.lang.String RESOURCE
          The resource file name
protected static ResourceManager rManager
          The resource manager
static java.lang.String SAVE_ACTION
           
static java.lang.String SAVE_AS_ACTION
           
protected  javax.swing.BoundedRangeModel scrollBarModel
          The output area vertical scroll bar model
protected  int selectionEnd
          The current selection end
protected  int selectionStart
          The current selection start
protected  StatusBar status
          The status bar
static java.lang.String STOP_ACTION
           
protected  Main.StopAction stopAction
          The stop action
protected  java.io.PrintStream textComponentStream
          The text component stream
protected  java.lang.Thread thread
          The current interpreter thread
static java.lang.String UNDO_ACTION
           
 
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, 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 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
Main()
          Creates the interface
 
Method Summary
protected  void applyOptions()
          Applies the options
protected  Interpreter createInterpreter()
          Creates a new interpreter
protected  void exit()
          Called when the interface exits
 javax.swing.Action getAction(java.lang.String key)
          Returns the action associated with the given string or null on error
protected  int getCurrentLine(int p)
          Returns the line number that match the given position
 Editor getEditor()
          Returns the editor
 OptionsDialog.OptionSet getOptions()
          Gets the options
 OptionsDialog getOptionsDialog()
          Returns the options dialog
 javax.swing.JTextArea getOutputArea()
          Returns the output area
 void loadOptions()
          Loads the options
static void main(java.lang.String[] args)
          The entry point of the program
protected  void reinitializeInterpreter()
          Reinitializes the interpreter
protected  void restoreOptions()
          Restores the options
 void saveOptions()
          Saves the options to System.getProperty("user.home") + "/.djava/options"
 void setOptions(OptionsDialog.OptionSet opt)
          Sets the options
protected  java.lang.String stringToJavaString(java.lang.String s)
          translates a string to a java source string
 
Methods inherited from class javax.swing.JFrame
addImpl, createRootPane, frameInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getJMenuBar, getLayeredPane, getRootPane, isRootPaneCheckingEnabled, paramString, processKeyEvent, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getFrames, getIconImage, getMenuBar, getState, getTitle, isResizable, remove, removeNotify, setCursor, setIconImage, setMenuBar, setResizable, setState, setTitle
 
Methods inherited from class java.awt.Window
addWindowListener, applyResourceBundle, applyResourceBundle, dispose, getFocusOwner, getGraphicsConfiguration, getInputContext, getListeners, getLocale, getOwnedWindows, getOwner, getToolkit, getWarningString, hide, isShowing, pack, postEvent, processEvent, removeWindowListener, setCursor, show, toBack, toFront
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFont, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputMethodRequests, getLocation, getLocation, getLocationOnScreen, getName, getParent, getPeer, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isDisplayable, isDoubleBuffered, isEnabled, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseMotionEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, 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
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

OPEN_ACTION

public static final java.lang.String OPEN_ACTION

SAVE_ACTION

public static final java.lang.String SAVE_ACTION

SAVE_AS_ACTION

public static final java.lang.String SAVE_AS_ACTION

EXIT_ACTION

public static final java.lang.String EXIT_ACTION

UNDO_ACTION

public static final java.lang.String UNDO_ACTION

REDO_ACTION

public static final java.lang.String REDO_ACTION

CUT_ACTION

public static final java.lang.String CUT_ACTION

COPY_ACTION

public static final java.lang.String COPY_ACTION

PASTE_ACTION

public static final java.lang.String PASTE_ACTION

CLEAR_ACTION

public static final java.lang.String CLEAR_ACTION

OPTIONS_ACTION

public static final java.lang.String OPTIONS_ACTION

EVAL_ACTION

public static final java.lang.String EVAL_ACTION

EVAL_S_ACTION

public static final java.lang.String EVAL_S_ACTION

STOP_ACTION

public static final java.lang.String STOP_ACTION

REINIT_ACTION

public static final java.lang.String REINIT_ACTION

ABOUT_ACTION

public static final java.lang.String ABOUT_ACTION

instances

protected static int instances
The number of instances of this class

RESOURCE

protected static final java.lang.String RESOURCE
The resource file name

bundle

protected static java.util.ResourceBundle bundle
The resource bundle

rManager

protected static ResourceManager rManager
The resource manager

editor

protected Editor editor
The editor

output

protected javax.swing.JTextArea output
The text area used to display the output

scrollBarModel

protected javax.swing.BoundedRangeModel scrollBarModel
The output area vertical scroll bar model

status

protected StatusBar status
The status bar

options

protected OptionsDialog options
The options dialog

interpreter

protected Interpreter interpreter
The DynamicJava current interpreter

selectionStart

protected int selectionStart
The current selection start

selectionEnd

protected int selectionEnd
The current selection end

evalAction

protected Main.EvalAction evalAction
The evaluator

evalSelection

protected Main.EvalSelectionAction evalSelection
The selection evaluator

stopAction

protected Main.StopAction stopAction
The stop action

thread

protected java.lang.Thread thread
The current interpreter thread

isRunning

protected boolean isRunning
Is the interpreter running?

optionSet

protected OptionsDialog.OptionSet optionSet
The object used to store the options

textComponentStream

protected java.io.PrintStream textComponentStream
The text component stream

out

protected java.io.PrintStream out
The current output stream

err

protected java.io.PrintStream err
The current error stream

listeners

protected java.util.Map listeners
The map that contains the listeners
Constructor Detail

Main

public Main()
Creates the interface
Method Detail

main

public static void main(java.lang.String[] args)
The entry point of the program

setOptions

public void setOptions(OptionsDialog.OptionSet opt)
Sets the options

getOptions

public OptionsDialog.OptionSet getOptions()
Gets the options

saveOptions

public void saveOptions()
                 throws java.io.IOException
Saves the options to System.getProperty("user.home") + "/.djava/options"

stringToJavaString

protected java.lang.String stringToJavaString(java.lang.String s)
translates a string to a java source string

loadOptions

public void loadOptions()
Loads the options

getOptionsDialog

public OptionsDialog getOptionsDialog()
Returns the options dialog

getEditor

public Editor getEditor()
Returns the editor

getOutputArea

public javax.swing.JTextArea getOutputArea()
Returns the output area

exit

protected void exit()
Called when the interface exits

reinitializeInterpreter

protected void reinitializeInterpreter()
Reinitializes the interpreter

applyOptions

protected void applyOptions()
Applies the options

getCurrentLine

protected int getCurrentLine(int p)
Returns the line number that match the given position
Parameters:
p - a position

restoreOptions

protected void restoreOptions()
Restores the options

createInterpreter

protected Interpreter createInterpreter()
Creates a new interpreter

getAction

public javax.swing.Action getAction(java.lang.String key)
                             throws MissingListenerException
Returns the action associated with the given string or null on error
Specified by:
getAction in interface ActionMap
Parameters:
key - the key mapped with the action to get
Throws:
MissingListenerException - if the action is not found


Copyright © 2001 Stephane Hillion. All Rights Reserved.