# QHTML Demo

## What Is It

This is set of classes that extends Java's default HTML Swing renderer to support newer CSS features (discussed below).

This doesn't fully support any particular CSS version, so this is not intended to be used for arbitrary pages. The intended usage for these classes is to present HTML that you have complete control over, such as a set of help pages.

## How To Use It

Installing this architecture is simple:

    JEditorPane textPane = new JEditorPane();
    HTMLEditorKit kit = new QHTMLEditorKit();
    textPane.setEditorKit(kit);

## How It Works

This extends Swing's existing `HTMLEditorKit` to support newer CSS features.

## Discussion

### Context

Swing has included HTML support for decades, but it has been conspicuously limited (and therefore dated). The `QHTMLEditorKit` is an attempt to spruce up the appearance of the HTML without completely reinventing the rendering engine.

Other resources you might want to consider include:

1. Flying Saucer can also render HTML to Swing panels (in addition to other formats).
2. JavaFX can embed a WebKit in a JComponent. The underlying implementation varies by platform.

### Feature Support

Below is a (approximate) set of features the QHTML classes support:

- Base64 encoded images
- The text-shadow CSS property
- The background-image CSS property is supported for "url", "linear-gradient", and "none", including layered combinations.
- The color data type supports "rgb", "rgba", "hsl", "hsla", 4 and 8 digit hex Strings, and all named colors up to CSS module 4 (such as "tomato" and "plum").
- The background-clip CSS property (including "text").
- The border-radius CSS property.
- The min-width and max-width CSS property.
- The line-height CSS property.

Also these classes support base64-encoding of our custom JVG file format, which is used in some of the help documentation in the showcase app to embed vector graphics.