當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。