|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--uci.gef.Fig
|
+--uci.gef.FigText
This class handles painting and editing text Fig's in a LayerDiagram. Needs-More-Work: should eventually allow styled text editing, ... someday...
| Field Summary | |
protected boolean |
_allowsTab
|
protected int |
_botMargin
|
protected String |
_curText
The current string to display. |
protected boolean |
_editable
True if the text should be editable. |
protected boolean |
_expandOnly
True if the FigText can only grow in size, never shrink. |
protected FontMetrics |
_fm
|
protected Font |
_font
Font info. |
protected int |
_justification
Text justification can be JUSTIFY_LEFT, JUSTIFY_RIGHT, or JUSTIFY_CENTER. |
protected int |
_leftMargin
|
protected int |
_lineHeight
|
protected int |
_lineSpacing
Extra spacing between lines. |
protected boolean |
_multiLine
True if more than one line of text is allow. |
protected int |
_rightMargin
|
protected Color |
_textColor
Color of the actual text characters. |
protected Color |
_textFillColor
Color to be drawn behind the actual text characters. |
protected boolean |
_textFilled
True if the area behind individual characters is to be filled with TextColor. |
protected int |
_topMargin
Internal margins between the text and the edge of the rectangle. |
protected boolean |
_underline
True if the text should be underlined. |
static int |
JUSTIFY_CENTER
|
static int |
JUSTIFY_LEFT
Constants to specify text justification. |
static int |
JUSTIFY_RIGHT
|
static int |
MIN_TEXT_WIDTH
Minimum size of a FigText object. |
| Fields inherited from class uci.gef.Fig |
_dashes,
_fillColor,
_filled,
_group,
_h,
_layer,
_lineColor,
_lineWidth,
_locked,
_w,
_x,
_y,
BORDER,
DASH_ARRAYS,
DASHED_CHOICES,
MIN_SIZE |
| Constructor Summary | |
FigText(int x,
int y,
int w,
int h)
Construct a new FigText with the given position, size, and attributes. |
|
FigText(int x,
int y,
int w,
int h,
Color textColor,
String familyName,
int fontSize)
Construct a new FigText with the given position, size, color, string, font, and font size. |
|
| Method Summary | |
void |
append(char c)
Append a character to the current String . |
void |
append(String s)
Append the given String to the current String. |
void |
calcBounds()
Compute the overall width and height of the FigText object based on the font, font size, and current text. |
void |
deleteLastChar()
Delete the last char from the current string. |
String |
deleteLastCharFromString(String s)
Remove the last char from the current string line and return the new string. |
boolean |
getAllowsTab()
|
boolean |
getBold()
|
int |
getBotMargin()
|
boolean |
getEditable()
|
boolean |
getExpandOnly()
|
Font |
getFont()
|
String |
getFontFamily()
|
int |
getFontSize()
|
boolean |
getItalic()
|
int |
getJustification()
|
String |
getJustificationByName()
Reply a string that indicates how the text is justified: Left, Center, or Right. |
int |
getLeftMargin()
|
int |
getLineSpacing()
|
Dimension |
getMinimumSize()
|
boolean |
getMultiLine()
|
int |
getRightMargin()
|
String |
getText()
Get the String held by this FigText. |
Color |
getTextColor()
|
Color |
getTextFillColor()
|
boolean |
getTextFilled()
|
int |
getTopMargin()
|
boolean |
getUnderline()
|
boolean |
hit(Rectangle r)
Muse clicks are handled differentlty that the defi]ault Fig behavior so that it is easier to select text that is not filled. |
protected boolean |
isNonStartEditingKey(KeyEvent ke)
|
void |
keyPressed(KeyEvent ke)
This method handles backspace and enter. |
void |
keyReleased(KeyEvent ke)
Not used, does nothing. |
void |
keyTyped(KeyEvent ke)
When the user presses a key when a FigText is selected, that key should be added to the current string, or if the key was backspace, the last character is removed. |
void |
mouseClicked(MouseEvent me)
|
void |
mouseEntered(MouseEvent me)
|
void |
mouseExited(MouseEvent me)
|
void |
mousePressed(MouseEvent me)
|
void |
mouseReleased(MouseEvent me)
|
boolean |
OK()
Check the class invariant to make sure that this FigText is in a valid state. |
void |
paint(Graphics g)
Paint the FigText. |
void |
setAllowsTab(boolean b)
|
void |
setBold(boolean b)
|
void |
setBotMargin(int m)
|
void |
setEditable(boolean e)
|
void |
setExpandOnly(boolean b)
|
void |
setFont(Font f)
|
void |
setFontFamily(String familyName)
|
void |
setFontSize(int size)
|
void |
setItalic(boolean b)
|
void |
setJustifciaionByName(String justifyString)
Set the text justification given one of these strings: Left, Center, or Right. |
void |
setJustification(int align)
|
void |
setLeftMargin(int m)
|
void |
setLineSpacing(int s)
|
void |
setMultiLine(boolean b)
|
void |
setRightMargin(int m)
|
void |
setText(String s)
set the current String to be the given String. |
void |
setTextColor(Color c)
|
void |
setTextFillColor(Color c)
|
void |
setTextFilled(boolean b)
|
void |
setTopMargin(int m)
|
void |
setUnderline(boolean b)
|
FigTextEditor |
startTextEditor(InputEvent ie)
|
void |
stuffMinimumSize(Dimension d)
|
| Methods inherited from class java.lang.Object |
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
| Field Detail |
public static final int JUSTIFY_LEFT
public static final int JUSTIFY_RIGHT
public static final int JUSTIFY_CENTER
public static final int MIN_TEXT_WIDTH
protected Font _font
protected transient FontMetrics _fm
protected int _lineHeight
protected Color _textColor
protected Color _textFillColor
protected boolean _textFilled
protected boolean _editable
protected boolean _underline
protected boolean _multiLine
protected boolean _allowsTab
protected int _lineSpacing
protected int _topMargin
protected int _botMargin
protected int _leftMargin
protected int _rightMargin
protected boolean _expandOnly
protected int _justification
protected String _curText
| Constructor Detail |
public FigText(int x,
int y,
int w,
int h,
Color textColor,
String familyName,
int fontSize)
public FigText(int x,
int y,
int w,
int h)
| Method Detail |
public boolean OK()
public String getJustificationByName()
public void setJustifciaionByName(String justifyString)
public Color getTextColor()
public void setTextColor(Color c)
public Color getTextFillColor()
public void setTextFillColor(Color c)
public boolean getTextFilled()
public void setTextFilled(boolean b)
public boolean getEditable()
public void setEditable(boolean e)
public boolean getUnderline()
public void setUnderline(boolean b)
public int getJustification()
public void setJustification(int align)
public int getLineSpacing()
public void setLineSpacing(int s)
public int getTopMargin()
public void setTopMargin(int m)
public int getBotMargin()
public void setBotMargin(int m)
public int getLeftMargin()
public void setLeftMargin(int m)
public int getRightMargin()
public void setRightMargin(int m)
public boolean getExpandOnly()
public void setExpandOnly(boolean b)
public Font getFont()
public void setFont(Font f)
public String getFontFamily()
public void setFontFamily(String familyName)
public int getFontSize()
public void setFontSize(int size)
public boolean getItalic()
public void setItalic(boolean b)
public boolean getBold()
public void setBold(boolean b)
public void setMultiLine(boolean b)
public boolean getMultiLine()
public void setAllowsTab(boolean b)
public boolean getAllowsTab()
public String deleteLastCharFromString(String s)
public void deleteLastChar()
public void append(char c)
public void append(String s)
public void setText(String s)
public String getText()
public void paint(Graphics g)
public boolean hit(Rectangle r)
public Dimension getMinimumSize()
public void stuffMinimumSize(Dimension d)
public void keyTyped(KeyEvent ke)
public void keyPressed(KeyEvent ke)
public void keyReleased(KeyEvent ke)
protected boolean isNonStartEditingKey(KeyEvent ke)
public void mouseClicked(MouseEvent me)
public void mousePressed(MouseEvent me)
public void mouseReleased(MouseEvent me)
public void mouseEntered(MouseEvent me)
public void mouseExited(MouseEvent me)
public FigTextEditor startTextEditor(InputEvent ie)
public void calcBounds()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||