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

x33g5p2x  于2022-01-30 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(179)

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

StyleSheet.getStyleSheets介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-dialogs

if (css.getStyleSheets() == null) {
  StyleSheet css2 = new StyleSheet();
  Font f = new JList().getFont();

代码示例来源:origin: huxi/sulky

private static void appendStyles(StyleSheet styleSheet, StringBuilder msg)
{
  Enumeration<?> styleNames = styleSheet.getStyleNames();
  while(styleNames.hasMoreElements())
  {
    Object styleName = styleNames.nextElement();
    Style style = styleSheet.getStyle(String.valueOf(styleName));
    msg.append("StyleName: ").append(styleName).append("\nStyle: ").append(style).append("\n\n");
  }
  StyleSheet[] styleSheets = styleSheet.getStyleSheets();
  if(styleSheets != null && styleSheets.length > 0)
  {
    for(int i = 0; i < styleSheets.length; i++)
    {
      msg.append("Child #").append(i).append(':');
      StyleSheet ss = styleSheets[i];
      appendStyles(ss, msg);
    }
  }
}

代码示例来源:origin: de.huxhorn.sulky/de.huxhorn.sulky.logging

private static void appendStyles(StyleSheet styleSheet, StringBuilder msg)
{
  Enumeration<?> styleNames = styleSheet.getStyleNames();
  while(styleNames.hasMoreElements())
  {
    Object styleName = styleNames.nextElement();
    Style style = styleSheet.getStyle(String.valueOf(styleName));
    msg.append("StyleName: ").append(styleName).append("\nStyle: ").append(style).append("\n\n");
  }
  StyleSheet[] styleSheets = styleSheet.getStyleSheets();
  if(styleSheets != null && styleSheets.length > 0)
  {
    for(int i = 0; i < styleSheets.length; i++)
    {
      msg.append("Child #").append(i).append(':');
      StyleSheet ss = styleSheets[i];
      appendStyles(ss, msg);
    }
  }
}

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

private void postInitComponents() {
  final HTMLEditorKit htmlkit = new HTMLEditorKit();
  final StyleSheet css = htmlkit.getStyleSheet();
  if (css.getStyleSheets() == null) {
    final StyleSheet css2 = new StyleSheet();
    final Font f = new JLabel().getFont();
    css2.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
    .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
    css2.addStyleSheet(css);
    htmlkit.setStyleSheet(css2);
  }
  jTextPane1.setEditorKit(htmlkit);
  jTextPane1.setText(NbBundle.getMessage(BrokenPlatformCustomizer.class, "MSG_BrokenProject")); // NOI18N
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-j2me-cdc-platform

private void postInitComponents () {
  this.platformName.setText (platform.getDisplayName());
  Collection installFolders = platform.getInstallFolderURLs();
  if (installFolders.size() > 0) {
    this.platformHome.setForeground(new Color (164,0,0));
    this.platformHome.setText (new File(URI.create(((URL)installFolders.iterator().next()).toExternalForm())).getAbsolutePath());
  }
  HTMLEditorKit htmlkit = new HTMLEditorKit();                
  StyleSheet css = htmlkit.getStyleSheet();
  if (css.getStyleSheets() == null) {
    StyleSheet css2 = new StyleSheet();
    Font f = jLabel1.getFont();
    css2.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
      .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
    css2.addStyleSheet(css);
    htmlkit.setStyleSheet(css2);
  }
  jTextPane1.setEditorKit(htmlkit);        
  jTextPane1.setText(NbBundle.getMessage(BrokenPlatformCustomizer.class,"MSG_BrokenProject"));
}

代码示例来源:origin: dcaoyuan/nbscala

private void postInitComponents () {
  this.platformName.setText (platform.getDisplayName());
  Collection installFolders = platform.getInstallFolderURLs();
  if (installFolders.size() > 0) {
    this.platformHome.setForeground(new Color (164,0,0));
    this.platformHome.setText (new File(URI.create(((URL)installFolders.iterator().next()).toExternalForm())).getAbsolutePath());
  }
  HTMLEditorKit htmlkit = new HTMLEditorKit();                
  StyleSheet css = htmlkit.getStyleSheet();
  if (css.getStyleSheets() == null) {
    StyleSheet css2 = new StyleSheet();
    Font f = jLabel1.getFont();
    css2.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
      .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
    css2.addStyleSheet(css);
    htmlkit.setStyleSheet(css2);
  }
  jTextPane1.setEditorKit(htmlkit);        
  jTextPane1.setText(NbBundle.getMessage(BrokenPlatformCustomizer.class,"MSG_BrokenProject"));
}

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/org-netbeans-modules-editor-lib

protected EditorKit createDefaultEditorKit() {
    // it is extremelly slow to init it
//        new RuntimeException("new HTMLEditorKit").printStackTrace();
    if (htmlKit == null){
      htmlKit= new HTMLEditorKit ();
      setEditorKit(htmlKit);

      // override the Swing default CSS to make the HTMLEditorKit use the
      // same font as the rest of the UI.
      
      // XXX the style sheet is shared by all HTMLEditorKits.  We must
      // detect if it has been tweaked by ourselves or someone else
      // (template description for example) and avoid doing the same
      // thing again
      
      if (htmlKit.getStyleSheet().getStyleSheets() != null)
        return htmlKit;
      
      javax.swing.text.html.StyleSheet css = new javax.swing.text.html.StyleSheet();
      java.awt.Font f = /*new javax.swing.JTextArea().*/ getFont();
      css.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
            .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
      css.addStyleSheet(htmlKit.getStyleSheet());
      htmlKit.setStyleSheet(css);
    }
    return htmlKit;
  }
}

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

protected EditorKit createDefaultEditorKit() {
    // it is extremelly slow to init it
    if (htmlKit == null){
      htmlKit= new HTMLEditorKit ();
      setEditorKit(htmlKit);

      // override the Swing default CSS to make the HTMLEditorKit use the
      // same font as the rest of the UI.
      
      // XXX the style sheet is shared by all HTMLEditorKits.  We must
      // detect if it has been tweaked by ourselves or someone else
      // (template description for example) and avoid doing the same
      // thing again
      
      if (htmlKit.getStyleSheet().getStyleSheets() != null)
        return htmlKit;
      
      javax.swing.text.html.StyleSheet css = new javax.swing.text.html.StyleSheet();
      java.awt.Font f = getFont();
      css.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
            .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
      css.addStyleSheet(htmlKit.getStyleSheet());
      htmlKit.setStyleSheet(css);
    }
    return htmlKit;
  }
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-editor-deprecated-pre61completion

protected EditorKit createDefaultEditorKit() {
    // it is extremelly slow to init it
//        new RuntimeException("new HTMLEditorKit").printStackTrace();
    if (htmlKit == null){
      htmlKit= new HTMLEditorKit ();
      setEditorKit(htmlKit);

      // override the Swing default CSS to make the HTMLEditorKit use the
      // same font as the rest of the UI.
      
      // XXX the style sheet is shared by all HTMLEditorKits.  We must
      // detect if it has been tweaked by ourselves or someone else
      // (template description for example) and avoid doing the same
      // thing again
      
      if (htmlKit.getStyleSheet().getStyleSheets() != null)
        return htmlKit;
      
      javax.swing.text.html.StyleSheet css = new javax.swing.text.html.StyleSheet();
      java.awt.Font f = /*new javax.swing.JTextArea().*/ getFont();
      css.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
            .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
      css.addStyleSheet(htmlKit.getStyleSheet());
      htmlKit.setStyleSheet(css);
    }
    return htmlKit;
  }
}

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

if (htmlkit.getStyleSheet().getStyleSheets() != null)
  return;

代码示例来源:origin: org.netbeans.api/org-openide-explorer

if (htmlKit.getStyleSheet().getStyleSheets() == null) {
  javax.swing.text.html.StyleSheet css = new javax.swing.text.html.StyleSheet();
  java.awt.Font f = new JLabel().getFont();

代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu

StyleSheet[] as=ss.getStyleSheets();
if(as!=null)
 for(int i=0;i<as.length;i++)

代码示例来源:origin: org.fudaa.framework.fudaa/fudaa-common

final StyleSheet ss = hd.getStyleSheet();
final StyleSheet[] as = ss.getStyleSheets();
if (as != null) {
 for (int i = 0; i < as.length; i++) {

相关文章