|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent net.sourceforge.jeuclid.swing.JMathComponent
public final class JMathComponent
Displays MathML content in a Swing Component.
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.
MathComponent
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested 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 |
---|
accessibleContext, 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 |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields 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 |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
JMathComponent()
Default constructor. |
|
JMathComponent(CursorListener listener)
Default constructor with cursor listener. |
Method Summary | |
---|---|
String |
getContent()
Tries to return the content as a String. |
CursorListener |
getCursorListener()
gets cursor listener instance. |
Node |
getDocument()
|
String |
getFontsDoublestruck()
Font list for Doublestruck. |
String |
getFontsFraktur()
Font list for Fraktur. |
float |
getFontSize()
|
String |
getFontsMonospaced()
Font list for Monospaced. |
String |
getFontsSanserif()
Font list for Sans-Serif. |
String |
getFontsScript()
Font list for Script. |
String |
getFontsSerif()
Font list for Serif (the default MathML font). |
Color |
getForeground()
|
int |
getHorizontalAlignment()
Horizontal alignment, as defined by JLabel.getHorizontalAlignment() . |
MutableLayoutContext |
getParameters()
|
MathComponentUI |
getUI()
|
String |
getUIClassID()
|
int |
getVerticalAlignment()
Vertical alignment, as defined by JLabel.getVerticalAlignment() . |
void |
setBackground(Color c)
|
void |
setContent(String contentString)
Set the content from a String containing the MathML content. |
void |
setDebug(boolean dbg)
Enables, or disables the debug mode. |
void |
setDocument(Node doc)
|
void |
setFont(Font f)
Deprecated. use separate setters. |
void |
setFontsDoublestruck(String newFonts)
Font list for Doublestruck. |
void |
setFontsFraktur(String newFonts)
Font list for Fraktur. |
void |
setFontSize(float fontSize)
sets the font size used. |
void |
setFontsMonospaced(String newFonts)
Font list for Monospaced. |
void |
setFontsSanserif(String newFonts)
Font list for Sans-Serif. |
void |
setFontsScript(String newFonts)
Font list for Script. |
void |
setFontsSerif(String newFonts)
Font list for Serif (the default MathML font). |
void |
setForeground(Color fg)
|
void |
setHorizontalAlignment(int hAlignment)
Horizontal alignment, as defined by JLabel.setHorizontalAlignment(int) . |
void |
setOpaque(boolean opaque)
|
void |
setParameter(Parameter key,
Object newValue)
Sets a generic rendering parameter. |
void |
setParameters(Map<Parameter,Object> newValues)
Sets generic rendering parameters. |
void |
setSize(int width,
int height)
|
void |
setVerticalAlignment(int vAlignment)
Vertical alignment, as defined by JLabel.setVerticalAlignment(int) . |
void |
updateUI()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public JMathComponent()
public JMathComponent(CursorListener listener)
listener
- cursor listener instanceMethod Detail |
---|
public CursorListener getCursorListener()
public String getContent()
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.
public Node getDocument()
public String getFontsDoublestruck()
Parameter#FontsDoublestruck
for an explanation of this
parameter.
Parameter#FontsDoublestruck
public String getFontsFraktur()
Parameter#FontsFraktur
for an
explanation of this parameter.
Parameter#FontsFraktur
public float getFontSize()
public String getFontsMonospaced()
Parameter#FontsMonospaced
for an explanation of this parameter.
Parameter#FontsMonospaced
public String getFontsSanserif()
Parameter#FontsSanserif
for an explanation of this parameter.
Parameter#FontsSanserif
public String getFontsScript()
Parameter#FontsScript
for an
explanation of this parameter.
Parameter#FontsScript
public String getFontsSerif()
Parameter#FontsSerif
for an explanation of this parameter.
Parameter#FontsSerif
public Color getForeground()
getForeground
in class Component
public int getHorizontalAlignment()
JLabel.getHorizontalAlignment()
.
Supported are: SwingConstants.LEADING
,
SwingConstants.LEFT
, SwingConstants.CENTER
,
SwingConstants.TRAILING
, SwingConstants.RIGHT
.
JLabel.getHorizontalAlignment()
public MathComponentUI getUI()
public String getUIClassID()
getUIClassID
in class JComponent
public int getVerticalAlignment()
JLabel.getVerticalAlignment()
.
Supported are: SwingConstants.TOP
,
SwingConstants.CENTER
, SwingConstants.BOTTOM
.
JLabel.getVerticalAlignment()
public void setBackground(Color c)
setBackground
in class JComponent
public void setContent(String contentString)
contentString
- the content to set.public void setDebug(boolean dbg)
dbg
- Debug mode.public void setDocument(Node doc)
doc
- the document to set@Deprecated public void setFont(Font f)
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.
setFont
in class JComponent
f
- font to set.setFontSize(float)
,
setFontsSerif(String)
public void setFontsDoublestruck(String newFonts)
Parameter.FONTS_DOUBLESTRUCK
for an explanation of this
parameter.
newFonts
- new list for Doublestruck (comma seraparated).Parameter.FONTS_DOUBLESTRUCK
public void setFontsFraktur(String newFonts)
Parameter.FONTS_FRAKTUR
for
an explanation of this parameter.
newFonts
- new list for Fraktur (comma seraparated).Parameter.FONTS_FRAKTUR
public void setParameter(Parameter key, Object newValue)
key
- Key for the parameternewValue
- newValuepublic void setParameters(Map<Parameter,Object> newValues)
newValues
- map of parameter keys to new valuespublic void setFontSize(float fontSize)
fontSize
- the font size.public void setFontsMonospaced(String newFonts)
Parameter.FONTS_MONOSPACED
for an explanation of this parameter.
newFonts
- new list for Monospaced (comma seraparated).Parameter.FONTS_MONOSPACED
public void setFontsSanserif(String newFonts)
Parameter.FONTS_SANSSERIF
for an explanation of this parameter.
newFonts
- new list for sansserif (comma seraparated).Parameter.FONTS_SANSSERIF
public void setFontsScript(String newFonts)
Parameter.FONTS_SCRIPT
for an
explanation of this parameter.
newFonts
- new list for Script (comma seraparated).Parameter.FONTS_SCRIPT
public void setFontsSerif(String newFonts)
Parameter.FONTS_SERIF
for an explanation of this parameter.
newFonts
- new list for serif (comma seraparated).Parameter.FONTS_SERIF
public void setForeground(Color fg)
setForeground
in class JComponent
public void setHorizontalAlignment(int hAlignment)
JLabel.setHorizontalAlignment(int)
.
Supported are: SwingConstants.LEADING
,
SwingConstants.LEFT
, SwingConstants.CENTER
,
SwingConstants.TRAILING
, SwingConstants.RIGHT
.
hAlignment
- the horizontalAlignment to setJLabel.setHorizontalAlignment(int)
public void setOpaque(boolean opaque)
setOpaque
in class JComponent
public void setVerticalAlignment(int vAlignment)
JLabel.setVerticalAlignment(int)
.
Supported are: SwingConstants.TOP
,
SwingConstants.CENTER
, SwingConstants.BOTTOM
.
vAlignment
- the verticalAlignment to setJLabel.setVerticalAlignment(int)
public void updateUI()
updateUI
in class JComponent
public MutableLayoutContext getParameters()
public void setSize(int width, int height)
setSize
in class Component
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |