com.threerings.opengl.gui.text
Class HTMLView

java.lang.Object
  extended by com.threerings.opengl.gui.Component
      extended by com.threerings.opengl.gui.text.HTMLView
All Implemented Interfaces:
ConfigUpdateListener<ManagedConfig>

public class HTMLView
extends Component

Displays HTML using Java's HTML rendering support to layout and render the HTML. This is not a part of the text factory system as we're not going to write our own HTML renderer to avoid dependence on Sun's JDK. If you don't want to depend on that, don't use this class.

Note: width and height hints do not work. The Java HTML code doesn't seem to handle being sized to a particular width or height and then determining its preferred span along the other axis. So we always get the "natural" preferred size of the HTML without any forced wrapping. Of course if the component is forcibly made smaller, the HTML will be wrapped, but it may not fit in the vertical or horizontal space made available. Caveat user.


Field Summary
 
Fields inherited from class com.threerings.opengl.gui.Component
DEFAULT, DISABLED, HOVER
 
Constructor Summary
HTMLView(GlContext ctx)
          Creates a blank HTML view.
HTMLView(GlContext ctx, String stylesheet, String contents)
          Creates an HTML view with the specified contents.
 
Method Summary
 HTMLEditorKit getEditorKit()
          Returns the HTML editor kit used by this view.
 StyleSheet getStyleSheet()
          Returns the stylesheet in effect for this view.
 void setAntialiased(boolean antialias)
          Configures whether or not our text is antialiased.
 void setContents(HTMLDocument document)
          Configures the contents of this HTML view.
 void setContents(String contents)
          Configures the contents of this HTML view.
 void setStyleSheet(String stylesheet)
          Configures the stylesheet used to render HTML in this view.
 void setStyleSheet(StyleSheet stylesheet)
          Configures the stylesheet used to render HTML in this view.
 
Methods inherited from class com.threerings.opengl.gui.Component
acceptsFocus, addListener, boundsToString, configUpdated, contains, createDefaultTooltipComponent, createDefaultTooltipComponent, dispatchEvent, getAbsoluteX, getAbsoluteY, getAlpha, getBackground, getBorder, getBounds, getColor, getContext, getCursor, getFocusTarget, getHeight, getHitComponent, getInsets, getParent, getPreferredSize, getProperty, getState, getStyleConfigs, getTooltipText, getTooltipTimeout, getTooltipWindowStyle, getTransferHandler, getWidth, getX, getY, hasFocus, invalidate, isAdded, isEnabled, isHoverable, isShowing, isTooltipRelativeToMouse, isValid, isVisible, removeAllListeners, removeAllListeners, removeListener, render, requestFocus, scrollRectToVisible, setAlpha, setBackground, setBounds, setCursor, setEnabled, setHoverable, setLocation, setParent, setPreferredSize, setPreferredSize, setProperty, setSize, setStyleConfig, setStyleConfig, setStyleConfig, setStyleConfigs, setTooltipRelativeToMouse, setTooltipText, setTransferHandler, setVisible, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HTMLView

public HTMLView(GlContext ctx)
Creates a blank HTML view. The HTML contents can be set later with a call to setContents(java.lang.String).


HTMLView

public HTMLView(GlContext ctx,
                String stylesheet,
                String contents)
Creates an HTML view with the specified contents.

Method Detail

setAntialiased

public void setAntialiased(boolean antialias)
Configures whether or not our text is antialiased. Antialiasing is on by default.


setStyleSheet

public void setStyleSheet(String stylesheet)
Configures the stylesheet used to render HTML in this view.


setStyleSheet

public void setStyleSheet(StyleSheet stylesheet)
Configures the stylesheet used to render HTML in this view.


getStyleSheet

public StyleSheet getStyleSheet()
Returns the stylesheet in effect for this view.


getEditorKit

public HTMLEditorKit getEditorKit()
Returns the HTML editor kit used by this view.


setContents

public void setContents(String contents)
Configures the contents of this HTML view. This should be well-formed HTML which will be laid out according to the previously configured style sheet (which must be set before the contents).


setContents

public void setContents(HTMLDocument document)
Configures the contents of this HTML view.



Copyright © 2011. All Rights Reserved.