本文整理了Java中javax.swing.text.html.HTMLEditorKit.<init>()
方法的一些代码示例,展示了HTMLEditorKit.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HTMLEditorKit.<init>()
方法的具体详情如下:
包路径:javax.swing.text.html.HTMLEditorKit
类名称:HTMLEditorKit
方法名:<init>
暂无
代码示例来源:origin: spotbugs/spotbugs
public static void convertHtmlToText(Reader reader, Writer writer) throws IOException, BadLocationException {
EditorKit kit = new HTMLEditorKit();
HTMLDocument doc = new HTMLDocument();
kit.read(reader, doc, 0);
HTMLtoPlainTextWriter2 x = new HTMLtoPlainTextWriter2(writer, doc);
x.write();
writer.close();
}
代码示例来源:origin: stackoverflow.com
JTextPane text_panel = new JTextPane();
HTMLEditorKit kit = new HTMLEditorKit();
HTMLDocument doc = new HTMLDocument();
text_panel.setEditorKit(kit);
text_panel.setDocument(doc);
kit.insertHTML(doc, doc.getLength(), "<b>hello", 0, 0, HTML.Tag.B);
kit.insertHTML(doc, doc.getLength(), "<font color='red'><u>world</u></font>", 0, 0, null);
代码示例来源:origin: stackoverflow.com
JEditorPane editorPane =
new JEditorPane(new HTMLEditorKit().getContentType(),text);
editorPane.setText(text);
Font font = new Font("Segoe UI", Font.PLAIN, 24));
String bodyRule = "body { font-family: " + font.getFamily() + "; " +
"font-size: " + font.getSize() + "pt; }";
((HTMLDocument)editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
代码示例来源:origin: org.netbeans.api/org-openide-dialogs
public FixedHeightPane () {
super ();
setEditable(false);
HTMLEditorKit htmlkit = new HTMLEditorKit();
代码示例来源:origin: stackoverflow.com
editorPane.setContentType("text/html");
HTMLEditorKit kit = new HTMLEditorKit();
editorPane.setEditorKit(kit);
File cssfile = new File("src/Assets/code.css");
StyleSheet styleSheet = kit.getStyleSheet();
styleSheet.importStyleSheet(cssfile.toURI().toURL());
editorPane.setText("<html><head></head><body><pre></pre></body></html>");
代码示例来源:origin: fr.ifremer/isis-fish
protected void init() {
String REGISTER_KEY_URL = "https://labs.libre-entreprise.org/account/editsshkeys.php";
String DOC_URL = "http://isis-fish.labs.libre-entreprise.org/isis-fish/v3/user/addSshKey.html";
StringBuilder builder = new StringBuilder();
builder.append("<a href='").append(DOC_URL).append("'>");
builder.append(t("isisfish.vcs.howto.save.key")).append("</a><br/>");
builder.append("<a href='").append(REGISTER_KEY_URL).append("'>");
builder.append(t("isisfish.vcs.save.key")).append("</a>");
helpEditor.setEditorKit(new HTMLEditorKit());
helpEditor.setText(builder.toString());
}
代码示例来源:origin: stackoverflow.com
final HTMLEditorKit htmlKit = new HTMLEditorKit();
final JTextPane textPane = new JTextPane( );
textPane.setEditorKit(htmlKit);
textPane.setEditable(true);
JScrollPane scrollPane = new JScrollPane( textPane );
Document doc = textPane.getDocument();
System.out.println(doc.getClass().getName()); // It's an HTML Document
代码示例来源:origin: igniterealtime/Spark
/**
* Creates a new CoBrowser object to be used with the specifid ChatRoom.
*/
public HTMLViewer() {
final JPanel mainPanel = new JPanel();
browser = new JEditorPane();
browser.setEditorKit(new HTMLEditorKit());
setLayout(new GridBagLayout());
this.add(mainPanel, new GridBagConstraints(0, 2, 1, 1, 1.0, 1.0, GridBagConstraints.WEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, 0));
}
代码示例来源:origin: freeplane/freeplane
public HtmlProcessor(final String input){
final HTMLEditorKit kit = new HTMLEditorKit();
doc = kit.createDefaultDocument();
try {
final int defaultDocumentLength = doc.getLength();
kit.read(new StringReader(input), doc, defaultDocumentLength);
} catch (Exception e) {
}
}
public String htmlSubstring(int pos, int length){
代码示例来源:origin: net.java.abeille/abeille
public void createCreditsPanel() {
JEditorPane editor = (JEditorPane) m_view.getComponentByName(AboutViewNames.ID_CREDITS);
editor.setEditorKit(new javax.swing.text.html.HTMLEditorKit());
try {
java.net.URL url = AboutView.class.getClassLoader().getResource("com/jeta/swingbuilder/resources/help/credits.htm");
editor.setPage(url);
editor.setEditable(false);
} catch (Exception e) {
e.printStackTrace();
}
}
代码示例来源:origin: nroduit/Weasis
public static HTMLEditorKit buildHTMLEditorKit(JComponent component) {
Objects.requireNonNull(component);
HTMLEditorKit kit = new HTMLEditorKit();
StyleSheet ss = kit.getStyleSheet();
ss.addRule("body {font-family:sans-serif;font-size:12pt;background-color:#" //$NON-NLS-1$
+ Integer.toHexString((component.getBackground().getRGB() & 0xffffff) | 0x1000000).substring(1) + ";color:#" //$NON-NLS-1$
+ Integer.toHexString((component.getForeground().getRGB() & 0xffffff) | 0x1000000).substring(1)
+ ";margin:3;font-weight:normal;}"); //$NON-NLS-1$
return kit;
}
代码示例来源:origin: stackoverflow.com
String rtf = [your document rich text];
BufferedReader input = new BufferedReader(new StringReader(rtf));
RTFEditorKit rtfKit = new RTFEditorKit();
StyledDocument doc = (StyledDocument) rtfKit.createDefaultDocument();
rtfEdtrKt.read( input, doc, 0 );
input.close();
HTMLEditorKit htmlKit = new HTMLEditorKit();
StringWriter output = new StringWriter();
htmlKit.write( output, doc, 0, doc.getLength());
String html = output.toString();
代码示例来源:origin: org.freehep/freehep-graphicsio-tests
public TestHTML(String[] args) throws Exception {
super(args);
setName("HTML");
text = "<Vector<sup><b>Graphics</b></sup> & Adapter<i><sub>Card</sub></i> "
+ "= e<sup>x<sup>2</sup>y<sup>3</sup></sup>>";
JEditorPane pane = new JEditorPane();
pane.setContentType("text/html");
pane.setEditorKit(new HTMLEditorKit());
pane.setText(text);
pane.setEditable(false);
add(pane);
}
代码示例来源:origin: stackoverflow.com
EditorKit kit = new HTMLEditorKit();
HTMLDocument doc = (HTMLDocument)kit.createDefaultDocument();
doc.putProperty("IgnoreCharsetDirective", Boolean.TRUE);
kit.read(reader, doc, 0);
HTMLDocument.Iterator it = doc.getIterator(HTML.Tag.A);
while (it.isValid())
{
SimpleAttributeSet s = (SimpleAttributeSet)it.getAttributes();
String href = (String)s.getAttribute(HTML.Attribute.HREF);
System.out.println( href );
it.next();
}
代码示例来源:origin: stackoverflow.com
JEditorPane jEditorPane = new JEditorPane();
HTMLEditorKit kit = new HTMLEditorKit();
StyleSheet styleSheet = kit.getStyleSheet();
styleSheet.addRule("A {color:red}"); //change links to red
jEditorPane.setEditorKit(kit);
代码示例来源:origin: com.google.code.findbugs/findbugs
public static void convertHtmlToText(Reader reader, Writer writer) throws IOException, BadLocationException {
EditorKit kit = new HTMLEditorKit();
HTMLDocument doc = new HTMLDocument();
kit.read(reader, doc, 0);
HTMLtoPlainTextWriter2 x = new HTMLtoPlainTextWriter2(writer, doc);
x.write();
writer.close();
}
代码示例来源:origin: stackoverflow.com
HTMLDocument doc = new HTMLDocument();
HTMLEditorKit kit = new HTMLEditorKit();
jEditorPane.setDocument(doc);
jEditorPane.setEditorKit(kit);
kit.insertHTML(doc, doc.getLength(), "<label> This label will be inserted inside the body directly </label>", 0, 0, null);
kit.insertHTML(doc, doc.getLength(), "<br/>", 0, 0, null);
kit.insertHTML(doc, doc.getLength(), putYourVariableHere, 0, 0, null);
代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-makeproject
/** Creates new form SelectModePanel */
public SelectModePanel(SelectModeDescriptorPanel controller) {
this.controller = controller;
initComponents();
instructions.setEditorKit(new HTMLEditorKit());
instructions.setBackground(instructionPanel.getBackground());
disableHostSensitiveComponents();
refreshRunnable = new RefreshRunnable();
refreshSourceFolderTask = RP2.create(refreshRunnable);
addListeners();
}
代码示例来源:origin: org.gephi/ui-components
public JHTMLEditorPane() {
super();
setEditorKit(new HTMLEditorKit());
setEditable(false);
setOpaque(true);
setAutoscrolls(true);
addHyperlinkListener(this);
setTransferHandler(new HTMLTextAreaTransferHandler());
setFont(UIManager.getFont("Label.font")); //NOI18N
addMouseListener(this);
}
代码示例来源:origin: com.google.code.findbugs/findbugs
private void setStyleSheets() {
StyleSheet styleSheet = new StyleSheet();
styleSheet.addRule("body {font-size: " + Driver.getFontSize() + "pt}");
styleSheet.addRule("H1 {color: red; font-size: 120%; font-weight: bold;}");
styleSheet.addRule("code {font-family: courier; font-size: " + Driver.getFontSize() + "pt}");
styleSheet.addRule(" a:link { color: #0000FF; } ");
styleSheet.addRule(" a:visited { color: #800080; } ");
styleSheet.addRule(" a:active { color: #FF0000; text-decoration: underline; } ");
HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
htmlEditorKit.setStyleSheet(styleSheet);
mainFrame.summaryHtmlArea.setEditorKit(htmlEditorKit);
}
内容来源于网络,如有侵权,请联系作者删除!