I want to be able to load an HTML document from the Internet, display it in a JEditorPane and have it styled in Java using both an external CSS file and/or from any <style>...</style>
tags. What I'm doing right now is using jEditorPane.setPage(URL);
and it's not correctly styled.
Based on the JavaDoc - jEditorPane supports the bleeding edge HTML 3.2 and CSS1 so the short answer is, you really don't want to try rendering modern web pages with it.
However, you may be able to do this:
import javax.swing.text.html.HTMLEditorKit;
import javax.swing.text.html.StyleSheet;
HTMLEditorKit kit = new HTMLEditorKit();
jEditorPane.setEditorKit(kit);
URL url = new URL(location of your stylesheet);
StyleSheet styleSheet = new StyleSheet();
styleSheet.importStyleSheet(url)
kit.setStyleSheet(styleSheet);