本文整理了Java中javax.swing.text.MutableAttributeSet.addAttribute()
方法的一些代码示例,展示了MutableAttributeSet.addAttribute()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。MutableAttributeSet.addAttribute()
方法的具体详情如下:
包路径:javax.swing.text.MutableAttributeSet
类名称:MutableAttributeSet
方法名:addAttribute
暂无
代码示例来源:origin: RPTools/maptool
/**
* Sets the background color.
*
* @param a the attribute set
* @param fg the color
*/
public static void setTwoToneColor(MutableAttributeSet a, Color fg) {
a.addAttribute(TwoToneColor, fg);
}
代码示例来源:origin: org.apache.maven.doxia/doxia-module-fo
/** {@inheritDoc} */
public void figureGraphics( String src, SinkEventAttributes attributes )
{
MutableAttributeSet atts = config.getAttributeSet( "figure.graphics" );
atts.addAttribute( Attribute.SRC.toString(), src );
// http://xmlgraphics.apache.org/fop/graphics.html#resolution
final String[] valids = new String[] {"content-height", "content-width", "height", "width"};
final MutableAttributeSet filtered = SinkUtils.filterAttributes( attributes, valids );
if ( filtered != null )
{
atts.addAttributes( filtered );
}
writeln( "<fo:external-graphic" + SinkUtils.getAttributeString( atts ) + "/>" );
}
代码示例来源:origin: chatty/chatty
public static void setHighlightMatchesEnabled(MutableAttributeSet attr, boolean state) {
attr.addAttribute(Attribute.HIGHLIGHT_MATCHES, state);
}
代码示例来源:origin: chatty/chatty
private static void setColor(MutableAttributeSet attr, Color color, Attribute key) {
attr.addAttribute(key, color != null ? color : false);
}
代码示例来源:origin: chatty/chatty
public static void setFontHeight(MutableAttributeSet attr, int height) {
attr.addAttribute(Attribute.FONT_HEIGHT, height);
}
代码示例来源:origin: chatty/chatty
/**
* Currently whether the line is even and the timestamp of when the line
* was added (this method called).
*
* @param even
* @return
*/
public MutableAttributeSet variableLineAttributes(boolean even, boolean updateTimestamp) {
MutableAttributeSet style = even ? styles.get("even") : styles.get("odd");
if (updateTimestamp) {
style.addAttribute(Attribute.TIMESTAMP, System.currentTimeMillis());
}
return style;
}
代码示例来源:origin: chatty/chatty
public MutableAttributeSet banMessage(User user, String message) {
MutableAttributeSet style = new SimpleAttributeSet(standard());
style.addAttribute(Attribute.IS_BAN_MESSAGE, user);
style.addAttribute(Attribute.TIMESTAMP, System.currentTimeMillis());
style.addAttribute(Attribute.BAN_MESSAGE, message);
return style;
}
代码示例来源:origin: org.apache.portals.applications/apa-webcontent2-portlets
public void addAttribute(String name, Object value)
{
Attribute att = HTML.getAttributeKey(name.toLowerCase());
swingset.addAttribute(att, value);
}
代码示例来源:origin: org.apache.portals.applications/apa-webcontent-jar
public void addAttribute(String name, Object value)
{
Attribute att = HTML.getAttributeKey(name.toLowerCase());
swingset.addAttribute(att, value);
}
代码示例来源:origin: chatty/chatty
private void addBy(MutableAttributeSet attributes, String byName) {
java.util.List<String> old = (java.util.List)attributes.getAttribute(Attribute.ACTION_BY);
java.util.List<String> changed;
if (old != null) {
changed = new ArrayList<>(old);
} else {
changed = new ArrayList<>();
}
// If already present, append to end
changed.remove(byName);
changed.add(byName);
attributes.addAttribute(Attribute.ACTION_BY, changed);
}
代码示例来源:origin: chatty/chatty
private void addBooleanSetting(Setting key, String name) {
other.addAttribute(key, settings.getBoolean(name));
}
代码示例来源:origin: chatty/chatty
private void addLongSetting(Setting key, String name) {
other.addAttribute(key, settings.getLong(name));
}
代码示例来源:origin: chatty/chatty
public MutableAttributeSet banMessageCount(int count) {
MutableAttributeSet style = new SimpleAttributeSet(info());
style.addAttribute(Attribute.BAN_MESSAGE_COUNT, count);
return style;
}
代码示例来源:origin: chatty/chatty
private void addFormattedText(Color color, int start, int end,
Map<Integer, Integer> ranges,
Map<Integer, MutableAttributeSet> rangesStyle) {
if (!inRanges(start, ranges) && !inRanges(end, ranges)) {
ranges.put(start, end);
MutableAttributeSet attr = styles.standard(color);
StyleConstants.setBold(attr, true);
attr.addAttribute("start", start);
rangesStyle.put(start,attr);
}
}
代码示例来源:origin: org.apache.maven.doxia/doxia-module-docbook-simple
/** {@inheritDoc} */
public void figureGraphics( String name )
{
String format = FileUtils.extension( name ).toUpperCase( Locale.ENGLISH );
writeStartTag( SimplifiedDocbookMarkup.IMAGEOBJECT_TAG );
MutableAttributeSet att = new SimpleAttributeSet();
att.addAttribute( SimplifiedDocbookMarkup.FORMAT_ATTRIBUTE, format );
att.addAttribute( SimplifiedDocbookMarkup.FILEREF_ATTRIBUTE, HtmlTools.escapeHTML( name, true ) );
writeSimpleTag( SimplifiedDocbookMarkup.IMAGEDATA_TAG, att );
writeEndTag( SimplifiedDocbookMarkup.IMAGEOBJECT_TAG );
}
代码示例来源:origin: igniterealtime/Spark
/**
* Inserts a network address into the current document.
*
* @param address - the address to insert( ex. \superpc\etc\file\ OR http://localhost/ )
* @throws BadLocationException if the location is not available for insertion.
*/
public void insertAddress( Document doc, String address ) throws BadLocationException
{
// Create a new style, based on the style used for generic text, for the address.
final MutableAttributeSet addressStyle = new SimpleAttributeSet( getMessageStyle().copyAttributes() );
StyleConstants.setForeground( addressStyle, (Color) UIManager.get( "Address.foreground" ) );
StyleConstants.setUnderline( addressStyle, true );
addressStyle.addAttribute( "link", address );
doc.insertString( doc.getLength(), address, addressStyle );
}
代码示例来源:origin: org.apache.maven.doxia/doxia-module-xdoc
/**
* The default valign is <code>top</code>.
*
* {@inheritDoc}
* @see javax.swing.text.html.HTML.Tag#TR
*/
public void tableRow()
{
MutableAttributeSet att = new SinkEventAttributeSet();
att.addAttribute( Attribute.VALIGN, "top" );
writeStartTag( TR, att );
setCellCount( 0 );
}
代码示例来源:origin: org.apache.maven.doxia/doxia-module-docbook-simple
/**
* {@inheritDoc}
* @see SimplifiedDocbookMarkup#ORDEREDLIST_TAG
* @see SimplifiedDocbookMarkup#NUMERATION_ATTRIBUTE
*/
public void numberedList( int numbering )
{
String numeration = DocbookUtils.docbookListNumbering( numbering );
paragraph_();
MutableAttributeSet att = new SimpleAttributeSet();
att.addAttribute( SimplifiedDocbookMarkup.NUMERATION_ATTRIBUTE, numeration );
writeStartTag( SimplifiedDocbookMarkup.ORDEREDLIST_TAG, att );
}
代码示例来源:origin: org.apache.maven.doxia/doxia-module-fo
/** {@inheritDoc} */
public void paragraph( SinkEventAttributes attributes )
{
MutableAttributeSet atts = config.getAttributeSet( "normal.paragraph" );
if ( attributes != null && attributes.isDefined( SinkEventAttributes.ALIGN ) )
{
atts.addAttribute( "text-align", attributes.getAttribute( SinkEventAttributes.ALIGN ) );
}
writeEOL();
writeStartTag( BLOCK_TAG, atts );
}
代码示例来源:origin: chatty/chatty
private void printAutoModMessage(AutoModMessage message, AttributeSet style) {
closeCompactMode();
print(getTimePrefix(), style);
MutableAttributeSet specialStyle = styles.user(message.user, style);
specialStyle.addAttribute(Attribute.ID_AUTOMOD, message.msgId);
print("[AutoMod] <"+message.user.getDisplayNick()+"> ", specialStyle);
print(message.message, style);
finishLine();
}
内容来源于网络,如有侵权,请联系作者删除!