| | |
| | private HtmlPanel mView; |
| | + private JScrollPane mScrollPane; |
| | |
| | private String mBaseUriPath = ""; |
 |
| | // No need to append same prefix each time the HTML content is updated. |
| | mHtmlDocument.append( HTML_HEAD_OPEN ); |
| | - |
| | - // Inject an SVG renderer that produces high-quality SVG buffered images. |
| | - final var factory = new ChainedReplacedElementFactory(); |
| | - factory.addFactory( new SvgReplacedElementFactory() ); |
| | - factory.addFactory( new SwingReplacedElementFactory() ); |
| | |
| | invokeLater( () -> { |
| | mView = new HtmlPanel(); |
| | - final var scrollPane = new JScrollPane( mView ); |
| | + mScrollPane = new JScrollPane( mView ); |
| | |
| | - setContent( scrollPane ); |
| | + // Enabling the cache eliminates black background flashes. |
| | setCache( true ); |
| | setCacheHint( SPEED ); |
| | + setContent( mScrollPane ); |
| | + |
| | + final var factory = new ChainedReplacedElementFactory(); |
| | + factory.addFactory( new SvgReplacedElementFactory() ); |
| | + factory.addFactory( new SwingReplacedElementFactory() ); |
| | |
| | final var context = mView.getSharedContext(); |
 |
| | public void repaintScrollPane() { |
| | getScrollPane().repaint(); |
| | - } |
| | - |
| | - public JScrollBar getVerticalScrollBar() { |
| | - return getScrollPane().getVerticalScrollBar(); |
| | } |
| | |
 |
| | |
| | private JScrollPane getScrollPane() { |
| | - return (JScrollPane) getContent(); |
| | + return mScrollPane; |
| | + } |
| | + |
| | + public JScrollBar getVerticalScrollBar() { |
| | + return getScrollPane().getVerticalScrollBar(); |
| | } |
| | |
| | private int getVerticalScrollBarHeight() { |
| | - return getScrollPane().getVerticalScrollBar().getHeight(); |
| | + return getVerticalScrollBar().getHeight(); |
| | } |
| | } |