javax.swing.text.html.HTMLEditorKit.getContentType()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中javax.swing.text.html.HTMLEditorKit.getContentType()方法的一些代码示例,展示了HTMLEditorKit.getContentType()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HTMLEditorKit.getContentType()方法的具体详情如下:
包路径:javax.swing.text.html.HTMLEditorKit
类名称:HTMLEditorKit
方法名:getContentType

HTMLEditorKit.getContentType介绍

暂无

代码示例

代码示例来源:origin: protegeproject/protege

  1. /**
  2. * Creates a JEditorPane suitable for showing HTML content
  3. * @param hyperlinkListener an optional hyperlink listener
  4. */
  5. public static JEditorPane createHTMLPane(HyperlinkListener hyperlinkListener) {
  6. JEditorPane editorPane = new JEditorPane(new HTMLEditorKit().getContentType(), "");
  7. // set the font to the same as a normal label
  8. Font font = UIManager.getFont("Label.font");
  9. String bodyRule = "body { font-family: " + font.getFamily() + "; " +
  10. "font-size: " + font.getSize() + "pt; }";
  11. ((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
  12. editorPane.setEditable(false);
  13. editorPane.setOpaque(false);
  14. if (hyperlinkListener != null){
  15. editorPane.addHyperlinkListener(hyperlinkListener);
  16. }
  17. return editorPane;
  18. }

代码示例来源:origin: edu.stanford.protege/org.protege.editor.core.application

  1. /**
  2. * Creates a JEditorPane suitable for showing HTML content
  3. * @param hyperlinkListener an optional hyperlink listener
  4. */
  5. public static JEditorPane createHTMLPane(HyperlinkListener hyperlinkListener) {
  6. JEditorPane editorPane = new JEditorPane(new HTMLEditorKit().getContentType(), "");
  7. // set the font to the same as a normal label
  8. Font font = UIManager.getFont("Label.font");
  9. String bodyRule = "body { font-family: " + font.getFamily() + "; " +
  10. "font-size: " + font.getSize() + "pt; }";
  11. ((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
  12. editorPane.setEditable(false);
  13. editorPane.setOpaque(false);
  14. if (hyperlinkListener != null){
  15. editorPane.addHyperlinkListener(hyperlinkListener);
  16. }
  17. return editorPane;
  18. }

代码示例来源:origin: org.protege/protege-editor-core-application

  1. /**
  2. * Creates a JEditorPane suitable for showing HTML content
  3. * @param hyperlinkListener an optional hyperlink listener
  4. */
  5. public static JEditorPane createHTMLPane(HyperlinkListener hyperlinkListener) {
  6. JEditorPane editorPane = new JEditorPane(new HTMLEditorKit().getContentType(), "");
  7. // set the font to the same as a normal label
  8. Font font = UIManager.getFont("Label.font");
  9. String bodyRule = "body { font-family: " + font.getFamily() + "; " +
  10. "font-size: " + font.getSize() + "pt; }";
  11. ((HTMLDocument) editorPane.getDocument()).getStyleSheet().addRule(bodyRule);
  12. editorPane.setEditable(false);
  13. editorPane.setOpaque(false);
  14. if (hyperlinkListener != null){
  15. editorPane.addHyperlinkListener(hyperlinkListener);
  16. }
  17. return editorPane;
  18. }

相关文章