package io.github.moulberry.notenoughupdates.util; import javax.swing.text.*; import javax.swing.text.html.*; import java.awt.*; import java.awt.geom.AffineTransform; public class LargeHTMLEditorKit extends HTMLEditorKit { ViewFactory factory = new MyViewFactory(); @Override public ViewFactory getViewFactory() { return factory; } public Document createDefaultDocument() { HTMLDocument doc = (HTMLDocument)super.createDefaultDocument(); doc.setAsynchronousLoadPriority(-1); return doc; } class MyViewFactory extends HTMLFactory { @Override public View create(Element elem) { AttributeSet attrs = elem.getAttributes(); Object elementName = attrs.getAttribute(AbstractDocument.ElementNameAttribute); Object o = (elementName != null) ? null : attrs.getAttribute(StyleConstants.NameAttribute); if (o instanceof HTML.Tag) { HTML.Tag kind = (HTML.Tag) o; if (kind == HTML.Tag.HTML) { return new HTMLBlockView(elem); } } View view = super.create(elem); if(view instanceof ImageView) { //((ImageView)view).setLoadsSynchronously(true); } return view; } } private class HTMLBlockView extends BlockView { public HTMLBlockView(Element elem) { super(elem, View.Y_AXIS); } @Override protected void layout(int width, int height) { if (width