Package com.wolfram.jlink.ui
Class MathSessionPane
- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.JScrollPane
-
- com.wolfram.jlink.ui.MathSessionPane
-
- All Implemented Interfaces:
java.awt.image.ImageObserver
,java.awt.MenuContainer
,java.io.Serializable
,javax.accessibility.Accessible
,javax.swing.ScrollPaneConstants
public class MathSessionPane extends javax.swing.JScrollPane
MathSessionPane is a visual component that provides a scrolling In/Out session interface to the Mathematica kernel. Much more sophisticated than the kernel's own "terminal" interface, it provides features such as full text editing of input including copy/paste and unlimited undo/redo, support for graphics, control of fonts and styles, customizable syntax coloring, and bracket matching.To use a MathSessionPane, either supply an existing KernelLink using the setLink() method, or provide a command line to create a link via the setLinkArguments() or setLinkArgumentsArray() methods. You must always arrange for the connect() method to be called, which will launch the kernel (if you supplied an appropriate command line) and cause the first In[] prompt to appear.
The following key commands are supported:
Ctrl-X Cut Ctrl-C Copy Ctrl-V Paste Ctrl-Z Undo Ctrl-Y Redo Ctrl-L Copy Input From Above Ctrl-B Balance Brackets Alt-. Abort Computation Alt-, Interrupt Computation (brings up dialog) (These all use the Command key on the Macintosh)
Here is a simple program that uses MathSessionPane:public static void main(String[] argv) { final MathSessionPane msp = new MathSessionPane(); // Create the frame window to hold the pane. Frame frm = new Frame(); frm.setSize(500, 500); frm.add(msp); frm.setVisible(true); frm.doLayout(); frm.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { KernelLink ml = msp.getLink(); // If we're quitting while the kernel is busy, it might not die when the link // is closed. So we force the issue by calling terminateKernel(); if (ml != null) ml.terminateKernel(); System.exit(0); } }); // Modify this for your setup. msp.setLinkArgumentsArray(new String[] {"-linkmode", "launch", "-linkname", "\"d:/math41/mathkernel\" -mathlink"}); try { msp.connect(); } catch (MathLinkException e) { e.printStackTrace(); } }
To see a more complete application built around a MathSessionPane, look at the SimpleFrontEnd example application in JLink/Examples/Part2/SimpleFrontEnd.- Since:
- 2.0
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.JScrollPane
javax.swing.JScrollPane.AccessibleJScrollPane, javax.swing.JScrollPane.ScrollBar
-
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
-
-
Field Summary
-
Fields inherited from class javax.swing.JScrollPane
columnHeader, horizontalScrollBar, horizontalScrollBarPolicy, lowerLeft, lowerRight, rowHeader, upperLeft, upperRight, verticalScrollBar, verticalScrollBarPolicy, viewport
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from interface javax.swing.ScrollPaneConstants
COLUMN_HEADER, HORIZONTAL_SCROLLBAR, HORIZONTAL_SCROLLBAR_ALWAYS, HORIZONTAL_SCROLLBAR_AS_NEEDED, HORIZONTAL_SCROLLBAR_NEVER, HORIZONTAL_SCROLLBAR_POLICY, LOWER_LEADING_CORNER, LOWER_LEFT_CORNER, LOWER_RIGHT_CORNER, LOWER_TRAILING_CORNER, ROW_HEADER, UPPER_LEADING_CORNER, UPPER_LEFT_CORNER, UPPER_RIGHT_CORNER, UPPER_TRAILING_CORNER, VERTICAL_SCROLLBAR, VERTICAL_SCROLLBAR_ALWAYS, VERTICAL_SCROLLBAR_AS_NEEDED, VERTICAL_SCROLLBAR_NEVER, VERTICAL_SCROLLBAR_POLICY, VIEWPORT
-
-
Constructor Summary
Constructors Constructor Description MathSessionPane()
Creates a new MathSessionPane with vertical and horizontal scrollbars.MathSessionPane(int vsbPolicy, int hsbPolicy)
Creates a new MathSessionPane with the specified policies for vertical and horizontal scrollbars.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColoredSymbols(java.lang.String[] syms, java.awt.Color c)
Lets you customize syntax coloring by specifying an array of symbol names and the color you want them drawn in when they appear in input.void
addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener that will be notified of changes in the computationActive property.void
balanceBrackets()
Grows the current selection to highlight the nearest matching set of delimiters.boolean
canRedo()
Indicates whether a redo operation is currently possible.boolean
canUndo()
Indicates whether an undo operation is currently possible.void
clearColoredSymbols()
Wipes out all syntax coloring customizations specified by addColoredSymbols().void
closeLink()
Closes the link to Mathematica.void
connect()
Connects the link to Mathematica and prepares the pane for use.void
copyInputFromAbove()
Copies the previous input to the current cursor location.void
evaluateInput()
Evaluates the current input.java.awt.Color
getBackgroundColor()
Returns the background color of the text region.java.awt.Color
getCommentColor()
Returns the color that will be used for comments in input if syntax coloring is on.int
getConnectTimeout()
Returns the number of milliseconds that the connect() method will wait to connect the link to Mathematica.int
getLeftIndent()
Returns the amount that input and output will be indented from the left edge.KernelLink
getLink()
Returns the link currently being used to communicate with Mathematica.java.lang.String
getLinkArguments()
Returns the string specified to create the link to Mathematica.java.lang.String[]
getLinkArgumentsArray()
Returns the string array specified to create the link to Mathematica.java.awt.Color
getMessageColor()
Returns the color used for Mathematica message output.java.awt.Color
getPromptColor()
Returns the color used for In[] and Out[] prompts.java.awt.Color
getStringColor()
Returns the color that will be used for literal strings in input if syntax coloring is on.java.awt.Color
getSystemSymbolColor()
Returns the color that will be used in input for symbols in the Mathematica System` context if syntax coloring is on.java.lang.String
getText()
Gives the current contents of the pane as a string.java.awt.Color
getTextColor()
Gives the color for input and output textjavax.swing.JTextPane
getTextPane()
Gives the JTextPane component that is hosted within this MathSessionPane.int
getTextSize()
Gives the font size currently in use.boolean
isComputationActive()
Indicates whether a computation is currently in progress.boolean
isFitGraphics()
Indicates whether graphics are set to be scaled to fit into the current visible width.boolean
isFrontEndGraphics()
Indicates whether the Mathematica front end will be used to assist in rendering graphics.boolean
isInputBoldface()
Indicates whether input is in a boldface font.boolean
isShowTiming()
Indicates whether evaluation timings will be shown in a timing panel at the lower left corner of the pane.boolean
isSyntaxColoring()
Indicates whether syntax coloring is currently enabled.void
redo()
Redoes the last undone edit.void
removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener.void
setBackgroundColor(java.awt.Color c)
Sets the background color of the text region.void
setCommentColor(java.awt.Color c)
Sets the color that will be used for comments in input if syntax coloring is on.void
setConnectTimeout(int timeoutMillis)
Sets the number of milliseconds that the connect() method will wait to connect the link to Mathematica.void
setFitGraphics(boolean fit)
Sets whether to scale graphics so as to fit into the current visible width.void
setFrontEndGraphics(boolean b)
Sets whether to use the Mathematica front end in the background to assist in rendering graphics.void
setInputBoldface(boolean bold)
Sets whether to use boldface for Mathematica input.void
setLeftIndent(int indent)
Sets the amount that input and output will be indented from the left edge.void
setLink(KernelLink ml)
Sets the link to use for communicating with Mathematica.void
setLinkArguments(java.lang.String linkArgs)
Sets the command line to use to open a link to Mathematica.void
setLinkArgumentsArray(java.lang.String[] linkArgs)
Sets the arguments to use to open a link to Mathematica.void
setMessageColor(java.awt.Color c)
Sets the color used for Mathematica message output.void
setPromptColor(java.awt.Color c)
Sets the color used for In[] and Out[] prompts.void
setShowTiming(boolean show)
Specifies whether to display the wall-clock timing for each input in a timing panel at the lower left corner of the pane.void
setStringColor(java.awt.Color c)
Sets the color that will be used for literal strings in input if syntax coloring is on.void
setSyntaxColoring(boolean b)
Enables or disables syntax coloring of input.void
setSystemSymbolColor(java.awt.Color c)
Sets the color that will be used in input for symbols in the Mathematica System` context if syntax coloring is on.void
setTextColor(java.awt.Color c)
Sets the color for input and output text.void
setTextSize(int size)
Sets the font size for input and output text.void
undo()
Undoes the last edit.-
Methods inherited from class javax.swing.JScrollPane
createHorizontalScrollBar, createVerticalScrollBar, createViewport, getAccessibleContext, getColumnHeader, getCorner, getHorizontalScrollBar, getHorizontalScrollBarPolicy, getRowHeader, getUI, getUIClassID, getVerticalScrollBar, getVerticalScrollBarPolicy, getViewport, getViewportBorder, getViewportBorderBounds, isValidateRoot, isWheelScrollingEnabled, paramString, setColumnHeader, setColumnHeaderView, setComponentOrientation, setCorner, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setLayout, setRowHeader, setRowHeaderView, setUI, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportBorder, setViewportView, setWheelScrollingEnabled, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
-
-
-
Constructor Detail
-
MathSessionPane
public MathSessionPane()
Creates a new MathSessionPane with vertical and horizontal scrollbars.
-
MathSessionPane
public MathSessionPane(int vsbPolicy, int hsbPolicy)
Creates a new MathSessionPane with the specified policies for vertical and horizontal scrollbars.- Parameters:
vsbPolicy
- vertical scrollbar policy (see the Swing JScrollPane class)hsbPolicy
- horizontal scrollbar policy (see the Swing JScrollPane class)
-
-
Method Detail
-
setLink
public void setLink(KernelLink ml)
Sets the link to use for communicating with Mathematica. Use this method if you already have a link you want to use, or you want to open the link manually. Most programmers will use setLinkArguments() or setLinkArgumentsArray instead and let this class open the link itself. Even if you open the link yourself and call setLink(), you must still call the connect() method of this class to prepare the pane to be used.- Parameters:
ml
-- See Also:
setLinkArguments(String)
,setLinkArgumentsArray(String[])
,connect()
-
getLink
public KernelLink getLink()
Returns the link currently being used to communicate with Mathematica. Null if no link is open yet.
-
setLinkArguments
public void setLinkArguments(java.lang.String linkArgs)
Sets the command line to use to open a link to Mathematica. The string is in the same form as you would pass to MathLinkFactory.createKernelLink(), for example:"-linkmode launch -linkname \"c:/program files/wolfram research/mathematica/5.1/mathkernel.exe\"" (Windows) "-linkmode launch -linkname 'math -mathlink'" (UNIX) "-linkmode launch -linkname '\"/Applications/Mathematica 4.1.app/Contents/MacOS/MathKernel\" -mathlink'" (Mac OS X)
The actual creation of the link will happen when you call connect().- Parameters:
linkArgs
- the command line to create the link- See Also:
setLinkArgumentsArray(String[])
,setLink(KernelLink)
,connect()
,closeLink()
-
setLinkArgumentsArray
public void setLinkArgumentsArray(java.lang.String[] linkArgs)
Sets the arguments to use to open a link to Mathematica. The string array is in the same form as you would pass to MathLinkFactory.createKernelLink(), for example:String[] args = {"-linkmode", "launch", "-linkname", "c:\\program files\\wolfram research\\mathematica\\5.1\\mathkernel.exe"}; (Windows) String[] args = {"-linkmode", "launch", "-linkname", "math -mathlink"}; (UNIX) String[] args = {"-linkmode", "launch", "-linkname", \"/Applications/Mathematica 5.1.app/Contents/MacOS/MathKernel\" -mathlink"}; (Mac OS X)
The actual creation of the link will happen when you call connect().- Parameters:
linkArgs
- the command line to create the link- See Also:
setLinkArguments(String)
,setLink(KernelLink)
,connect()
,closeLink()
-
getLinkArguments
public java.lang.String getLinkArguments()
Returns the string specified to create the link to Mathematica.- See Also:
setLinkArguments(String)
-
getLinkArgumentsArray
public java.lang.String[] getLinkArgumentsArray()
Returns the string array specified to create the link to Mathematica.- See Also:
setLinkArgumentsArray(String[])
-
setConnectTimeout
public void setConnectTimeout(int timeoutMillis)
Sets the number of milliseconds that the connect() method will wait to connect the link to Mathematica. If the timeout expires, connect() will throw a MathLinkException. You can use this timeout to prevent your program from hanging indefinitely in certain circumstances if the kernel does not launch properly. The default value is very large, effectively no timeout.- See Also:
getConnectTimeout()
-
getConnectTimeout
public int getConnectTimeout()
Returns the number of milliseconds that the connect() method will wait to connect the link to Mathematica.- See Also:
setConnectTimeout(int)
-
getText
public java.lang.String getText()
Gives the current contents of the pane as a string.
-
getTextPane
public javax.swing.JTextPane getTextPane()
Gives the JTextPane component that is hosted within this MathSessionPane. The JTextPane is the actual component that handles all text input and output. Advanced programmers might want access to the JTextPane to call methods directly on it.
-
isComputationActive
public boolean isComputationActive()
Indicates whether a computation is currently in progress. Programmers might want to know this for several reasons. First, they might want to disable/enable parts of their user interface, and second, they might want to know whether the Mathematica kernel is currently busy. This latter consideration is particularly important if other parts of the program want to use the same link. Programmers who are considering using this method might find it preferable instead to use a PropertyChangeListener to monitor the changes in the computationActive property.- Returns:
- true, if a computation is active, false otherwise
-
getTextSize
public int getTextSize()
Gives the font size currently in use.
-
setTextSize
public void setTextSize(int size)
Sets the font size for input and output text.- Parameters:
size
- the font size, in points
-
isSyntaxColoring
public boolean isSyntaxColoring()
Indicates whether syntax coloring is currently enabled.- Returns:
- true, if syntax coloring is on, false otherwise
-
setSyntaxColoring
public void setSyntaxColoring(boolean b)
Enables or disables syntax coloring of input. The default is true.- Parameters:
b
-
-
getTextColor
public java.awt.Color getTextColor()
Gives the color for input and output text
-
setTextColor
public void setTextColor(java.awt.Color c)
Sets the color for input and output text. This color is used for input except when syntax coloring is on and the characters are in a syntax class that is specially colored. The default is black.- Parameters:
c
-
-
getStringColor
public java.awt.Color getStringColor()
Returns the color that will be used for literal strings in input if syntax coloring is on.
-
setStringColor
public void setStringColor(java.awt.Color c)
Sets the color that will be used for literal strings in input if syntax coloring is on. The default is a shade of blue.- Parameters:
c
-
-
getCommentColor
public java.awt.Color getCommentColor()
Returns the color that will be used for comments in input if syntax coloring is on.
-
setCommentColor
public void setCommentColor(java.awt.Color c)
Sets the color that will be used for comments in input if syntax coloring is on. The default is a shade of green.- Parameters:
c
-
-
getSystemSymbolColor
public java.awt.Color getSystemSymbolColor()
Returns the color that will be used in input for symbols in the Mathematica System` context if syntax coloring is on.
-
setSystemSymbolColor
public void setSystemSymbolColor(java.awt.Color c)
Sets the color that will be used in input for symbols in the Mathematica System` context if syntax coloring is on. The default is a shade of purple.- Parameters:
c
-
-
getBackgroundColor
public java.awt.Color getBackgroundColor()
Returns the background color of the text region.
-
setBackgroundColor
public void setBackgroundColor(java.awt.Color c)
Sets the background color of the text region.- Parameters:
c
-
-
getPromptColor
public java.awt.Color getPromptColor()
Returns the color used for In[] and Out[] prompts.
-
setPromptColor
public void setPromptColor(java.awt.Color c)
Sets the color used for In[] and Out[] prompts. The default is blue.- Parameters:
c
-
-
getMessageColor
public java.awt.Color getMessageColor()
Returns the color used for Mathematica message output.
-
setMessageColor
public void setMessageColor(java.awt.Color c)
Sets the color used for Mathematica message output. The default is red.- Parameters:
c
-
-
getLeftIndent
public int getLeftIndent()
Returns the amount that input and output will be indented from the left edge.- Returns:
- the indent amount, in pixels
-
setLeftIndent
public void setLeftIndent(int indent)
Sets the amount that input and output will be indented from the left edge. The default is 20.- Parameters:
indent
- the indentation amount in pixels
-
isInputBoldface
public boolean isInputBoldface()
Indicates whether input is in a boldface font.
-
setInputBoldface
public void setInputBoldface(boolean bold)
Sets whether to use boldface for Mathematica input. The default is true.- Parameters:
bold
-
-
setFitGraphics
public void setFitGraphics(boolean fit)
Sets whether to scale graphics so as to fit into the current visible width. The default is false.- Parameters:
fit
-
-
isFitGraphics
public boolean isFitGraphics()
Indicates whether graphics are set to be scaled to fit into the current visible width.
-
setFrontEndGraphics
public void setFrontEndGraphics(boolean b)
Sets whether to use the Mathematica front end in the background to assist in rendering graphics. This must be set to true if you want typeset output (such as plot labels) in your graphics. It will also improve the quality of most images, particularly surface graphics. Setting this to true will cause the front end to launch. The default is false.- Parameters:
b
-
-
isFrontEndGraphics
public boolean isFrontEndGraphics()
Indicates whether the Mathematica front end will be used to assist in rendering graphics.
-
addColoredSymbols
public void addColoredSymbols(java.lang.String[] syms, java.awt.Color c)
Lets you customize syntax coloring by specifying an array of symbol names and the color you want them drawn in when they appear in input. As an example, you could use this to specify that all the symbols from a certain context should be rendered in red. You can call this method as many times as you like, specifying many different combinations of symbols and colors.- Parameters:
syms
- The symbols to be specially colored, for example {"If", "For", "Do"}c
-- See Also:
clearColoredSymbols()
-
clearColoredSymbols
public void clearColoredSymbols()
Wipes out all syntax coloring customizations specified by addColoredSymbols().- See Also:
addColoredSymbols(String[],Color)
-
setShowTiming
public void setShowTiming(boolean show)
Specifies whether to display the wall-clock timing for each input in a timing panel at the lower left corner of the pane. The default is true.- Parameters:
show
-
-
isShowTiming
public boolean isShowTiming()
Indicates whether evaluation timings will be shown in a timing panel at the lower left corner of the pane.
-
evaluateInput
public void evaluateInput()
Evaluates the current input. This operation is automatically mapped to the Shift-Enter key combination.
-
undo
public void undo()
Undoes the last edit. This operation is automatically mapped to the Ctrl-Z key combination (Cmd-Z on Macintosh).
-
redo
public void redo()
Redoes the last undone edit. This operation is automatically mapped to the Ctrl-Y key combination (Cmd-Y on Macintosh).
-
canRedo
public boolean canRedo()
Indicates whether a redo operation is currently possible.
-
canUndo
public boolean canUndo()
Indicates whether an undo operation is currently possible.
-
copyInputFromAbove
public void copyInputFromAbove()
Copies the previous input to the current cursor location. This operation is automatically mapped to the Ctrl-L key combination (Cmd-L on Macintosh).
-
balanceBrackets
public void balanceBrackets()
Grows the current selection to highlight the nearest matching set of delimiters. This is done in a way that respects Mathematica syntax, meaning that delimiters within comments and strings are ignored. This operation is automatically mapped to the Ctrl-B key combination (Cmd-B on Macintosh).
-
addPropertyChangeListener
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
Adds a PropertyChangeListener that will be notified of changes in the computationActive property. You can use this to receive notifications when computations start and end. For eample, you might want to enable or disable parts of your user interface, or lock out other parts of your program from trying to use the link.- Overrides:
addPropertyChangeListener
in classjava.awt.Container
- Parameters:
listener
-
-
removePropertyChangeListener
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
Removes a PropertyChangeListener.- Overrides:
removePropertyChangeListener
in classjava.awt.Component
- Parameters:
listener
-
-
connect
public void connect() throws MathLinkException
Connects the link to Mathematica and prepares the pane for use. The first In[] prompt will not appear and the pane will not be editable until this method has been called, even if you have supplied a preexisting link using the setLink() method. If you used setLinkArguments() or setLinkArgumentsArray() to specify link parameters, then the link will be created and connected at this time. The Mathematica kernel will be launched if appropriate.Do not call this until after the pane has been made visible.
- Throws:
MathLinkException
-
closeLink
public void closeLink()
Closes the link to Mathematica. The link is not automatically closed anywhere in this class, so you must arrange for this method to be called.
-
-