public class TooltipJS extends Object
See this page for tooltip examples.
TooltipJS tooltip = new TooltipJS(); HTMLDoc htmlDoc = new HTMLDoc(); // Keep IE from going into quirks mode. htmlDoc.setDoctype(Doctype.HTML_4_01_TRANSITIONAL_NO_URL); HTML html = new HTML(); htmlDoc.setRootTag(html); html.getHead().addSubtag(Meta.CONTENT_TYPE_ISO_8859_1); // Add the necessary javascript to the page. html.getHead().addJavascript(tooltip.generateJS()); Body body = html.getBody(); body.br(2); // Create the target tag (in this case a span) the tooltip will function on. Span testSpan = body.addSpan("Test span"); // Create the tooltip content Pre tooltip1Content = new Pre("foobar and all that stuff\n"); tooltip1Content.addSpan("just grinds my axe!\n").setStyle(CSS.BOLD + CSS.fontSize(24)); // Attach the tooltip to the target. tooltip.addTooltip(testSpan, tooltip1Content.toHTML());
Constructor and Description |
---|
TooltipJS() |
Modifier and Type | Method and Description |
---|---|
void |
addTitleTooltip(XMLNode inTag)
Creates a tooltip using the tag's 'title' attribute as the tooltip text.
|
void |
addTooltip(XMLNode inTag,
String inValue)
Tooltips can be added to any tag which supports onmouseover and onmouseout.
|
String |
generateJS() |
TooltipJS |
setBackgroundColor(String inValue) |
TooltipJS |
setBorder(String inValue) |
TooltipJS |
setDelay(int inValue) |
TooltipJS |
setFont(String inValue) |
TooltipJS |
setFontColor(String inValue) |
TooltipJS |
setFontSize(String inValue) |
TooltipJS |
setMaxWidth(int inValue)
Sets the suggested maximum width for tooltips.
|
TooltipJS |
setMouseMove(boolean inValue)
Move the tooltip via onmousemove().
|
TooltipJS |
setPadding(int inValue) |
TooltipJS |
setShadowColor(String inValue) |
TooltipJS |
setShadowOffset(int inValue) |
TooltipJS |
setXOffset(int inValue) |
TooltipJS |
setYOffset(int inValue) |
public TooltipJS()
public TooltipJS setXOffset(int inValue)
public TooltipJS setYOffset(int inValue)
public TooltipJS setFontSize(String inValue)
public TooltipJS setFontColor(String inValue)
public TooltipJS setBackgroundColor(String inValue)
public TooltipJS setPadding(int inValue)
public TooltipJS setShadowColor(String inValue)
public TooltipJS setMaxWidth(int inValue)
inValue
- public TooltipJS setShadowOffset(int inValue)
public TooltipJS setMouseMove(boolean inValue)
public void addTooltip(XMLNode inTag, String inValue)
inTag
- the tag to which the onmouseover and onmouseout attributes will
be set to display a popup tooltip.inValue
- the text or HTML to display in the tooltip.public void addTitleTooltip(XMLNode inTag)
inTag
- the tag to which the onmouseover and onmouseout attributes will
be added in order to display the popup tooltip.public String generateJS()