// Create a JPanel subclass to render the page
final XHTMLPanel panel = new XHTMLPanel();
final Dimension orgSize = panel.getSize();
// we'll add a listener to note the preferred size as calculated by the render engine
panel.addDocumentListener(new DefaultDocumentListener() {
public void documentLoaded() {
frame.setTitle("Flying Saucer: " + panel.getDocumentTitle());
final Dimension dim = panel.getPreferredSize();
XRLog.general("Preferred size" + dim);