...
Integrate TextualDisplay into your application
Some Below are some things to consider when integrating TextualDisplay into your application:.
HTMLScrollPane
To get the maximum support available in Swing, you should display your HTML only on the edu.stanford.slac.util.textdisp.ui.HTMLScrollPane widget, which is a subclass of javax.swing.JScrollPane and wraps the Flying Saucer web browser. Also, you might want to turn off the logging messages:
Code Block |
---|
System.setProperty("xr.util-logging.java.util.logging.ConsoleHandler.level", "OFF"); //do this ASAP HTMLScrollPane htmlScrollPane = new HTMLScrollPane(); Container myContainer = ...; ... //do layout myContainer.add(htmlScrollPane, ...); / String html = ...; htmlScrollPane.setStyledData(html); |
You have access to the wrapped browser widget:
Code Block |
---|
HTMLScrollPane htmlScrollPane = ...; htmlScrollPane.xhtmlPanel.incrementFontSize(); |
Note: TextDispViewer uses HTMLScrollPane.
Upload XSLT style sheets to a web server
When the infrastructure is ready, you might want to upload your XSLT style sheets to a web server. You can easily construct a URL in such case:
Code Block |
---|
URL url = new URL("http://...");
|
We recommend that you externalize all your URLs (or any strings, for that matter).