何らかの理由で、HTML ページが画面に 100% 表示されるはずですが、タイミングの問題のように見えます。スクロールペインを削除して EditorPane だけを使用すると、問題なく動作します。
Javaアプレット画面を強制的に再描画/更新するには、以下にどのようなコードを追加する必要がありますか?すべての画像が実際に読み込まれるまで何とか待つことができますか? 現在、GUI でテキストが表示された後、画像が少し描画されます。
(ウィンドウを最小化して最大化すると、灰色が消え、欠落したテキストが表示されます。)
SynchronousHTMLEditorKit を m_editorPane.setEditorKitForContentType として使用します
private JEditorPane m_editorPane = new JTextPane();
private JScrollPane m_scrollPane = new JScrollPane();
....
JEditorPane.registerEditorKitForContentType( "text/html", "SynchronousHTMLEditorKit" );
m_editorPane.setEditorKitForContentType( "text/html", new SynchronousHTMLEditorKit() );
m_editorPane.setPage(ResourceLoader.getURLforDataFile(file));
m_scrollPane.getViewport().add(m_editorPane);
m_scrollPane.validate();
m_scrollPane.repaint(); <-- does not seem to solve this
add(m_scrollPane);
/// add( m_editorPane) <-- this WORKS !!
SynchronousHTMLEditorKit
と定義されている:
public class SynchronousHTMLEditorKit extends HTMLEditorKit {
public Document createDefaultDocument(){
HTMLDocument doc = (HTMLDocument)(super.createDefaultDocument());
doc.setAsynchronousLoadPriority(-1); //do synchronous load
return doc;
}