public class Symbol
extends java.lang.Object
implements javax.swing.Icon
Mask
).
getPredefinedSymbol(PredefinedSymbol)
to get a predefined symbol.
Symbol
and override getIconHeight()
, getIconWidth()
and paintIcon(Component, Graphics, int, int)
.
Symbol(Icon)
.
In this case you do not need to create custom painting or something else.Modifier and Type | Class and Description |
---|---|
static class |
Symbol.PredefinedSymbol
Predefined symbols.
|
Constructor and Description |
---|
Symbol()
Creates a new custom symbol.
|
Symbol(javax.swing.Icon symbol)
Creates a new symbol based on a loaded icon.
|
Modifier and Type | Method and Description |
---|---|
static Symbol |
createLaTeXSymbol(java.lang.String latexExpr)
Creates a latex symbol using a font size of
10.0f . |
static Symbol |
createLaTeXSymbol(java.lang.String latexExpr,
float fontSize)
Creates a latex symbol.
|
int |
getIconHeight()
Gets the symbol height.
|
int |
getIconWidth()
Gets the symbol width.
|
static Symbol |
getPredefinedSymbol(Symbol.PredefinedSymbol symbol)
Gets a predefined symbol.
|
void |
paintIcon(java.awt.Component comp,
java.awt.Graphics g,
int x,
int y)
Paints the symbol.
|
public Symbol()
getIconHeight()
, getIconWidth()
and paintIcon(Component, Graphics, int, int)
.public Symbol(javax.swing.Icon symbol)
symbol
- the icon that should be used as the symbolpublic static Symbol getPredefinedSymbol(Symbol.PredefinedSymbol symbol) throws java.lang.IllegalArgumentException
symbol
- the predefined symbol typenull
if the symbol is not defined (all predefined symbols are defined)java.lang.IllegalArgumentException
- public static Symbol createLaTeXSymbol(java.lang.String latexExpr) throws java.lang.IllegalArgumentException
10.0f
.latexExpr
- the latex expression of the symboljava.lang.IllegalArgumentException
- public static Symbol createLaTeXSymbol(java.lang.String latexExpr, float fontSize) throws java.lang.IllegalArgumentException
latexExpr
- the latex expression of the symbolfontSize
- the font size of the latex symboljava.lang.IllegalArgumentException
- <= 0.0f
public int getIconHeight()
getIconHeight
in interface javax.swing.Icon
public int getIconWidth()
getIconWidth
in interface javax.swing.Icon
public void paintIcon(java.awt.Component comp, java.awt.Graphics g, int x, int y)
paintIcon
in interface javax.swing.Icon
comp
- the component that invokes painting or null
g
- the graphics contextx
- the x positiony
- the y position