Class JMathComponent
- All Implemented Interfaces:
ImageObserver,MenuContainer,Serializable,SwingConstants
There are two properties which expose the actual content, accessible though
getDocument() / setDocument(org.w3c.dom.Node) for content
already available as a DOM model, and getContent() and
setContent(String) for content available as a String.
This class exposes most of the rendering parameters as standard bean
attributes. If you need to set additional attributes, you may use the
setParameter(Parameter, Object) function.
Please use only the attributes exposed through the attached
JMathComponentBeanInfo class. Additional attributes, such as
Component.getFont() and setFont(Font) are provided for Swing
compatibility, but they may not work exactly as expected.
- Version:
- $Revision: 5a7becda9147 $
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponentNested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainerNested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy -
Field Summary
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_WINDOWFields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTFields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTHFields inherited from interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionTries to return the content as a String.Font list for Doublestruck.Font list for Fraktur.floatFont list for Monospaced.Font list for Sans-Serif.Font list for Script.Font list for Serif (the default MathML font).intHorizontal alignment, as defined byJLabel.getHorizontalAlignment().Gets the preferred size of this component.getUI()intVertical alignment, as defined byJLabel.getVerticalAlignment().voidvoidsetContent(String contentString) Set the content from a String containing the MathML content.voidsetDebug(boolean dbg) Enables, or disables the debug mode.voidsetDocument(Node doc) voidDeprecated.use separate setters.voidsetFontsDoublestruck(String newFonts) Font list for Doublestruck.voidsetFontsFraktur(String newFonts) Font list for Fraktur.voidsetFontSize(float fontSize) sets the font size used.voidsetFontsMonospaced(String newFonts) Font list for Monospaced.voidsetFontsSanserif(String newFonts) Font list for Sans-Serif.voidsetFontsScript(String newFonts) Font list for Script.voidsetFontsSerif(String newFonts) Font list for Serif (the default MathML font).voidsetForeground(Color fg) voidsetHorizontalAlignment(int hAlignment) Horizontal alignment, as defined byJLabel.setHorizontalAlignment(int).voidsetOpaque(boolean opaque) voidsetParameter(Parameter key, Object newValue) Sets a generic rendering parameter.voidsetParameters(Map<Parameter, Object> newValues) Sets generic rendering parameters.voidsetSize(int width, int height) voidsetVerticalAlignment(int vAlignment) Vertical alignment, as defined byJLabel.setVerticalAlignment(int).voidupdateUI()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, 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, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, 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, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateMethods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, 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, setLayout, transferFocusDownCycle, validate, validateTreeMethods 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, getAccessibleContext, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, 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, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
JMathComponent
public JMathComponent()Default constructor.
-
-
Method Details
-
getContent
Tries to return the content as a String.This transforms the internal DOM tree back into a string, which may is not guaranteed to be the literally same as the original content. However, it will represent the same XML document.
- Returns:
- the content string.
-
getDocument
- Returns:
- the document
-
getFontsDoublestruck
Font list for Doublestruck. Please seefor an explanation of this parameter.invalid reference
Parameter#FontsDoublestruck- Returns:
- The list for Doublestruck.
- See Also:
-
getFontsFraktur
Font list for Fraktur. Please seefor an explanation of this parameter.invalid reference
Parameter#FontsFraktur- Returns:
- The list for Fraktur.
- See Also:
-
getFontSize
public float getFontSize()- Returns:
- the fontSize
-
getFontsMonospaced
Font list for Monospaced. Please seefor an explanation of this parameter.invalid reference
Parameter#FontsMonospaced- Returns:
- The list for monospaced.
- See Also:
-
getFontsSanserif
Font list for Sans-Serif. Please seefor an explanation of this parameter.invalid reference
Parameter#FontsSanserif- Returns:
- The list for sansserif.
- See Also:
-
getFontsScript
Font list for Script. Please seefor an explanation of this parameter.invalid reference
Parameter#FontsScript- Returns:
- The list for Script.
- See Also:
-
getFontsSerif
Font list for Serif (the default MathML font). Please seefor an explanation of this parameter.invalid reference
Parameter#FontsSerif- Returns:
- The list for serif.
- See Also:
-
getForeground
- Overrides:
getForegroundin classComponent
-
getHorizontalAlignment
public int getHorizontalAlignment()Horizontal alignment, as defined byJLabel.getHorizontalAlignment().Supported are:
SwingConstants.LEADING,SwingConstants.LEFT,SwingConstants.CENTER,SwingConstants.TRAILING,SwingConstants.RIGHT.- Returns:
- the horizontalAlignment
- See Also:
-
getPreferredSize
Gets the preferred size of this component.- Overrides:
getPreferredSizein classJComponent- Returns:
- A dimension object indicating this component's preferred size.
-
getUI
- Overrides:
getUIin classJComponent- Returns:
- the UI implementation.
-
getUIClassID
- Overrides:
getUIClassIDin classJComponent- Returns:
- The default UI class
-
getVerticalAlignment
public int getVerticalAlignment()Vertical alignment, as defined byJLabel.getVerticalAlignment().Supported are:
SwingConstants.TOP,SwingConstants.CENTER,SwingConstants.BOTTOM.- Returns:
- the verticalAlignment
- See Also:
-
setBackground
- Overrides:
setBackgroundin classJComponent
-
setContent
Set the content from a String containing the MathML content.- Parameters:
contentString- the content to set.
-
setDebug
public void setDebug(boolean dbg) Enables, or disables the debug mode.- Parameters:
dbg- Debug mode.
-
setDocument
- Parameters:
doc- the document to set
-
setFont
Deprecated.use separate setters.Font emulator for standard component behavior.Emulates the standard setFont function by setting the font Size and adding the font to the front of the serif font list.
Please use the separate setters if possible.
- Overrides:
setFontin classJComponent- Parameters:
f- font to set.- See Also:
-
setFontsDoublestruck
Font list for Doublestruck. Please seeParameter.FONTS_DOUBLESTRUCKfor an explanation of this parameter.- Parameters:
newFonts- new list for Doublestruck (comma seraparated).- See Also:
-
setFontsFraktur
Font list for Fraktur. Please seeParameter.FONTS_FRAKTURfor an explanation of this parameter.- Parameters:
newFonts- new list for Fraktur (comma seraparated).- See Also:
-
setParameter
Sets a generic rendering parameter.- Parameters:
key- Key for the parameternewValue- newValue
-
setParameters
Sets generic rendering parameters.- Parameters:
newValues- map of parameter keys to new values
-
setFontSize
public void setFontSize(float fontSize) sets the font size used.- Parameters:
fontSize- the font size.
-
setFontsMonospaced
Font list for Monospaced. Please seeParameter.FONTS_MONOSPACEDfor an explanation of this parameter.- Parameters:
newFonts- new list for Monospaced (comma seraparated).- See Also:
-
setFontsSanserif
Font list for Sans-Serif. Please seeParameter.FONTS_SANSSERIFfor an explanation of this parameter.- Parameters:
newFonts- new list for sansserif (comma seraparated).- See Also:
-
setFontsScript
Font list for Script. Please seeParameter.FONTS_SCRIPTfor an explanation of this parameter.- Parameters:
newFonts- new list for Script (comma seraparated).- See Also:
-
setFontsSerif
Font list for Serif (the default MathML font). Please seeParameter.FONTS_SERIFfor an explanation of this parameter.- Parameters:
newFonts- new list for serif (comma seraparated).- See Also:
-
setForeground
- Overrides:
setForegroundin classJComponent
-
setHorizontalAlignment
public void setHorizontalAlignment(int hAlignment) Horizontal alignment, as defined byJLabel.setHorizontalAlignment(int).Supported are:
SwingConstants.LEADING,SwingConstants.LEFT,SwingConstants.CENTER,SwingConstants.TRAILING,SwingConstants.RIGHT.- Parameters:
hAlignment- the horizontalAlignment to set- See Also:
-
setOpaque
public void setOpaque(boolean opaque) - Overrides:
setOpaquein classJComponent
-
setVerticalAlignment
public void setVerticalAlignment(int vAlignment) Vertical alignment, as defined byJLabel.setVerticalAlignment(int).Supported are:
SwingConstants.TOP,SwingConstants.CENTER,SwingConstants.BOTTOM.- Parameters:
vAlignment- the verticalAlignment to set- See Also:
-
updateUI
public void updateUI()- Overrides:
updateUIin classJComponent
-
getParameters
- Returns:
- the parameters
-
setSize
public void setSize(int width, int height)
-