javax.swing.JEditorPane.createEditorKitForContentType()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(121)

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

JEditorPane.createEditorKitForContentType介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-cnd-source

private static EditorKit createEditorKit(String mimeType) {
  EditorKit kit;
  kit = JEditorPane.createEditorKitForContentType(mimeType);
  if (kit == null) {
    kit = new javax.swing.text.DefaultEditorKit();
  }
  return kit;
}

代码示例来源:origin: igvteam/igv

public VersionUpdateDialog(String versionString) {
  initComponents();
  messagePane.setEditorKit(JEditorPane.createEditorKitForContentType("text/html"));
  messagePane.setEditable(false);
  messagePane.setText("<strong>A later version of IGV is available  (" + versionString + ").<p/>Download from " +
      "<a href=" + Globals.downloadURL + ">" + Globals.downloadURL + "</a></strong>");
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Creates editor kit for this source.
* @return editor kit
*/
protected EditorKit createEditorKit () {
  if (kit != null) return kit;
  if (mimeType != null) {
    kit = JEditorPane.createEditorKitForContentType (mimeType);
  } else {
    String defaultMIMEType = env ().getMimeType ();
    kit = JEditorPane.createEditorKitForContentType (defaultMIMEType);
  }
  if (isDumbKit (kit)) {
    kit = JEditorPane.createEditorKitForContentType ("text/plain"); // NOI18N
  }
  if (isDumbKit (kit)) {
    kit = new PlainEditorKit ();
  }
  return kit;
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Creates editor kit for this source.
* @return editor kit
*/
protected EditorKit createEditorKit () {
  if (kit != null) return kit;
  if (mimeType != null) {
    kit = JEditorPane.createEditorKitForContentType (mimeType);
  } else {
    String defaultMIMEType = env ().getMimeType ();
    kit = JEditorPane.createEditorKitForContentType (defaultMIMEType);
  }
  if (isDumbKit (kit)) {
    kit = JEditorPane.createEditorKitForContentType ("text/plain"); // NOI18N
  }
  if (isDumbKit (kit)) {
    kit = new PlainEditorKit ();
  }
  return kit;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore

protected static DocumentModel loadDocumentModel(InputStream in) throws IOException, DocumentModelException {
  EditorKit kit = JEditorPane.createEditorKitForContentType(SVGDataLoader.REQUIRED_MIME);
  BaseDocument doc = (BaseDocument) kit.createDefaultDocument();
  try {
    kit.read(in, doc, 0);
  } catch (BadLocationException ex) {
    ex.printStackTrace();
  } finally {
    in.close();
  }
  DocumentModel model = DocumentModel.getDocumentModel(doc);
  return model;
}

代码示例来源:origin: igvteam/igv

public LOSDialog(Frame owner) {
  super(owner);
  initComponents();
  initContent();
  remindMeCB.setSelected(true);
  contentPane.setEditorKit(JEditorPane.createEditorKitForContentType("text/html"));
  contentPane.setEditable(false);
  contentPane.addHyperlinkListener(new HyperlinkListener() {
    public void hyperlinkUpdate(HyperlinkEvent e) {
      if(e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
        try {
          final URI mailtoURI = e.getURL().toURI();
          Desktop.getDesktop().mail(mailtoURI);
          setVisible(false);
          PreferencesManager.getPreferences().put(Constants.SHOW_LOS, false);
          dispose();
        } catch (Exception e1) {
          e1.printStackTrace();
        }
      }
    }
  });
}

代码示例来源:origin: javax.help/javahelp

} else {
k = JEditorPane.createEditorKitForContentType(type);

代码示例来源:origin: datacleaner/DataCleaner

public DCHtmlBox(final String text) {
  super();
  setEditorKit(JEditorPane.createEditorKitForContentType(CONTENT_TYPE_HTML));
  setEditable(false);
  putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
  setFont(WidgetUtils.FONT_NORMAL);
  addHyperlinkListener(hyperlinkEvent -> {
    if (hyperlinkEvent.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
      try {
        (new OpenBrowserAction(hyperlinkEvent.getURL())).actionPerformed(null);
      } catch (final URISyntaxException e) {
        logger.warn("Link can not be opened. " + e.getMessage());
      }
    }
  });
  if (text != null) {
    setText(text);
  }
}

相关文章

JEditorPane类方法