ij2x.plugin.frame
Class MonoEditor

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 ij.plugin.frame.PlugInFrame
                          extended by ij2x.plugin.frame.MonoEditor
All Implemented Interfaces:
MacroConstants, KeyCode, PlugIn, java.awt.datatransfer.ClipboardOwner, java.awt.event.FocusListener, java.awt.event.KeyListener, java.awt.event.MouseListener, java.awt.event.MouseWheelListener, java.awt.event.WindowListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.DocumentListener, javax.swing.RootPaneContainer, javax.swing.WindowConstants

public class MonoEditor
extends PlugInFrame
implements java.awt.event.MouseListener, java.awt.event.MouseWheelListener, java.awt.event.KeyListener, javax.swing.event.DocumentListener, java.awt.datatransfer.ClipboardOwner, MacroConstants, KeyCode

This is a simple TextArea based editor for editing and compiling plugins.

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.BaselineResizeBehavior
 
Field Summary
static java.lang.String abortmacroAction
           
static java.lang.String actionSuffix
          Suffix applied to the key used in resource file lookups for an action.
static java.lang.String compileandrunAction
           
static java.lang.String copyAction
           
static java.lang.String cutAction
           
static java.lang.String deleteAction
           
static java.lang.String evaluatelineAction
           
static java.lang.String exitAction
           
static java.lang.String findAction
           
static java.lang.String findnextAction
           
static java.lang.String gotolineAction
           
static java.lang.String imageSuffix
          Suffix applied to the key used in resource file lookups for an image.
static java.lang.String installmacrosAction
           
static java.lang.String labelSuffix
          Suffix applied to the key used in resource file lookups for a label.
static java.lang.String largerAction
           
static int MAX_MACROS
           
static int MAX_SIZE
           
static java.lang.String monospacedAction
           
static java.lang.String newAction
           
static java.lang.String openAction
           
static java.lang.String pasteAction
           
static java.lang.String printAction
           
static java.lang.String runmacroAction
           
static java.lang.String saveAction
           
static java.lang.String saveAsAction
           
static java.lang.String savesettingsAction
           
static java.lang.String smalerAction
           
static java.lang.String tipSuffix
          Suffix applied to the key used in resource file lookups for tooltip text.
static java.lang.String undoSuffix
          Suffix applied to the key used in resource file lookups for an button enabled.
static int XINC
           
static int YINC
           
 
Fields inherited from class ij.plugin.frame.PlugInFrame
container
 
