本文整理了Java中javax.swing.text.html.StyleSheet.getStyle()
方法的一些代码示例,展示了StyleSheet.getStyle()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StyleSheet.getStyle()
方法的具体详情如下:
包路径:javax.swing.text.html.StyleSheet
类名称:StyleSheet
方法名:getStyle
暂无
代码示例来源:origin: de.huxhorn.sulky/de.huxhorn.sulky.logging
private static void appendStyles(StyleSheet styleSheet, StringBuilder msg)
{
Enumeration<?> styleNames = styleSheet.getStyleNames();
while(styleNames.hasMoreElements())
{
Object styleName = styleNames.nextElement();
Style style = styleSheet.getStyle(String.valueOf(styleName));
msg.append("StyleName: ").append(styleName).append("\nStyle: ").append(style).append("\n\n");
}
StyleSheet[] styleSheets = styleSheet.getStyleSheets();
if(styleSheets != null && styleSheets.length > 0)
{
for(int i = 0; i < styleSheets.length; i++)
{
msg.append("Child #").append(i).append(':');
StyleSheet ss = styleSheets[i];
appendStyles(ss, msg);
}
}
}
代码示例来源:origin: org.fudaa.framework.fudaa/fudaa-common
private static void updateStyles(final StyleSheet _styles) {
if (_styles != null) {
final int font = 12 * BuPreferences.BU.getFontScaling() / 100;
final Enumeration rules = _styles.getStyleNames();
while (rules.hasMoreElements()) {
final String name = (String) rules.nextElement();
final Style rule = _styles.getStyle(name);
if (StyleConstants.ALIGN_JUSTIFIED == StyleConstants.getAlignment(rule)) {
StyleConstants.setAlignment(rule, StyleConstants.ALIGN_LEFT);
}
if (StyleConstants.getFontSize(rule) <= font) {
// FuLog.debug("WBP: font size="+StyleConstants.getFontSize(rule));
StyleConstants.setFontSize(rule, font);
}
}
}
}
代码示例来源:origin: org.eclipse.scout.rt/org.eclipse.scout.commons
String colorAttributeValue = ColorUtility.rgbToText(defaultHyperlinkColor.getRed(), defaultHyperlinkColor.getGreen(), defaultHyperlinkColor.getBlue());
StyleSheet styleSheet = htmlDoc.getStyleSheet();
Style aStyle = styleSheet.getStyle("a");
if (aStyle == null) {
aStyle = styleSheet.addStyle("a", null);
代码示例来源:origin: huxi/sulky
private static void appendStyles(StyleSheet styleSheet, StringBuilder msg)
{
Enumeration<?> styleNames = styleSheet.getStyleNames();
while(styleNames.hasMoreElements())
{
Object styleName = styleNames.nextElement();
Style style = styleSheet.getStyle(String.valueOf(styleName));
msg.append("StyleName: ").append(styleName).append("\nStyle: ").append(style).append("\n\n");
}
StyleSheet[] styleSheets = styleSheet.getStyleSheets();
if(styleSheets != null && styleSheets.length > 0)
{
for(int i = 0; i < styleSheets.length; i++)
{
msg.append("Child #").append(i).append(':');
StyleSheet ss = styleSheets[i];
appendStyles(ss, msg);
}
}
}
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-bu
private static final void updateStyles(StyleSheet _styles)
{
if(_styles!=null)
{
int FONT=12*BuPreferences.BU.getFontScaling()/100;
Enumeration rules=_styles.getStyleNames();
while(rules.hasMoreElements())
{
String name=(String)rules.nextElement();
Style rule=_styles.getStyle(name);
if(StyleConstants.ALIGN_JUSTIFIED
==StyleConstants.getAlignment(rule))
StyleConstants.setAlignment
(rule,StyleConstants.ALIGN_LEFT);
if(StyleConstants.getFontSize(rule)<=FONT)
{
//FuLog.debug("WBP: font size="+StyleConstants.getFontSize(rule));
StyleConstants.setFontSize(rule,FONT);
}
}
}
}
代码示例来源:origin: org.eclipse.scout.rt/org.eclipse.scout.commons
private static void setDefaultFont(StyleSheet styleSheet, String styleName, DefaultFont defaultFont) {
if (defaultFont == null) {
return;
}
Style style = styleSheet.getStyle(styleName);
if (style == null) {
style = styleSheet.addStyle(styleName, null);
}
String family = defaultFont.getFamiliesConcatenated();
if (style.getAttribute(CSS.Attribute.FONT_FAMILY) == null && family != null) {
styleSheet.addCSSAttribute(style, CSS.Attribute.FONT_FAMILY, family);
}
if (style.getAttribute(CSS.Attribute.FONT_SIZE) == null && defaultFont.getSize() > 0 && defaultFont.getSizeUnit() != null) {
styleSheet.addCSSAttribute(style, CSS.Attribute.FONT_SIZE, defaultFont.getSize() + defaultFont.getSizeUnit());
}
}
代码示例来源:origin: org.eclipse.scout.rt/org.eclipse.scout.commons
for (Enumeration<?> en = styleSheet.getStyleNames(); en.hasMoreElements();) {
String nm = (String) en.nextElement();
Style style = styleSheet.getStyle(nm);
for (Enumeration<?> en2 = style.getAttributeNames(); en2.hasMoreElements();) {
Object attKey = en2.nextElement();
代码示例来源:origin: org.eclipse.scout.rt/org.eclipse.scout.commons
Style style;
style = styleSheet.getStyle("p");
if (style == null) {
style = styleSheet.addStyle("p", null);
style = styleSheet.getStyle("a");
if (style == null) {
style = styleSheet.addStyle("a", null);
style = styleSheet.getStyle("body");
if (style == null) {
style = styleSheet.addStyle("body", null);
for (Enumeration<?> en = styleSheet.getStyleNames(); en.hasMoreElements();) {
String nm = (String) en.nextElement();
style = styleSheet.getStyle(nm);
for (Enumeration<?> en2 = style.getAttributeNames(); en2.hasMoreElements();) {
Object attKey = en2.nextElement();
代码示例来源:origin: org.fudaa.framework.ctulu/ctulu-ui
while (rules.hasMoreElements()) {
String ruleName = (String) (rules.nextElement());
Style styleRule = styleSheet.getStyle(ruleName);
System.out.println(styleRule.toString());
内容来源于网络,如有侵权,请联系作者删除!