|
java-gnome version 4.0.15 | ||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Objectorg.freedesktop.bindings.Pointer
org.gnome.glib.Boxed
org.gnome.pango.AttributeList
public final class AttributeList
A list of Attributes that will be applied to a piece of text.
Used as follows. First, build your text up into a String and initialize the Layout with it. You'll also have to create the wrapper that will hold the list of Attributes that will be applied to that Layout.
layout = new Layout(cr); layout.setText(str); list = new AttributeList();Then, iterate over your text and for each span where you want formatting, create one or more Attributes and specify the ranges that each will apply. For instance, for a word starting at offset
15
and being
4
characters wide.
attr = new StyleAttribute(Style.ITALIC); attr.setIndexes(15, 4); list.insert(attr); attr = new ForegroundColorAttribute(0.1, 0.5, 0.9); attr.setIndexes(15, 4); list.insert(attr);etc, adding each one to the AttributeList. Finally, tell the Layout to use that list:
layout.setAttributes(list);and you're on your way.
Constructor Summary | |
---|---|
AttributeList()
Create an AttributeList. |
Method Summary | |
---|---|
void |
insert(Attribute attr)
Insert an Attribute into this list. |
void |
insertBefore(Attribute attr)
Insert an Attribute into this list. |
Methods inherited from class org.freedesktop.bindings.Pointer |
---|
toString |
Methods inherited from class Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public AttributeList()
Method Detail |
---|
public void insert(Attribute attr)
IllegalStateException
- If you attempt to reuse an Attribute that is already in an
AttributeList.public void insertBefore(Attribute attr)
insert()
except that the Attribute will come before other Attributes
already in the list possessing the same start index.
IllegalStateException
- If you attempt to reuse an Attribute that is already in an
AttributeList.
|
![]() java-gnome |
||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |