当前位置: 首页>>代码示例>>Java>>正文


Java StyleSheet.loadRules方法代码示例

本文整理汇总了Java中javax.swing.text.html.StyleSheet.loadRules方法的典型用法代码示例。如果您正苦于以下问题:Java StyleSheet.loadRules方法的具体用法?Java StyleSheet.loadRules怎么用?Java StyleSheet.loadRules使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.html.StyleSheet的用法示例。


在下文中一共展示了StyleSheet.loadRules方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ExtendedHTMLEditorKit

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
public ExtendedHTMLEditorKit() {
	styleSheet = new StyleSheet();
	try {
		InputStream is = HTMLEditorKit.class.getResourceAsStream(DEFAULT_CSS);
		Reader r = new BufferedReader(new InputStreamReader(is, "ISO-8859-1"));
		styleSheet.loadRules(r, null);
		r.close();
	} catch (Exception e) {
		// LogService.getRoot().log(Level.WARNING, "Cannot install stylesheet: "+e, e);
		LogService.getRoot().log(
				Level.WARNING,
				I18N.getMessage(LogService.getRoot().getResourceBundle(),
						"com.rapidminer.gui.tools.ExtendedHTMLEditorKit.installing_stylesheet_error", e), e);
		// on error we simply have no styles... the html
		// will look mighty wrong but still function.
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:18,代码来源:ExtendedHTMLEditorKit.java

示例2: setStyleSheet

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
protected void setStyleSheet() {
    if (isRawHtml) return;

    MultiMarkdownEditorKit htmlKit = new MultiMarkdownEditorKit();

    final StyleSheet style = new MultiMarkdownStyleSheet();

    if (!MultiMarkdownGlobalSettings.getInstance().useCustomCss(false)) {
        style.importStyleSheet(MultiMarkdownGlobalSettings.getInstance().getCssFileURL(false));
    } else {
        try {
            style.loadRules(new StringReader(MultiMarkdownGlobalSettings.getInstance().getCssText(false)), null);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    htmlKit.setStyleSheet(style);

    jEditorPane.setEditorKit(htmlKit);
}
 
开发者ID:vsch,项目名称:idea-multimarkdown,代码行数:21,代码来源:MultiMarkdownPreviewEditor.java

示例3: makeStyleSheet

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
public static StyleSheet makeStyleSheet(String name)
{
    try
    {
        StyleSheet sheet = new StyleSheet();
        Reader reader = new InputStreamReader(System.class.getResourceAsStream("/css/" + name + ".css"));
        sheet.loadRules(reader, null);
        reader.close();

        return sheet;
    }
    catch (Exception ex)
    {
        ex.printStackTrace();
        return null;
    }
}
 
开发者ID:DoubleDoorDevelopment,项目名称:D3Launcher,代码行数:18,代码来源:OSUtils.java

示例4: patchStyledEditorKit

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
 private static void patchStyledEditorKit() {
   try {
     StyleSheet defaultStyles = new StyleSheet();
InputStream is = DarculaLaf.class.getResourceAsStream("darcula.css");
Reader r = new BufferedReader(new InputStreamReader(is, "UTF-8"));
defaultStyles.loadRules(r, null);
r.close();
     final Field keyField = HTMLEditorKit.class.getDeclaredField("DEFAULT_STYLES_KEY");
     keyField.setAccessible(true);
     final Object key = keyField.get(null);
     AppContext.getAppContext().put(key, defaultStyles);
   } catch (Exception e) {
     log(e);
   }
 }
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:DarculaLaf.java

示例5: patchStyledEditorKit

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
@SuppressWarnings("IOResourceOpenedButNotSafelyClosed")
private static void patchStyledEditorKit() {
  try {
    StyleSheet defaultStyles = new StyleSheet();
    InputStream is = DarculaLaf.class.getResourceAsStream("darcula.css");
    Reader r = new BufferedReader(new InputStreamReader(is, "UTF-8"));
    defaultStyles.loadRules(r, null);
    r.close();
    final Field keyField = HTMLEditorKit.class.getDeclaredField("DEFAULT_STYLES_KEY");
    keyField.setAccessible(true);
    final Object key = keyField.get(null);
    AppContext.getAppContext().put(key, defaultStyles);
  } catch (Throwable e) {
    log(e);
  }
}
 
开发者ID:bulenkov,项目名称:Darcula,代码行数:17,代码来源:DarculaLaf.java

示例6: ExtendedHTMLEditorKit

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
public ExtendedHTMLEditorKit() {
	styleSheet = new StyleSheet();
	try {
		InputStream is = HTMLEditorKit.class.getResourceAsStream(DEFAULT_CSS);
		Reader r = new BufferedReader(new InputStreamReader(is, "ISO-8859-1"));
		styleSheet.loadRules(r, null);
		r.close();
	} catch (Exception e) {
		//LogService.getRoot().log(Level.WARNING, "Cannot install stylesheet: "+e, e);
		LogService.getRoot().log(Level.WARNING,
				I18N.getMessage(LogService.getRoot().getResourceBundle(), 
				"com.rapidminer.gui.tools.ExtendedHTMLEditorKit.installing_stylesheet_error", 
				e),
				e);
		// on error we simply have no styles... the html
		// will look mighty wrong but still function.
	}
}
 
开发者ID:rapidminer,项目名称:rapidminer-5,代码行数:19,代码来源:ExtendedHTMLEditorKit.java

示例7: setStyleSheet

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
public void setStyleSheet(Reader r) {
	StyleSheet css = new StyleSheet();
	try {
		css.loadRules(r, null);
		/*
		 * new InputStreamReader(
		 * net.sf.memoranda.ui.htmleditor.HTMLEditor.class.getResourceAsStream("resources/css/default.css")),
		 */

	} catch (Exception ex) {
		ex.printStackTrace();
	}
	editorKit.setStyleSheet(css);
}
 
开发者ID:ser316asu,项目名称:Neukoelln_SER316,代码行数:15,代码来源:HTMLEditor.java

示例8: setStyleSheet

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
public void setStyleSheet(Reader r) {
    StyleSheet css = new StyleSheet();
    try {
        css.loadRules(r, null);
        /*
         * new InputStreamReader(
         * net.sf.memoranda.ui.htmleditor.HTMLEditor.class.getResourceAsStream("/htmleditor/css/default.css")),
         */

    } catch (Exception ex) {
        ex.printStackTrace();
    }
    editorKit.setStyleSheet(css);
}
 
开发者ID:ser316asu,项目名称:SER316-Dresden,代码行数:15,代码来源:HTMLEditor.java

示例9: setStyleSheet

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
public void setStyleSheet(Reader r) {
    StyleSheet css = new StyleSheet();
    try {
        css.loadRules(r, null);

    } catch (Exception ex) {
        ex.printStackTrace();
    }
    editorKit.setStyleSheet(css);
}
 
开发者ID:cst316,项目名称:spring16project-Team-Laredo,代码行数:11,代码来源:HTMLEditor.java

示例10: setStyleSheet

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
public void setStyleSheet(Reader r) {
	StyleSheet css = new StyleSheet();
	try {
		css.loadRules(r, null);
		/*
		 * new InputStreamReader(
		 * net.sf.memoranda.ui.htmleditor.HTMLEditor.class.
		 * getResourceAsStream("resources/css/default.css")),
		 */

	} catch (Exception ex) {
		ex.printStackTrace();
	}
	editorKit.setStyleSheet(css);
}
 
开发者ID:cst316,项目名称:spring16project-Fortran,代码行数:16,代码来源:HTMLEditor.java

示例11: loadStyleSheet

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
@Nullable
public static StyleSheet loadStyleSheet(@Nullable URL url) {
  if (url == null) return null;
  try {
    StyleSheet styleSheet = new StyleSheet();
    styleSheet.loadRules(new InputStreamReader(url.openStream(), CharsetToolkit.UTF8), url);
    return styleSheet;
  }
  catch (IOException e) {
    LOG.warn(url + " loading failed", e);
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:UIUtil.java

示例12: loadStyleSheet

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
@NotNull
public static StyleSheet loadStyleSheet(@NotNull URL url) {
  try {
    StyleSheet styleSheet = new StyleSheet();
    styleSheet.loadRules(new InputStreamReader(url.openStream(), CharsetToolkit.UTF8), url);
    return styleSheet;
  }
  catch (IOException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:asciidoctor,项目名称:asciidoctor-intellij-plugin,代码行数:12,代码来源:UIUtil.java

示例13: getStyleSheet

import javax.swing.text.html.StyleSheet; //导入方法依赖的package包/类
public StyleSheet getStyleSheet() {
	try {
		StyleSheet defaultStyles = new StyleSheet();
		InputStream is = getClass().getResourceAsStream("/ekit.css");
		Reader r = new BufferedReader(new InputStreamReader(is, "ISO-8859-1"));
		defaultStyles.loadRules(r, null);
		r.close();
		
		return defaultStyles;
	} catch (Throwable e) {
		log.error("Falha ao ler ekit.css. Utilizando estilos padrão.", e);
		return super.getStyleSheet();
	}
}
 
开发者ID:lexml,项目名称:lexml-swing-editorhtml,代码行数:15,代码来源:ExtendedHTMLEditorKit.java


注:本文中的javax.swing.text.html.StyleSheet.loadRules方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。