Fields inherited from class javax.swing.JFrame
EXIT_ON_CLOSE
 
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 ij.macro.MacroConstants
ABS, ACOS, ARRAY, ARRAY_FUNC, ARRAY_FUNCTION, arrayFunctionIDs, arrayFunctions, ASIN, ATAN, ATAN2, AUTO_UPDATE, BEEP, BIT_DEPTH, CALCULATOR, CALIBRATE, CALL, CHANGE_VALUES, CHAR_CODE_AT, CLOSE, COS, D2S, DEBUG, DIALOG, DIV_EQUAL, DO, DO_COMMAND, DO_WAND, DRAW_LINE, DRAW_OVAL, DRAW_RECT, DRAW_STRING, DUMP, ELSE, ENDS_WITH, EOF, EQ, EVAL, EXEC, EXIT, EXP, EXT, FALSE, FILE, FILL, FILL_OVAL, FILL_RECT, FIT, FLOOD_FILL, FLOOR, FOR, FROM_CHAR_CODE, FUNCTION, functionIDs, functions, GET_ARGUMENT, GET_BOOLEAN, GET_BOUNDING_RECT, GET_BOUNDS, GET_COORDINATES, GET_COUNT, GET_CURSOR_LOC, GET_DATE_AND_TIME, GET_DIMENSIONS, GET_DIRECTORY, GET_DISPLAYED_AREA, GET_FILE_LIST, GET_FONT_LIST, GET_HEIGHT, GET_HISTOGRAM, GET_ID, GET_IMAGE_INFO, GET_INFO, GET_LINE, GET_LIST, GET_LOCATION_AND_SIZE, GET_LUT, GET_METADATA, GET_MIN_AND_MAX, GET_NUMBER, GET_PIXEL, GET_PIXEL_SIZE, GET_PROFILE, GET_RAW_STATISTICS, GET_RESULT, GET_RESULT_LABEL, GET_SLICE_NUMBER, GET_STATISTICS, GET_STRING, GET_STRING_WIDTH, GET_THRESHOLD, GET_TIME, GET_TITLE, GET_VALUE, GET_VERSION, GET_VOXEL_SIZE, GET_WIDTH, GET_ZOOM, GT, GTE, IF, IJ_CALL, INDEX_OF, INVERT, IS, IS_ACTIVE, IS_KEY_DOWN, IS_NAN, IS_OPEN, keywordIDs, keywords, LAST_INDEX_OF, LENGTH_OF, LINE_TO, LIST, LOG, LOGICAL_AND, LOGICAL_OR, LT, LTE, MACRO, MAKE_ELLIPSE, MAKE_LINE, MAKE_OVAL, MAKE_POINT, MAKE_POLYGON, MAKE_RECTANGLE, MAKE_SELECTION, MAKE_TEXT, MATCHES, MAX_OF, MIN_OF, MINUS_EQUAL, MINUS_MINUS, MOVE_TO, MUL_EQUAL, NaN, NEQ, NEW_ARRAY, NEW_IMAGE, NEW_MENU, NIMAGES, NOP, NRESULTS, NSLICES, NUMBER, NUMERIC_FUNCTION, numericFunctionIDs, numericFunctions, OPEN, OVERLAY, PARSE_FLOAT, PARSE_INT, PI, PLOT, PLUS_EQUAL, PLUS_PLUS, POW, PREDEFINED_FUNCTION, PRINT, PUT_PIXEL, RANDOM, RENAME, REPLACE, REQUIRES, RESET, RESET_MIN_MAX, RESET_THRESHOLD, RESTORE_PREVIOUS_TOOL, RESTORE_SETTINGS, RETURN, ROI_MANAGER, ROUND, RUN, RUN_MACRO, SAVE, SAVE_AS, SAVE_SETTINGS, SCREEN_HEIGHT, SCREEN_WIDTH, SELECT, SELECT_IMAGE, SELECTION_CONTAINS, SELECTION_NAME, SELECTION_TYPE, SET_AUTO_THRESHOLD, SET_BACKGROUND, SET_BATCH_MODE, SET_COLOR, SET_FONT, SET_FOREGROUND, SET_JUSTIFICATION, SET_KEY_DOWN, SET_LINE_WIDTH, SET_LOCATION, SET_LUT, SET_METADATA, SET_MIN_MAX, SET_OPTION, SET_PASTE_MODE, SET_PIXEL, SET_RESULT, SET_RGB_WEIGHTS, SET_SELECTION_LOC, SET_SELECTION_NAME, SET_SLICE, SET_THRESHOLD, SET_TOOL, SET_VOXEL_SIZE, SET_Z_COORDINATE, SETUP_UNDO, SHIFT_LEFT, SHIFT_RIGHT, SHOW_MESSAGE, SHOW_MESSAGE_WITH_CANCEL, SHOW_PROGRESS, SHOW_STATUS, SHOW_TEXT, SIN, SNAPSHOT, SPLIT, SQRT, STACK, STARTS_WITH, STRING, STRING_CONSTANT, STRING_FUNCTION, stringFunctionIDs, stringFunctions, SUBSTRING, TAN, TO_BINARY, TO_HEX, TO_LOWER_CASE, TO_STRING, TO_UPPER_CASE, TOK_MASK, TOK_SHIFT, TOOL_ID, TRUE, UPDATE_DISPLAY, UPDATE_RESULTS, USER_FUNCTION, VAR, WAIT, WAIT_FOR_USER, WHILE, WORD, WRITE
 
