어떤 이유로 인해 내 HTML 페이지가 화면에 100 % 나타나지 않아 타이밍상의 문제인 것처럼 보입니다. scrollpane을 제거하고 EditorPane 만 사용하면 잘 작동합니다.editorPane (html)을 표시 할 때 scrollPane이 무작위로 회색으로 유지됩니다.
자바 애플릿 화면을 강제로 다시 그리기/새로 고치려면 아래 코드를 추가해야하며 모든 이미지가 실제로로드 될 때까지 기다릴 수 있습니까? GUI에서 텍스트를 볼 수있게되면 현재 이미지가 그려집니다.
(회색이 사라지고 난 창을 최대화 + 최소화 할 때없는 텍스트가 나타납니다.)
내가 m_editorPane.setEditorKitForContentType로 SynchronousHTMLEditorKit를 사용
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;
}
에 그들에게 전화? – willcodejavaforfood
위의 질문에 동기로드를 강제로 추가했습니다 – Tom
흠, 그냥 SynchronousHTMLEditorKit (이하 SHTMLEK라고 함)로 시도했지만 문제가 없습니다. 한 번에 두 페이지 이상을로드하고 있습니까? –