Java プラットフォーム 1.2

javax.swing.text
クラス StyleContext.NamedStyle

java.lang.Object
  |
  +--javax.swing.text.StyleContext.NamedStyle

public class StyleContext.NamedStyle
extends Object
implements Style, Serializable

通常、文字および段落の書式を表すために使われる属性のコレクションです。これは、必要な場合に監視できる MutableAttributeSet の実装です。それらの書式は変更が不可能であることを最大限に利用します。また、このセットはかなり小さいため、SimpleAttributeSet などよりも大幅に効率的である場合があります。

警告: このクラスの直列化されたオブジェクトは、今後の Swing リリースと互換ではなくなる予定です。現在の直列化のサポートは、短期間の運用や、同じバージョンの Swing を実行するアプリケーション間の RMI に適しています。今後の Swing リリースでは、長期間の持続性をサポートする予定です。

関連項目:
直列化された形式

フィールドの概要
protected  ChangeEvent changeEvent
          モデルの各インスタンスには、ChangeEvent が 1 つだけ必要です。
protected  EventListenerList listenerList
          モデルの変更リスナーです。
 
コンストラクタの概要
StyleContext.NamedStyle()
          名前と親が null の新しい名前付き書式を作成します。
StyleContext.NamedStyle(String name, Style parent)
          新しい名前付き書式を作成します。
StyleContext.NamedStyle(Style parent)
          新しい名前付き書式を作成します。
 
メソッドの概要
 void addAttribute(Object name, Object value)
          属性を追加します。
 void addAttributes(AttributeSet attr)
          要素に属性セットを追加します。
 void addChangeListener(ChangeListener l)
          変更リスナーを追加します。
 boolean containsAttribute(Object name, Object value)
          指定された属性名と値が定義されているかどうかを判定します。
 boolean containsAttributes(AttributeSet attrs)
          要素にすべての属性が含まれているかどうかを判定します。
 AttributeSet copyAttributes()
          属性セットをコピーします。
protected  void fireStateChanged()
          このイベントタイプへの通知を配信対象に登録しているリスナーをすべて通知します。
 Object getAttribute(Object attrName)
          属性の値を取得します。
 int getAttributeCount()
          定義されている属性の数を取得します。
 Enumeration getAttributeNames()
          すべての属性の名前を取得します。
 String getName()
          書式の名前を取得します。
 AttributeSet getResolveParent()
          親から属性を取得します。
 boolean isDefined(Object attrName)
          指定された属性が定義されているかどうかを判定します。
 boolean isEqual(AttributeSet attr)
          2 つの属性セットが同じかどうかを判定します。
 void removeAttribute(Object name)
          セットから属性を削除します。
 void removeAttributes(AttributeSet attrs)
          要素の属性セットを削除します。
 void removeAttributes(Enumeration names)
          要素の属性セットを削除します。
 void removeChangeListener(ChangeListener l)
          変更リスナーを削除します。
 void setName(String name)
          書式の名前を変更します。
 void setResolveParent(AttributeSet parent)
          解釈処理側の親を設定します。
 String toString()
          書式を文字列に変換します。
 
クラス java.lang.Object から継承したメソッド
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

フィールドの詳細

listenerList

protected EventListenerList listenerList
モデルの変更リスナーです。

changeEvent

protected transient ChangeEvent changeEvent
モデルの各インスタンスには、ChangeEvent が 1 つだけ必要です。これは、イベントの専用 (読み込み専用) 状態がソースプロパティだからです。ここで生成されるイベントのソースは常に「this」です。
コンストラクタの詳細

StyleContext.NamedStyle

public StyleContext.NamedStyle(String name,
                               Style parent)
新しい名前付き書式を作成します。
パラメータ:
name - 書式名。名前のない場合は null
parent - 親書式。ない場合は null

StyleContext.NamedStyle

public StyleContext.NamedStyle(Style parent)
新しい名前付き書式を作成します。
パラメータ:
parent - 親書式。ない場合は null

StyleContext.NamedStyle

public StyleContext.NamedStyle()
名前と親が null の新しい名前付き書式を作成します。
メソッドの詳細

toString

public String toString()
書式を文字列に変換します。
戻り値:
文字列
オーバーライド:
クラス Object 内の toString

getName

public String getName()
書式の名前を取得します。書式は名前を付ける必要がないので、書式に関連付けられている名前がない場合は null が返されます。
定義:
インタフェース Style 内の getName
戻り値:
名前

setName

