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

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

本文整理了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

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

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

  1. private static void appendStyles(StyleSheet styleSheet, StringBuilder msg)
  2. {
  3. Enumeration<?> styleNames = styleSheet.getStyleNames();
  4. while(styleNames.hasMoreElements())
  5. {
  6. Object styleName = styleNames.nextElement();
  7. Style style = styleSheet.getStyle(String.valueOf(styleName));
  8. msg.append("StyleName: ").append(styleName).append("\nStyle: ").append(style).append("\n\n");
  9. }
  10. StyleSheet[] styleSheets = styleSheet.getStyleSheets();
  11. if(styleSheets != null && styleSheets.length > 0)
  12. {
  13. for(int i = 0; i < styleSheets.length; i++)
  14. {
  15. msg.append("Child #").append(i).append(':');
  16. StyleSheet ss = styleSheets[i];
  17. appendStyles(ss, msg);
  18. }
  19. }
  20. }

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

  1. private static void appendStyles(StyleSheet styleSheet, StringBuilder msg)
  2. {
  3. Enumeration<?> styleNames = styleSheet.getStyleNames();
  4. while(styleNames.hasMoreElements())
  5. {
  6. Object styleName = styleNames.nextElement();
  7. Style style = styleSheet.getStyle(String.valueOf(styleName));
  8. msg.append("StyleName: ").append(styleName).append("\nStyle: ").append(style).append("\n\n");
  9. }
  10. StyleSheet[] styleSheets = styleSheet.getStyleSheets();
  11. if(styleSheets != null && styleSheets.length > 0)
  12. {
  13. for(int i = 0; i < styleSheets.length; i++)
  14. {
  15. msg.append("Child #").append(i).append(':');
  16. StyleSheet ss = styleSheets[i];
  17. appendStyles(ss, msg);
  18. }
  19. }
  20. }

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

  1. private void postInitComponents() {
  2. final HTMLEditorKit htmlkit = new HTMLEditorKit();
  3. final StyleSheet css = htmlkit.getStyleSheet();
  4. if (css.getStyleSheets() == null) {
  5. final StyleSheet css2 = new StyleSheet();
  6. final Font f = new JLabel().getFont();
  7. css2.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
  8. .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
  9. css2.addStyleSheet(css);
  10. htmlkit.setStyleSheet(css2);
  11. }
  12. jTextPane1.setEditorKit(htmlkit);
  13. jTextPane1.setText(NbBundle.getMessage(BrokenPlatformCustomizer.class, "MSG_BrokenProject")); // NOI18N
  14. }

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

  1. private void postInitComponents () {
  2. this.platformName.setText (platform.getDisplayName());
  3. Collection installFolders = platform.getInstallFolderURLs();
  4. if (installFolders.size() > 0) {
  5. this.platformHome.setForeground(new Color (164,0,0));
  6. this.platformHome.setText (new File(URI.create(((URL)installFolders.iterator().next()).toExternalForm())).getAbsolutePath());
  7. }
  8. HTMLEditorKit htmlkit = new HTMLEditorKit();
  9. StyleSheet css = htmlkit.getStyleSheet();
  10. if (css.getStyleSheets() == null) {
  11. StyleSheet css2 = new StyleSheet();
  12. Font f = jLabel1.getFont();
  13. css2.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
  14. .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
  15. css2.addStyleSheet(css);
  16. htmlkit.setStyleSheet(css2);
  17. }
  18. jTextPane1.setEditorKit(htmlkit);
  19. jTextPane1.setText(NbBundle.getMessage(BrokenPlatformCustomizer.class,"MSG_BrokenProject"));
  20. }

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

  1. private void postInitComponents () {
  2. this.platformName.setText (platform.getDisplayName());
  3. Collection installFolders = platform.getInstallFolderURLs();
  4. if (installFolders.size() > 0) {
  5. this.platformHome.setForeground(new Color (164,0,0));
  6. this.platformHome.setText (new File(URI.create(((URL)installFolders.iterator().next()).toExternalForm())).getAbsolutePath());
  7. }
  8. HTMLEditorKit htmlkit = new HTMLEditorKit();
  9. StyleSheet css = htmlkit.getStyleSheet();
  10. if (css.getStyleSheets() == null) {
  11. StyleSheet css2 = new StyleSheet();
  12. Font f = jLabel1.getFont();
  13. css2.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
  14. .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
  15. css2.addStyleSheet(css);
  16. htmlkit.setStyleSheet(css2);
  17. }
  18. jTextPane1.setEditorKit(htmlkit);
  19. jTextPane1.setText(NbBundle.getMessage(BrokenPlatformCustomizer.class,"MSG_BrokenProject"));
  20. }

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

  1. protected EditorKit createDefaultEditorKit() {
  2. // it is extremelly slow to init it
  3. // new RuntimeException("new HTMLEditorKit").printStackTrace();
  4. if (htmlKit == null){
  5. htmlKit= new HTMLEditorKit ();
  6. setEditorKit(htmlKit);
  7. // override the Swing default CSS to make the HTMLEditorKit use the
  8. // same font as the rest of the UI.
  9. // XXX the style sheet is shared by all HTMLEditorKits. We must
  10. // detect if it has been tweaked by ourselves or someone else
  11. // (template description for example) and avoid doing the same
  12. // thing again
  13. if (htmlKit.getStyleSheet().getStyleSheets() != null)
  14. return htmlKit;
  15. javax.swing.text.html.StyleSheet css = new javax.swing.text.html.StyleSheet();
  16. java.awt.Font f = /*new javax.swing.JTextArea().*/ getFont();
  17. css.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
  18. .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
  19. css.addStyleSheet(htmlKit.getStyleSheet());
  20. htmlKit.setStyleSheet(css);
  21. }
  22. return htmlKit;
  23. }
  24. }

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

  1. protected EditorKit createDefaultEditorKit() {
  2. // it is extremelly slow to init it
  3. if (htmlKit == null){
  4. htmlKit= new HTMLEditorKit ();
  5. setEditorKit(htmlKit);
  6. // override the Swing default CSS to make the HTMLEditorKit use the
  7. // same font as the rest of the UI.
  8. // XXX the style sheet is shared by all HTMLEditorKits. We must
  9. // detect if it has been tweaked by ourselves or someone else
  10. // (template description for example) and avoid doing the same
  11. // thing again
  12. if (htmlKit.getStyleSheet().getStyleSheets() != null)
  13. return htmlKit;
  14. javax.swing.text.html.StyleSheet css = new javax.swing.text.html.StyleSheet();
  15. java.awt.Font f = getFont();
  16. css.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
  17. .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
  18. css.addStyleSheet(htmlKit.getStyleSheet());
  19. htmlKit.setStyleSheet(css);
  20. }
  21. return htmlKit;
  22. }
  23. }

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

  1. protected EditorKit createDefaultEditorKit() {
  2. // it is extremelly slow to init it
  3. // new RuntimeException("new HTMLEditorKit").printStackTrace();
  4. if (htmlKit == null){
  5. htmlKit= new HTMLEditorKit ();
  6. setEditorKit(htmlKit);
  7. // override the Swing default CSS to make the HTMLEditorKit use the
  8. // same font as the rest of the UI.
  9. // XXX the style sheet is shared by all HTMLEditorKits. We must
  10. // detect if it has been tweaked by ourselves or someone else
  11. // (template description for example) and avoid doing the same
  12. // thing again
  13. if (htmlKit.getStyleSheet().getStyleSheets() != null)
  14. return htmlKit;
  15. javax.swing.text.html.StyleSheet css = new javax.swing.text.html.StyleSheet();
  16. java.awt.Font f = /*new javax.swing.JTextArea().*/ getFont();
  17. css.addRule(new StringBuffer("body { font-size: ").append(f.getSize()) // NOI18N
  18. .append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
  19. css.addStyleSheet(htmlKit.getStyleSheet());
  20. htmlKit.setStyleSheet(css);
  21. }
  22. return htmlKit;
  23. }
  24. }

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

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

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

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

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

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

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

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

相关文章