本文整理了Java中javax.swing.text.html.HTMLEditorKit.setStyleSheet()
方法的一些代码示例,展示了HTMLEditorKit.setStyleSheet()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HTMLEditorKit.setStyleSheet()
方法的具体详情如下:
包路径:javax.swing.text.html.HTMLEditorKit
类名称:HTMLEditorKit
方法名:setStyleSheet
暂无
代码示例来源:origin: org.netbeans.api/org-openide-dialogs
.append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
css2.addStyleSheet(css);
htmlkit.setStyleSheet(css2);
} catch( RuntimeException ex ) {
代码示例来源: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: stackoverflow.com
StyleSheet ss = new StyleSheet();
ss.importStyleSheet(styleSheetURL);
HTMLEditorKit kit = (HTMLEditorKit)jEditorPane.getEditorKit();
kit.setStyleSheet(ss);
代码示例来源: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: stackoverflow.com
URL resource = getClass().getResource("/stylesheet.css");
styleSheet.importStyleSheet(resource);
htmlEditorKit.setStyleSheet(styleSheet);
代码示例来源: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
.append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
css.addStyleSheet(htmlkit.getStyleSheet());
htmlkit.setStyleSheet(css);
代码示例来源:origin: org.netbeans.api/org-openide-explorer
.append("; font-family: ").append(f.getName()).append("; }").toString()); // NOI18N
css.addStyleSheet(htmlKit.getStyleSheet());
htmlKit.setStyleSheet(css);
代码示例来源:origin: stackoverflow.com
messageEditorPaneHTMLEditorKit.setStyleSheet(styleSheet);
HTMLDocument document = (HTMLDocument) messageEditorPaneHTMLEditorKit.createDefaultDocument();
代码示例来源:origin: stackoverflow.com
this.kit.setStyleSheet(styleSheet);
代码示例来源:origin: stackoverflow.com
htmlEditorKit.setStyleSheet(styleSheet);
htmlDocument = (HTMLDocument) htmlEditorKit.createDefaultDocument();
jTextPane = new JTextPane();
代码示例来源:origin: com.google.code.findbugs/findbugs
private void setStyleSheets() {
StyleSheet styleSheet = new StyleSheet();
styleSheet.addRule("body {font-size: " + Driver.getFontSize() + "pt}");
styleSheet.addRule("H1 {color: red; font-size: 120%; font-weight: bold;}");
styleSheet.addRule("code {font-family: courier; font-size: " + Driver.getFontSize() + "pt}");
styleSheet.addRule(" a:link { color: #0000FF; } ");
styleSheet.addRule(" a:visited { color: #800080; } ");
styleSheet.addRule(" a:active { color: #FF0000; text-decoration: underline; } ");
HTMLEditorKit htmlEditorKit = new HTMLEditorKit();
htmlEditorKit.setStyleSheet(styleSheet);
mainFrame.summaryHtmlArea.setEditorKit(htmlEditorKit);
}
内容来源于网络,如有侵权,请联系作者删除!