本文整理汇总了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.
}
}
示例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);
}
示例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;
}
}
示例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);
}
}
示例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);
}
}
示例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.
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}
}
示例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);
}
}
示例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();
}
}