Fields inherited from interface ij.plugin.frame.KeyCode
shortcutKeyi, shortcutKeys
 
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
MonoEditor()
           
 
Method Summary
 void changedUpdate(javax.swing.event.DocumentEvent e)
           
 void checkBox_itemStateChanged(java.awt.event.ItemEvent e)
           
 void close()
          Overrides close() in PlugInFrame.
 void create(java.lang.String name, java.lang.String text)
           
 void createMacro(java.lang.String name, java.lang.String text)
           
 void display(java.lang.String title, java.lang.String text)
           
 javax.swing.Action[] getActions()
          Fetch the list of actions supported by this editor.
 java.awt.Insets getInset(int top, int left)
          Override Container getInsets() to make room for some text above the image.
 java.lang.String getText()
           
 void insertUpdate(javax.swing.event.DocumentEvent e)
           
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void lostOwnership(java.awt.datatransfer.Clipboard clip, java.awt.datatransfer.Transferable cont)
           
 void mouseClicked(java.awt.event.MouseEvent e)
           
 void mouseEntered(java.awt.event.MouseEvent e)
           
 void mouseExited(java.awt.event.MouseEvent e)
           
 void mousePressed(java.awt.event.MouseEvent e)
           
 void mouseReleased(java.awt.event.MouseEvent e)
           
 void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
           
 void open(java.lang.String dir, java.lang.String name)
           
 void paint(java.awt.Graphics g)
           
 void positionWindow()
           
 void removeUpdate(javax.swing.event.DocumentEvent e)
           
 void run(java.lang.String arg)
          This method is called when the plugin is loaded.
static void setDefaultDirectory(java.lang.String defaultDirectory)
           
 void setFont(java.awt.Font font)
           
 void setIsMacroWindow(boolean mw)
           
 void update(java.awt.Graphics g)
           
 void updateClassName(java.lang.String oldName, java.lang.String newName)
          Changes a plugins class name to reflect a new file name.
 void windowActivated(java.awt.event.WindowEvent e)
          Override windowActivated in PlugInFrame to prevent Mac menu bar from being installed.
 void windowClosing(java.awt.event.WindowEvent e)
           
 
Methods inherited from class ij.plugin.frame.PlugInFrame
focusGained, focusLost, windowClosed, windowDeactivated, windowDeiconified, windowIconified, windowOpened
 
Methods inherited from class javax.swing.JFrame
getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setIconImage, setJMenuBar, setLayeredPane, setLayout, setTransferHandler
 
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, postEvent, 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, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, 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, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, 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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.awt.MenuContainer
getFont, postEvent
 

Field Detail

MAX_SIZE

public static final int MAX_SIZE
See Also:
Constant Field Values

MAX_MACROS

public static final int MAX_MACROS
See Also:
Constant Field Values

XINC

public static final int XINC
See Also:
Constant Field Values

YINC

public static final int YINC
See Also:
Constant Field Values

undoSuffix

public static final java.lang.String undoSuffix
Suffix applied to the key used in resource file lookups for an button enabled.

See Also:
Constant Field Values

imageSuffix

public static final java.lang.String imageSuffix
Suffix applied to the key used in resource file lookups for an image.

See Also:
Constant Field Values

labelSuffix

public static final java.lang.String labelSuffix
Suffix applied to the key used in resource file lookups for a label.

See Also:
Constant Field Values

actionSuffix

public static final java.lang.String actionSuffix
Suffix applied to the key used in resource file lookups for an action.

See Also:
Constant Field Values

tipSuffix

public static final java.lang.String tipSuffix
Suffix applied to the key used in resource file lookups for tooltip text.

See Also:
Constant Field Values

cutAction

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

copyAction

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

exitAction

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

pasteAction

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

deleteAction

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

openAction

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

newAction

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

saveAction

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

saveAsAction

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

findAction

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

findnextAction

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

gotolineAction

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

compileandrunAction

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

printAction

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

savesettingsAction

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

monospacedAction

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

