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

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

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

JEditorPane.setEditorKit介绍

暂无

代码示例

代码示例来源:origin: stackoverflow.com

final JEditorPane editor = new JEditorPane();
editor.setEditorKit(JEditorPane.createEditorKitForContentType("text/html"));
editor.setEditable(false);

代码示例来源:origin: magefree/mage

public static void setHTMLEditorKit (JEditorPane editorPane) {
  editorPane.getDocument().putProperty("imageCache", imageCache); // Read internally by ImageView, but never written.
  editorPane.setEditorKit(new HTMLEditorKit() {
    private static final long serialVersionUID = -54602188235105448L;

代码示例来源:origin: stackoverflow.com

//Create a new JEditorPane
JEditorPane yourPane = new JEditorPane();
//Set the custom HTMLEditorKit
yourPane.setEditorKit(new LargeHTMLEditorKit());
//Set the zoom to 150%
yourPane.getDocument().putProperty("ZOOM_FACTOR", new Double(1.5));

代码示例来源:origin: net.java.abeille/abeille

private Component buildView() {
  JavaKit kit = new JavaKit();
  JEditorPane editor = new JEditorPane();
  editor.setEditorKit(kit);
  // JEditorPane editor = TSEditorUtils.createEditor( kit );
  // JComponent comp = TSEditorUtils.getExtComponent( editor );
  m_editor = editor;
  return new JScrollPane(editor);
}

代码示例来源: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: 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: 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.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: org.netbeans.modules/org-netbeans-modules-php-editor

@Override
public JComponent getPreviewComponent() {
  if (previewPane == null) {
    previewPane = new JEditorPane();
    previewPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(FmtOptions.class, "AN_Preview")); //NOI18N
    previewPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(FmtOptions.class, "AD_Preview")); //NOI18N
    previewPane.setEditorKit(CloneableEditorSupport.getEditorKit(FileUtils.PHP_MIME_TYPE));
    previewPane.setEditable(false);
  }
  return previewPane;
}

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

@Override
public JComponent getPreviewComponent() {
  if (previewPane == null) {
    previewPane = new JEditorPane();
    previewPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(FmtOptions.class, "AN_Preview")); //NOI18N
    previewPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(FmtOptions.class, "AD_Preview")); //NOI18N
    previewPane.putClientProperty("HighlightsLayerIncludes", "^org\\.netbeans\\.modules\\.editor\\.lib2\\.highlighting\\.SyntaxHighlighting$"); //NOI18N
    previewPane.setEditorKit(CloneableEditorSupport.getEditorKit(MIMENames.FORTRAN_MIME_TYPE));
    previewPane.setEditable(false);
  }
  return previewPane;
}

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

public JComponent getPreviewComponent() {
  if (previewPane == null) {
    previewPane = new JEditorPane();
    previewPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(FmtOptions.class, "AN_Preview")); //NOI18N
    previewPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(FmtOptions.class, "AD_Preview")); //NOI18N
    previewPane.putClientProperty("HighlightsLayerIncludes", "^org\\.netbeans\\.modules\\.editor\\.lib2\\.highlighting\\.SyntaxHighlighting$"); //NOI18N
    previewPane.setEditorKit(CloneableEditorSupport.getEditorKit(RubyInstallation.RUBY_MIME_TYPE));
    previewPane.setEditable(false);
  }
  return previewPane;
}

代码示例来源:origin: org.freehep/freehep-graphicsio-tests

public TestHTML(String[] args) throws Exception {
  super(args);
  setName("HTML");
  text = "&lt;Vector<sup><b>Graphics</b></sup> &amp; Adapter<i><sub>Card</sub></i> "
      + "= e<sup>x<sup>2</sup>y<sup>3</sup></sup>&gt;";
  JEditorPane pane = new JEditorPane();
  pane.setContentType("text/html");
  pane.setEditorKit(new HTMLEditorKit());
  pane.setText(text);
  pane.setEditable(false);
  add(pane);
}

代码示例来源: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: org.netbeans.modules/org-netbeans-modules-cnd-editor

@Override
public JComponent getPreviewComponent() {
  if (previewPane == null) {
    previewPane = new JEditorPane();
    previewPane.getAccessibleContext().setAccessibleName(NbBundle.getMessage(EditorOptionsPanelController.class, "AN_Preview")); //NOI18N
    previewPane.getAccessibleContext().setAccessibleDescription(NbBundle.getMessage(EditorOptionsPanelController.class, "AD_Preview")); //NOI18N
    previewPane.putClientProperty("HighlightsLayerIncludes", "^org\\.netbeans\\.modules\\.editor\\.lib2\\.highlighting\\.SyntaxHighlighting$"); //NOI18N
    previewPane.setEditorKit(CloneableEditorSupport.getEditorKit(language.toMime()));
    previewPane.setEditable(false);
  }
  return previewPane;
}

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-php-project

private void initSourceEditor() {
  sourceEditorPane.setEditorKit(MimeLookup.getLookup(HTML_CONTENT_TYPE).lookup(EditorKit.class));
  // ui
  Font font = new JLabel().getFont();
  sourceEditorPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
  sourceEditorPane.setFont(font);
  previewTextPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, true);
  previewTextPane.setFont(font);
}

代码示例来源:origin: AlexanderBartash/hybris-integration-intellij-idea-plugin

private void createUIComponents() {
    final Font font = UIManager.getFont("Label.font");
    final String bodyRule = "body { font-family: " + font.getFamily() + "; " + "font-size: " + font.getSize() + "pt; }";
    discountEditorPane = new JEditorPane();
    discountEditorPane.setEditorKit(new HTMLEditorKit());
    ((HTMLDocument) discountEditorPane.getDocument()).getStyleSheet().addRule(bodyRule);
    discountEditorPane.addHyperlinkListener(BrowserHyperlinkListener.INSTANCE);
  }
}

代码示例来源:origin: org.xworker/xworker_core

public static void createEditorKit(ActionContext actionContext){
  Thing self = (Thing) actionContext.get("self");
  JEditorPane parent = (JEditorPane) actionContext.get("JEditorPane");
  
  for(Thing child : self.getChilds()){
    EditorKit c = (EditorKit) child.doAction("create", actionContext);
    if(c != null){
      parent.setEditorKit(c);
      break;
    }
  }
}

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

public void run() {
    // #23486: pane could not be initialized yet.
    if(pane != null) {
      Document doc = support.createStyledDocument(
          pane.getEditorKit());
      pane.setDocument (doc);
      pane.setEditorKit (null);
    }
    removeAll();
    initialized = false;
  }
}

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

public void run() {
    // #23486: pane could not be initialized yet.
    if(pane != null) {
      Document doc = support.createStyledDocument(
          pane.getEditorKit());
      pane.setDocument (doc);
      pane.setEditorKit (null);
    }
    removeAll();
    initialized = false;
  }
}

代码示例来源: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);
}

相关文章

JEditorPane类方法