1 /* 2 * @(#)Style.java 1.21 03/12/19 3 * 4 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 5 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 6 */ 7 package javax.swing.text; 8 9 import java.awt.Component; 10 import javax.swing.event.ChangeListener; 11 import javax.swing.event.ChangeEvent; 12 13 import java.util.Enumeration; 14 import java.util.Hashtable; 15 16 17 18 /** 19 * A collection of attributes to associate with an element in a document. 20 * Since these are typically used to associate character and paragraph 21 * styles with the element, operations for this are provided. Other 22 * customized attributes that get associated with the element will 23 * effectively be name-value pairs that live in a hierarchy and if a name 24 * (key) is not found locally, the request is forwarded to the parent. 25 * Commonly used attributes are separated out to facilitate alternative 26 * implementations that are more efficient. 27 * 28 * @author Timothy Prinzing 29 * @version 1.21 12/19/03 30 */ 31 public interface Style extends MutableAttributeSet { 32 33 /** 34 * Fetches the name of the style. A style is not required to be named, 35 * so <code>null</code> is returned if there is no name 36 * associated with the style. 37 * 38 * @return the name 39 */ 40 public String getName(); 41 42 /** 43 * Adds a listener to track whenever an attribute 44 * has been changed. 45 * 46 * @param l the change listener 47 */ 48 public void addChangeListener(ChangeListener l); 49 50 /** 51 * Removes a listener that was tracking attribute changes. 52 * 53 * @param l the change listener 54 */ 55 public void removeChangeListener(ChangeListener l); 56 57 58 } 59