Behöver kunna skriva ut ett dokument som är formaterat via html. Inga problem att skriva ut det via en JEditorPane, så det funkar så långt.
Har däremot dessa frågor:
1.
Finns det nåt sätt att skriva ut innehållet i JEditorPane utan att först göra den synlig?
Det går iofs att lägga den utanför skärmen men det känns verkligen osnyggt.
2.
Går det att nånstans skicka in HTML strängen till JEditorPane utan att först skriva ner till fil för att sen peka till den som en URL?
Känns också väldigt onödigt.
JEditorPane
public JEditorPane(String type,
String text)Creates a JEditorPane that has been initialized to the given text. This is a convenience constructor that calls the setContentType and setText methods.
Parameters:
type - mime type of the given text
text - the text to initialize with; may be null
Throws:
NullPointerException - if the type parameter is null
Alltså borde det gå att göra med new JEditorPane("text/html", "<HTML></HTML>");"
alternativt med JEditorPane htmlPane = new JEditorPane();
htmlPane.setContentType("text/html");
htmlPane.setText("<html></html>");