|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umd.cs.piccolo.PNode
edu.umd.cs.piccolo.nodes.PHtmlView
public class PHtmlView
PHtmlView is a Piccolo node for rendering HTML text. It uses a JLabel under the hood so you have the same restrictions regarding HTML as you have when using standard Swing components (HTML 3.2 + subset of CSS 1.0).
Nested Class Summary |
---|
Nested classes/interfaces inherited from class edu.umd.cs.piccolo.PNode |
---|
PNode.PSceneGraphDelegate |
Field Summary | |
---|---|
static Font |
DEFAULT_FONT
Default font if not otherwise specified in the HTML text, 12 point "SansSerif" . |
static Color |
DEFAULT_TEXT_COLOR
Default text color if not otherwise specified in the HTML text, Color.BLACK . |
static int |
PROPERTY_CODE_FONT
The property code that identifies a change of this node's font (see getFont ). |
static int |
PROPERTY_CODE_TEXT
The property code that identifies a change of this node's HTML text (see getText ). |
static int |
PROPERTY_CODE_TEXT_COLOR
The property code that identifies a change of this node's HTML text color (see getTextColor ). |
static String |
PROPERTY_FONT
The property name that identifies a change of this node's font (see getFont ). |
static String |
PROPERTY_TEXT
The property name that identifies a change of this node's HTML text (see getText ). |
static String |
PROPERTY_TEXT_COLOR
The property name that identifies a change of this node's HTML text color (see getTextColor ). |
Fields inherited from interface java.awt.print.Printable |
---|
NO_SUCH_PAGE, PAGE_EXISTS |
Constructor Summary | |
---|---|
PHtmlView()
Create an empty HTML text node with the default font and text color. |
|
PHtmlView(String text)
Create a HTML text node with the specified HTML text and the default font and text color. |
|
PHtmlView(String text,
Font font,
Color textColor)
Create a HTML text node with the specified HTML text, font, and text color. |
Method Summary | |
---|---|
Font |
getFont()
Return the font for this HTML text node. |
String |
getLinkAddressAt(double x,
double y)
Return the address specified in the HTML link at the specified x and y coordinates in this node's local coordinate system, if any. |
String |
getLinkAddressAt(Point2D point)
Return the address specified in the HTML link at the specified point in this node's local coordinate system, if any. |
String |
getText()
Return the HTML text for this HTML text node. |
Color |
getTextColor()
Return the text color for this HTML text node. |
protected void |
paint(PPaintContext paintContext)
Paint this node behind any of its children nodes. |
boolean |
setBounds(double x,
double y,
double width,
double height)
Set the bounds of this node to the given position and size. |
boolean |
setBounds(Rectangle2D newBounds)
Set the bounds of this node to the given value. |
void |
setFont(Font font)
Set the font for this HTML text node to font . |
void |
setText(String text)
Set the HTML text for this HTML text node to text . |
void |
setTextColor(Color textColor)
Set the text color for this HTML text node to textColor . |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final Font DEFAULT_FONT
"SansSerif"
.
public static final Color DEFAULT_TEXT_COLOR
Color.BLACK
.
public static final String PROPERTY_FONT
getFont
). Both old and new value will be set in any
property change event.
public static final int PROPERTY_CODE_FONT
getFont
). Both old and new value will be set in any
property change event.
public static final String PROPERTY_TEXT
getText
). Both old and new value will be set in any
property change event.
public static final int PROPERTY_CODE_TEXT
getText
). Both old and new value will be set in any
property change event.
public static final String PROPERTY_TEXT_COLOR
getTextColor
). Both old and new value will be set
in any property change event.
public static final int PROPERTY_CODE_TEXT_COLOR
getTextColor
). Both old and new value will be set
in any property change event.
Constructor Detail |
---|
public PHtmlView()
public PHtmlView(String text)
text
- HTML text for this HTML text nodepublic PHtmlView(String text, Font font, Color textColor)
text
- HTML text for this HTML text nodefont
- font for this HTML text nodetextColor
- text color for this HTML text nodeMethod Detail |
---|
public String getText()
public void setText(String text)
text
.
This is a bound property.
text
- HTML text for this HTML text nodepublic Font getFont()
DEFAULT_FONT
.
public void setFont(Font font)
font
. This font is
used to render the HTML text if not otherwise specified via CSS.
This is a bound property.
font
- font for this HTML text nodepublic Color getTextColor()
DEFAULT_TEXT_COLOR
.
public void setTextColor(Color textColor)
textColor
.
This text color is used to render the HTML text if not otherwise
specified via CSS.
This is a bound property.
textColor
- text color for this HTML text nodepublic boolean setBounds(double x, double y, double width, double height)
setBounds
in class PNode
x
- x position of boundsy
- y position of boundswidth
- width to apply to the boundsheight
- height to apply to the bounds
public boolean setBounds(Rectangle2D newBounds)
setBounds
in class PNode
newBounds
- bounds to apply to this node
protected void paint(PPaintContext paintContext)
The HTML text is painted last, so it will appear on top of any child nodes.
paint
in class PNode
paintContext
- the paint context to use for painting the nodepublic String getLinkAddressAt(Point2D point)
point
- point in this node's local coordinate system
null
if no
such HTML link existspublic String getLinkAddressAt(double x, double y)
x
- x coordinate in this node's local coordinate systemy
- y coordinate in this node's local coordinate system
null
if no such HTML link exists
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |