1 19 package org.columba.core.gui.util; 20 21 import java.awt.Font ; 22 import java.io.IOException ; 23 import java.net.URL ; 24 25 import javax.swing.JTextPane ; 26 import javax.swing.UIManager ; 27 import javax.swing.text.html.HTMLEditorKit ; 28 import javax.swing.text.html.StyleSheet ; 29 30 35 public class InfoViewTextPane extends JTextPane { 36 37 40 public InfoViewTextPane() { 41 super(); 42 43 HTMLEditorKit editorKit = new HTMLEditorKit (); 44 StyleSheet styles = new StyleSheet (); 45 46 Font font = UIManager.getFont("Label.font"); 47 String name = font.getName(); 48 int size = font.getSize(); 49 String css = "<style type=\"text/css\"><!--p {font-family:\"" + name 50 + "\"; font-size:\"" + size + "pt\"}--></style>"; 51 styles.addRule(css); 52 editorKit.setStyleSheet(styles); 53 54 setEditorKit(editorKit); 55 } 56 57 60 public InfoViewTextPane(URL url) throws IOException { 61 this(); 62 setPage(url); 63 } 64 } 65 | Popular Tags |