1 package org.columba.core.gui.externaltools; 17 18 import java.awt.BorderLayout ; 19 import java.awt.Font ; 20 import java.net.URL ; 21 22 import javax.swing.JComponent ; 23 import javax.swing.JPanel ; 24 import javax.swing.JScrollPane ; 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 import net.javaprog.ui.wizard.AbstractStep; 31 import net.javaprog.ui.wizard.DataModel; 32 33 import org.columba.core.gui.util.URLLabel; 34 import org.columba.core.resourceloader.GlobalResourceLoader; 35 36 37 46 class DescriptionStep extends AbstractStep { 47 private static final String RESOURCE_PATH = "org.columba.core.i18n.dialog"; 48 protected DataModel data; 49 50 54 public DescriptionStep(DataModel data) { 55 super(GlobalResourceLoader.getString(RESOURCE_PATH, "externaltools", 56 "DescriptionStep.title"), 57 GlobalResourceLoader.getString(RESOURCE_PATH, "externaltools", 58 "DescriptionStep.description")); 59 60 this.data = data; 61 } 62 63 66 protected JComponent createComponent() { 67 JPanel panel = new JPanel (); 68 panel.setLayout(new BorderLayout ()); 69 70 AbstractExternalToolsPlugin plugin = (AbstractExternalToolsPlugin) data.getData( 71 "Plugin"); 72 73 Font font = UIManager.getFont("Label.font"); 74 String name = font.getName(); 75 int size = font.getSize(); 76 77 JTextPane textPane = new JTextPane (); 78 HTMLEditorKit editorKit = new HTMLEditorKit (); 79 StyleSheet styles = new StyleSheet (); 80 String css = "<style type=\"text/css\"><!--p {font-family:\"" + name + 81 "\"; font-size:\"" + size + "pt\"}--></style>"; 82 styles.addRule(css); 83 editorKit.setStyleSheet(styles); 84 85 textPane.setEditorKit(editorKit); 86 87 textPane.setText(plugin.getDescription()); 88 textPane.setCaretPosition(0); 89 textPane.setEditable(false); 90 91 JScrollPane sp = new JScrollPane (textPane); 92 93 panel.add(sp, BorderLayout.CENTER); 94 95 URL url = plugin.getWebsite(); 96 97 if (url != null) { 98 panel.add(new URLLabel(url), BorderLayout.SOUTH); 99 } 100 101 return panel; 102 } 103 104 107 public void prepareRendering() { 108 } 109 } 110 | Popular Tags |