javax.swing.plaf.basic

Class BasicHTML


public class BasicHTML
extends Object

Provides support for HTML rendering to ComponentUI implementations.

Field Summary

static String
documentBaseKey
The key that is used to store the document base in a JComponent's client properties.
static String
propertyKey
The key that is used to store a HTML view in a JComponent's client properties.

Constructor Summary

BasicHTML()
Creates a new instance of BasicHTML.

Method Summary

static View
createHTMLView(JComponent c, String html)
Creates a View instance that can be used by the component c to render the HTML string html.
static boolean
isHTMLString(String s)
Returns true if s is HTML, false otherwise.
static void
updateRenderer(JComponent c, String text)
Stores a HTML renderer in c's client property if text is HTML, otherwise it clears the corresponding client property.

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Details

documentBaseKey

public static final String documentBaseKey
The key that is used to store the document base in a JComponent's client properties. The document base is used to resolve relative references in HTML.
Field Value:
"html.base"

propertyKey

public static final String propertyKey
The key that is used to store a HTML view in a JComponent's client properties.
Field Value:
"html"

Constructor Details

BasicHTML

public BasicHTML()
Creates a new instance of BasicHTML. This should not be necessary since all methods in this class are static.

Method Details

createHTMLView

public static View createHTMLView(JComponent c,
                                  String html)
Creates a View instance that can be used by the component c to render the HTML string html.
Parameters:
c - the component that needs to render the HTML string
html - the HTML string to be rendered
Returns:
a view that can render the HTML string

isHTMLString

public static boolean isHTMLString(String s)
Returns true if s is HTML, false otherwise.
Parameters:
s - the string to test
Returns:
true if s is HTML, false otherwise

updateRenderer

public static void updateRenderer(JComponent c,
                                  String text)
Stores a HTML renderer in c's client property if text is HTML, otherwise it clears the corresponding client property. This is useful for ComponentUI implementations that are shared between it's components.
Parameters:
c - the component to update the renderer for
text - the string to be rendered

BasicHTML.java -- Provides HTML support to ComponentUI implementations Copyright (C) 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. GNU Classpath is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Classpath is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Linking this library statically or dynamically with other modules is making a combined work based on this library. Thus, the terms and conditions of the GNU General Public License cover the whole combination. As a special exception, the copyright holders of this library give you permission to link this library with independent modules to produce an executable, regardless of the license terms of these independent modules, and to copy and distribute the resulting executable under terms of your choice, provided that you also meet, for each linked independent module, the terms and conditions of the license of that module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version.