Determining If a Style Attribute Applies to a Character or the Paragraph
import javax.swing.text.AttributeSet; import javax.swing.text.StyleConstants; public class Main { public static void main(String[] argv) { // Check if character-based attribute boolean b = StyleConstants.Italic instanceof AttributeSet.CharacterAttribute; b = StyleConstants.LineSpacing instanceof AttributeSet.CharacterAttribute; // Check if paragraph-based attribute b = StyleConstants.LineSpacing instanceof AttributeSet.ParagraphAttribute; b = StyleConstants.Italic instanceof AttributeSet.ParagraphAttribute; } }