koala.dynamicjava.gui
Class Main

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Window
              extended byjava.awt.Frame
                  extended byjavax.swing.JFrame
                      extended bykoala.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

Nested 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
 
Nested classes inherited from class javax.swing.JFrame
javax.swing.JFrame.AccessibleJFrame
 
Nested classes inherited from class java.awt.Frame
java.awt.Frame.AccessibleAWTFrame
 
Nested classes inherited from class java.awt.Window
java.awt.Window.AccessibleAWTWindow
 
Nested classes inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
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, 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 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, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, update
 
Methods inherited from class java.awt.Frame
addNotify, finalize, getCursorType, getExtendedState, getFrames, getIconImage, getMaximizedBounds, getMenuBar, getState, getTitle, isResizable, isUndecorated, remove, removeNotify, setCursor, setExtendedState, setIconImage, 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, getInputContext, getListeners, getLocale, getMostRecentFocusOwner, getOwnedWindows, getOwner, getToolkit, getWarningString, getWindowFocusListeners, getWindowListeners, getWindowStateListeners, hide, isActive, isFocusableWindow, isFocusCycleRoot, isFocused, isShowing, pack, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, setCursor, setFocusableWindowState, setFocusCycleRoot, setLocationRelativeTo, 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, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setFocusTraversalKeys, setFocusTraversalPolicy, 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, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, 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, 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, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, size, toString, transferFocus, transferFocusUpCycle
 
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
See Also:
Constant Field Values

SAVE_ACTION

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

SAVE_AS_ACTION

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

EXIT_ACTION

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

UNDO_ACTION

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

REDO_ACTION

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

CUT_ACTION

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

COPY_ACTION

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

PASTE_ACTION

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

CLEAR_ACTION

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

OPTIONS_ACTION

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

EVAL_ACTION

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

EVAL_S_ACTION

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

STOP_ACTION

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

REINIT_ACTION

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

ABOUT_ACTION

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

instances

protected static int instances
The number of instances of this class


RESOURCE

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

See Also:
Constant Field Values

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"

Throws:
java.io.IOException

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.