smalerAction

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

largerAction

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

runmacroAction

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

evaluatelineAction

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

abortmacroAction

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

installmacrosAction

public static final java.lang.String installmacrosAction
See Also:
Constant Field Values
Constructor Detail

MonoEditor

public MonoEditor()
Method Detail

run

public void run(java.lang.String arg)
Description copied from interface: PlugIn
This method is called when the plugin is loaded. 'arg', which may be blank, is the argument specified for this plugin in IJ_Props.txt.

Specified by:
run in interface PlugIn
Overrides:
run in class PlugInFrame

getInset

public java.awt.Insets getInset(int top,
                                int left)
Override Container getInsets() to make room for some text above the image.


getActions

public javax.swing.Action[] getActions()
Fetch the list of actions supported by this editor. It is implemented to return the list of actions supported by the embedded JTextComponent augmented with the actions defined locally.


positionWindow

public void positionWindow()

create

public void create(java.lang.String name,
                   java.lang.String text)

createMacro

public void createMacro(java.lang.String name,
                        java.lang.String text)

open

public void open(java.lang.String dir,
                 java.lang.String name)

getText

public java.lang.String getText()

display

public void display(java.lang.String title,
                    java.lang.String text)

updateClassName

public void updateClassName(java.lang.String oldName,
                            java.lang.String newName)
Changes a plugins class name to reflect a new file name.


setFont

public void setFont(java.awt.Font font)
Overrides:
setFont in class java.awt.Container

setDefaultDirectory

public static void setDefaultDirectory(java.lang.String defaultDirectory)

checkBox_itemStateChanged

public void checkBox_itemStateChanged(java.awt.event.ItemEvent e)

setIsMacroWindow

public void setIsMacroWindow(boolean mw)

lostOwnership

public void lostOwnership(java.awt.datatransfer.Clipboard clip,
                          java.awt.datatransfer.Transferable cont)
Specified by:
lostOwnership in interface java.awt.datatransfer.ClipboardOwner

insertUpdate

public void insertUpdate(javax.swing.event.DocumentEvent e)
Specified by:
insertUpdate in interface javax.swing.event.DocumentListener

removeUpdate

public void removeUpdate(javax.swing.event.DocumentEvent e)
Specified by:
removeUpdate in interface javax.swing.event.DocumentListener

changedUpdate

public void changedUpdate(javax.swing.event.DocumentEvent e)
Specified by:
changedUpdate in interface javax.swing.event.DocumentListener

close

public void close()
Overrides close() in PlugInFrame.

Overrides:
close in class PlugInFrame

windowActivated

public void windowActivated(java.awt.event.WindowEvent e)
Override windowActivated in PlugInFrame to prevent Mac menu bar from being installed.

Specified by:
windowActivated in interface java.awt.event.WindowListener
Overrides:
windowActivated in class PlugInFrame

windowClosing

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

mousePressed

public void mousePressed(java.awt.event.MouseEvent e)
Specified by:
mousePressed in interface java.awt.event.MouseListener

mouseExited

public void mouseExited(java.awt.event.MouseEvent e)
Specified by:
mouseExited in interface java.awt.event.MouseListener

mouseReleased

public void mouseReleased(java.awt.event.MouseEvent e)
Specified by:
mouseReleased in interface java.awt.event.MouseListener

mouseClicked

public void mouseClicked(java.awt.event.MouseEvent e)
Specified by:
mouseClicked in interface java.awt.event.MouseListener

mouseEntered

public void mouseEntered(java.awt.event.MouseEvent e)
Specified by:
mouseEntered in interface java.awt.event.MouseListener

mouseWheelMoved

public void mouseWheelMoved(java.awt.event.MouseWheelEvent e)
Specified by:
mouseWheelMoved in interface java.awt.event.MouseWheelListener

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

update

public void update(java.awt.Graphics g)
Overrides:
update in class javax.swing.JFrame

paint

public void paint(java.awt.Graphics g)
Overrides:
paint in class java.awt.Window