public void setName(String name)
書式の名前を変更します。名前が null の場合は何も行いません。
パラメータ:
name - 新しい名前

addChangeListener

public void addChangeListener(ChangeListener l)
変更リスナーを追加します。
定義:
インタフェース Style 内の addChangeListener
パラメータ:
l - 変更リスナー
関連項目:
Attributes#addChangeListener

removeChangeListener

public void removeChangeListener(ChangeListener l)
変更リスナーを削除します。
定義:
インタフェース Style 内の removeChangeListener
パラメータ:
l - 変更リスナー
関連項目:
Attributes#removeChangeListener

fireStateChanged

protected void fireStateChanged()
このイベントタイプへの通知を配信対象に登録しているリスナーをすべて通知します。fire メソッドに渡されたパラメータを使用して、イベントのインスタンスはゆっくりと生成されます。
関連項目:
EventListenerList

getAttributeCount

public int getAttributeCount()
定義されている属性の数を取得します。
戻り値:
属性の数 >= 0
関連項目:
AttributeSet.getAttributeCount()

isDefined

public boolean isDefined(Object attrName)
指定された属性が定義されているかどうかを判定します。
パラメータ:
attrName - null 以外の属性名
戻り値:
属性が定義されている場合は true
関連項目:
AttributeSet.isDefined(java.lang.Object)

isEqual

public boolean isEqual(AttributeSet attr)
2 つの属性セットが同じかどうかを判定します。
パラメータ:
attr - 調べる属性セット
戻り値:
同じ場合は true
関連項目:
AttributeSet.isEqual(javax.swing.text.AttributeSet)

copyAttributes

public AttributeSet copyAttributes()
属性セットをコピーします。
戻り値:
コピー
関連項目:
AttributeSet.copyAttributes()

getAttribute

public Object getAttribute(Object attrName)
属性の値を取得します。
パラメータ:
attrName - null 以外の属性名
戻り値:
属性値
関連項目:
AttributeSet.getAttribute(java.lang.Object)

getAttributeNames

public Enumeration getAttributeNames()
すべての属性の名前を取得します。
戻り値:
属性名の列挙
関連項目:
AttributeSet.getAttributeNames()

containsAttribute

public boolean containsAttribute(Object name,
                                 Object value)
指定された属性名と値が定義されているかどうかを判定します。
パラメータ:
name - null 以外の属性名
value - 属性値
戻り値:
名前と値が定義されている場合は true
関連項目:
AttributeSet.containsAttribute(java.lang.Object, java.lang.Object)

containsAttributes

public boolean containsAttributes(AttributeSet attrs)
要素にすべての属性が含まれているかどうかを判定します。
パラメータ:
attrs - 調べる属性
戻り値:
要素にすべての属性が含まれている場合は true
関連項目:
AttributeSet.containsAttributes(javax.swing.text.AttributeSet)

getResolveParent

public AttributeSet getResolveParent()
親から属性を取得します。オーバーライドされていない場合、解釈処理側の親のデフォルトは親要素です。
戻り値:
親からの属性
関連項目:
AttributeSet.getResolveParent()

addAttribute

public void addAttribute(Object name,
                         Object value)
属性を追加します。
パラメータ:
name - null 以外の属性名
value - 属性値
関連項目:
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)

addAttributes

public void addAttributes(AttributeSet attr)
要素に属性セットを追加します。
パラメータ:
attr - 追加する属性
関連項目:
MutableAttributeSet.addAttribute(java.lang.Object, java.lang.Object)

removeAttribute

public void removeAttribute(Object name)
セットから属性を削除します。
パラメータ:
name - null 以外の属性名
関連項目:
MutableAttributeSet.removeAttribute(java.lang.Object)

removeAttributes

public void removeAttributes(Enumeration names)
要素の属性セットを削除します。
パラメータ:
names - 属性名
関連項目:
MutableAttributeSet.removeAttributes(java.util.Enumeration)

removeAttributes

public void removeAttributes(AttributeSet attrs)
要素の属性セットを削除します。
パラメータ:
attrs - 属性
関連項目:
MutableAttributeSet.removeAttributes(java.util.Enumeration)

setResolveParent

public void setResolveParent(AttributeSet parent)
解釈処理側の親を設定します。
パラメータ:
parent - 親。ない場合は null
関連項目:
MutableAttributeSet.setResolveParent(javax.swing.text.AttributeSet)

Java プラットフォーム 1.2

バグや機能要求の報告
新しい javadoc の表示についてのコメントやご提案
Java は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.