diff options
| author | unknown <james.jenour@protonmail.com> | 2020-05-31 01:59:47 +1000 |
|---|---|---|
| committer | unknown <james.jenour@protonmail.com> | 2020-05-31 01:59:47 +1000 |
| commit | de97f55968d183cc7d76aad87e3b27d382bfdbc9 (patch) | |
| tree | eab5e7769069f31b79016e3702855ebb9f614a8e /src/main/java/io/github/moulberry/notenoughupdates/util/SynchronousHTMLEditorKit.java | |
| download | notenoughupdates-de97f55968d183cc7d76aad87e3b27d382bfdbc9.tar.gz notenoughupdates-de97f55968d183cc7d76aad87e3b27d382bfdbc9.tar.bz2 notenoughupdates-de97f55968d183cc7d76aad87e3b27d382bfdbc9.zip | |
1.5
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/util/SynchronousHTMLEditorKit.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/util/SynchronousHTMLEditorKit.java | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/util/SynchronousHTMLEditorKit.java b/src/main/java/io/github/moulberry/notenoughupdates/util/SynchronousHTMLEditorKit.java new file mode 100644 index 00000000..7f02baa7 --- /dev/null +++ b/src/main/java/io/github/moulberry/notenoughupdates/util/SynchronousHTMLEditorKit.java @@ -0,0 +1,36 @@ +package io.github.moulberry.notenoughupdates.util; + +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; +import javax.swing.text.html.HTMLEditorKit.HTMLFactory; + +public class SynchronousHTMLEditorKit extends HTMLEditorKit { + public SynchronousHTMLEditorKit() { + } + + public Document createDefaultDocument() { + HTMLDocument doc = (HTMLDocument)super.createDefaultDocument(); + doc.setAsynchronousLoadPriority(-1); + return doc; + } + + public ViewFactory getViewFactory() { + return new HTMLFactory() { + public View create(Element elem) { + View view = super.create(elem); + if (view instanceof ImageView) { + //((ImageView)view).setLoadsSynchronously(true); + } + + return view; + } + }; + } + + +} |
