-
Notifications
You must be signed in to change notification settings - Fork 70
Expand file tree
/
Copy pathSynchronousHTMLEditorKit.java
More file actions
37 lines (32 loc) · 998 Bytes
/
SynchronousHTMLEditorKit.java
File metadata and controls
37 lines (32 loc) · 998 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package gui.ava.html.image;
import javax.swing.text.Document;
import javax.swing.text.Element;
import javax.swing.text.View;
import javax.swing.text.ViewFactory;
import javax.swing.text.html.HTMLDocument;
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.ImageView;
/**
* @author Yoav Aharoni
*/
public class SynchronousHTMLEditorKit extends HTMLEditorKit {
@Override
public Document createDefaultDocument() {
HTMLDocument doc = (HTMLDocument) super.createDefaultDocument();
doc.setAsynchronousLoadPriority(-1);
return doc;
}
@Override
public ViewFactory getViewFactory() {
return new HTMLFactory() {
@Override
public View create(Element elem) {
View view = super.create(elem);
if (view instanceof ImageView imageView) {
imageView.setLoadsSynchronously(true);
}
return view;
}
};
}
}