接口的使用
javax.swing.text.AttributeSet
使用 AttributeSet 的包
包
描述
包含用于创建用户界面以及绘制图形和图像的所有类。
定义用户界面组件和提供对这些组件的访问的辅助技术之间的契约。
提供一组“轻量级”(全 Java 语言)组件,尽可能在所有平台上以相同的方式工作。
提供处理可编辑和不可编辑文本组件的类和接口。
提供用于创建 HTML 文本编辑器的类
HTMLEditorKit 和支持类。
-
AttributeSet 在 java.awt 中的用法
java.awt 中返回 AttributeSet 的方法修饰符和类型方法描述TextComponent.AccessibleAWTTextComponent.getCharacterAttribute(int i) 返回给定字符(在给定索引处)的 AttributeSet。 -
AttributeSet 在 javax.accessibility 中的用法
javax.accessibility 中的字段声明为 AttributeSetjavax.accessibility 中返回 AttributeSet 的方法javax.accessibility 中的方法,参数类型为 AttributeSet修饰符和类型方法描述voidAccessibleEditableText.setAttributes(int startIndex, int endIndex, AttributeSet as) 为两个索引之间的文本设置属性。javax.accessibility 中的构造函数,参数类型为 AttributeSet修饰符构造方法描述AccessibleAttributeSequence(int start, int end, AttributeSet attr) 使用给定的参数构造一个AccessibleAttributeSequence。 -
AttributeSet 在 javax.swing 中的用法
javax.swing 中返回 AttributeSet 的方法修饰符和类型方法描述AbstractButton.AccessibleAbstractButton.getCharacterAttribute(int i) 返回给定索引处给定字符的 AttributeSetJLabel.AccessibleJLabel.getCharacterAttribute(int i) 返回给定索引处给定字符的 AttributeSetJSpinner.AccessibleJSpinner.getCharacterAttribute(int i) 返回给定索引处给定字符的 AttributeSetProgressMonitor.AccessibleProgressMonitor.getCharacterAttribute(int i) 返回给定索引处给定字符的 AttributeSetJTextPane.getCharacterAttributes()获取在插入符号或null的当前位置有效的字符属性。JTextPane.getParagraphAttributes()获取在插入符号位置有效的当前段落属性,如果没有则为null。javax.swing 中的方法,参数类型为 AttributeSet修饰符和类型方法描述voidJSpinner.AccessibleJSpinner.setAttributes(int startIndex, int endIndex, AttributeSet as) 为两个索引之间的文本设置属性。voidJTextPane.setCharacterAttributes(AttributeSet attr, boolean replace) 将给定的属性应用于字符内容。voidJTextPane.setParagraphAttributes(AttributeSet attr, boolean replace) 将给定的属性应用于段落。 -
AttributeSet 在 javax.swing.text 中的用法
javax.swing.text 中 AttributeSet 的子接口javax.swing.text 中实现 AttributeSet 的类修饰符和类型类描述class实现元素的抽象部分。class实现包含其他元素的复合元素。class实现直接表示某种内容的元素。protected class文档的默认根元素...映射出包含的段落/行。class使用哈希表的 MutableAttributeSet 的直接实现。class属性的集合,通常用于表示字符和段落样式。class此类在数组中保存少量属性。javax.swing.text 中的字段声明为 AttributeSet修饰符和类型Field描述protected AttributeSetDefaultStyledDocument.AttributeUndoableEdit.copy元素包含的 AttributeSet 的副本。static final AttributeSetSimpleAttributeSet.EMPTY一个空的属性集。protected AttributeSetDefaultStyledDocument.AttributeUndoableEdit.newAttributes包含附加条目的 AttributeSet 必须是不可变的!javax.swing.text 中返回 AttributeSet 的方法修饰符和类型方法描述AbstractDocument.AttributeContext.addAttribute(AttributeSet old, Object name, Object value) 向给定集合添加一个属性,并返回新的代表集合。StyleContext.addAttribute(AttributeSet old, Object name, Object value) 向给定集合添加一个属性,并返回新的代表集合。AbstractDocument.AttributeContext.addAttributes(AttributeSet old, AttributeSet attr) 向元素添加一组属性。StyleContext.addAttributes(AttributeSet old, AttributeSet attr) 向元素添加一组属性。AbstractDocument.AbstractElement.copyAttributes()复制一组属性。AttributeSet.copyAttributes()返回保证不会随时间改变的属性集。SimpleAttributeSet.copyAttributes()复制属性。StyleContext.NamedStyle.copyAttributes()复制一组属性。StyleContext.SmallAttributeSet.copyAttributes()复制一组属性。AbstractDocument.AbstractElement.getAttributes()获取元素的属性。DefaultStyledDocument.ElementSpec.getAttributes()获取元素属性。Element.getAttributes()获取此元素包含的属性集合。View.getAttributes()获取渲染时要使用的属性。JTextComponent.AccessibleJTextComponent.getCharacterAttribute(int i) 返回给定字符(在给定索引处)的 AttributeSet。AbstractDocument.AttributeContext.getEmptySet()获取一个空的 AttributeSet。StyleContext.getEmptySet()获取一个空的 AttributeSet。AbstractDocument.AbstractElement.getResolveParent()获取解析父对象。AttributeSet.getResolveParent()获取解析父对象。SimpleAttributeSet.getResolveParent()获取解析父对象。StyleContext.NamedStyle.getResolveParent()从父级获取属性。StyleContext.SmallAttributeSet.getResolveParent()如果没有被覆盖,解析父元素默认为父元素。AbstractDocument.AttributeContext.removeAttribute(AttributeSet old, Object name) 从集合中移除一个属性。StyleContext.removeAttribute(AttributeSet old, Object name) 从集合中移除一个属性。AbstractDocument.AttributeContext.removeAttributes(AttributeSet old, Enumeration<?> names) 删除元素的一组属性。AbstractDocument.AttributeContext.removeAttributes(AttributeSet old, AttributeSet attrs) 删除元素的一组属性。StyleContext.removeAttributes(AttributeSet old, Enumeration<?> names) 删除元素的一组属性。StyleContext.removeAttributes(AttributeSet old, AttributeSet attrs) 删除元素的一组属性。javax.swing.text 中的方法,参数类型为 AttributeSet修饰符和类型方法描述AbstractDocument.AttributeContext.addAttribute(AttributeSet old, Object name, Object value) 向给定集合添加一个属性,并返回新的代表集合。StyleContext.addAttribute(AttributeSet old, Object name, Object value) 向给定集合添加一个属性,并返回新的代表集合。voidAbstractDocument.AbstractElement.addAttributes(AttributeSet attr) 向元素添加一组属性。AbstractDocument.AttributeContext.addAttributes(AttributeSet old, AttributeSet attr) 向元素添加一组属性。voidMutableAttributeSet.addAttributes(AttributeSet attributes) 创建一个与此类似的新属性集,不同之处在于它包含给定的属性和值。voidSimpleAttributeSet.addAttributes(AttributeSet attributes) 将一组属性添加到列表中。StyleContext.addAttributes(AttributeSet old, AttributeSet attr) 向元素添加一组属性。voidStyleContext.NamedStyle.addAttributes(AttributeSet attr) 向元素添加一组属性。booleanAbstractDocument.AbstractElement.containsAttributes(AttributeSet attrs) 检查元素是否包含所有属性。booleanAttributeSet.containsAttributes(AttributeSet attributes) 如果此集合定义给定集合中具有相等值的所有属性,则返回true。booleanSimpleAttributeSet.containsAttributes(AttributeSet attributes) 检查属性列表是否包含所有指定的名称/值对。booleanStyleContext.NamedStyle.containsAttributes(AttributeSet attrs) 检查元素是否包含所有属性。booleanStyleContext.SmallAttributeSet.containsAttributes(AttributeSet attrs) 检查属性集是否包含所有给定的属性。protected ElementAbstractDocument.createBranchElement(Element parent, AttributeSet a) 创建一个文档分支元素,它可以包含其他元素。protected MutableAttributeSetStyleContext.createLargeAttributeSet(AttributeSet a) 创建大量应该以空间换取时间的属性。protected ElementAbstractDocument.createLeafElement(Element parent, AttributeSet a, int p0, int p1) 创建文档叶元素。protected StyleContext.SmallAttributeSetStyleContext.createSmallAttributeSet(AttributeSet a) 创建一组可以共享的紧凑属性。static intStyleConstants.getAlignment(AttributeSet a) 获取对齐设置。DefaultStyledDocument.getBackground(AttributeSet attr) 从属性集中获取背景颜色。static ColorStyleConstants.getBackground(AttributeSet a) 从属性列表中获取背景颜色设置。StyleContext.getBackground(AttributeSet attr) 获取一组属性并将其转换为背景颜色规范。StyledDocument.getBackground(AttributeSet attr) 获取一组属性并将其转换为背景颜色规范。static intStyleConstants.getBidiLevel(AttributeSet a) 获取 BidiLevel 设置。static ComponentStyleConstants.getComponent(AttributeSet a) 从属性列表中获取组件设置。static floatStyleConstants.getFirstLineIndent(AttributeSet a) 获取首行缩进设置。DefaultStyledDocument.getFont(AttributeSet attr) 从属性集中获取字体。StyleContext.getFont(AttributeSet attr) 从属性集中获取字体。StyledDocument.getFont(AttributeSet attr) 获取一组属性并将其转换为字体规范。static StringStyleConstants.getFontFamily(AttributeSet a) 从属性列表中获取字体系列设置。static intStyleConstants.getFontSize(AttributeSet a) 从属性列表中获取字体大小设置。DefaultStyledDocument.getForeground(AttributeSet attr) 从属性集中获取前景色。static ColorStyleConstants.getForeground(AttributeSet a) 从属性列表中获取前景色设置。StyleContext.getForeground(AttributeSet attr) 获取一组属性并将其转换为前景颜色规范。StyledDocument.getForeground(AttributeSet attr) 获取一组属性并将其转换为前景颜色规范。static IconStyleConstants.getIcon(AttributeSet a) 从属性列表中获取图标设置。static floatStyleConstants.getLeftIndent(AttributeSet a) 获取左缩进设置。static floatStyleConstants.getLineSpacing(AttributeSet a) 获取行间距设置。static floatStyleConstants.getRightIndent(AttributeSet a) 获取正确的缩进设置。static floatStyleConstants.getSpaceAbove(AttributeSet a) 获取设置上方的空间。static floatStyleConstants.getSpaceBelow(AttributeSet a) 获取设置下方的空间。static TabSetStyleConstants.getTabSet(AttributeSet a) 获取选项卡集。voidAbstractDocument.insertString(int offs, String str, AttributeSet a) 在文档中插入一些内容。voidDocument.insertString(int offset, String str, AttributeSet a) 插入一串内容。abstract voidDocumentFilter.FilterBypass.insertString(int offset, String string, AttributeSet attr) 插入指定的文本,绕过 DocumentFilter。voidDocumentFilter.insertString(DocumentFilter.FilterBypass fb, int offset, String string, AttributeSet attr) 在将文本插入指定文档之前调用。voidPlainDocument.insertString(int offs, String str, AttributeSet a) 在文档中插入一些内容。protected voidAbstractDocument.insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr) 作为文本插入的结果更新文档结构。protected voidDefaultStyledDocument.insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr) 作为文本插入的结果更新文档结构。protected voidPlainDocument.insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr) 作为文本插入的结果更新文档结构。static booleanStyleConstants.isBold(AttributeSet a) 检查是否设置了 bold 属性。booleanAbstractDocument.AbstractElement.isEqual(AttributeSet attr) 检查两个属性集是否相等。booleanAttributeSet.isEqual(AttributeSet attr) 确定两个属性集是否等效。booleanSimpleAttributeSet.isEqual(AttributeSet attr) 比较两个属性集。booleanStyleContext.NamedStyle.isEqual(AttributeSet attr) 检查两个属性集是否相等。booleanStyleContext.SmallAttributeSet.isEqual(AttributeSet attr) 检查两个属性集是否相等。static booleanStyleConstants.isItalic(AttributeSet a) 检查是否设置了斜体属性。static booleanStyleConstants.isStrikeThrough(AttributeSet a) 检查是否设置了删除线属性。static booleanStyleConstants.isSubscript(AttributeSet a) 检查是否设置了下标属性。static booleanStyleConstants.isSuperscript(AttributeSet a) 检查是否设置了上标属性。static booleanStyleConstants.isUnderline(AttributeSet a) 检查是否设置了下划线属性。voidAbstractDocument.AttributeContext.reclaim(AttributeSet a) 回收属性集。voidStyleContext.reclaim(AttributeSet a) 返回 MutableAttributeSet 实现不再需要的集合。AbstractDocument.AttributeContext.removeAttribute(AttributeSet old, Object name) 从集合中移除一个属性。StyleContext.removeAttribute(AttributeSet old, Object name) 从集合中移除一个属性。voidAbstractDocument.AbstractElement.removeAttributes(AttributeSet attrs) 删除元素的一组属性。AbstractDocument.AttributeContext.removeAttributes(AttributeSet old, Enumeration<?> names) 删除元素的一组属性。AbstractDocument.AttributeContext.removeAttributes(AttributeSet old, AttributeSet attrs) 删除元素的一组属性。voidMutableAttributeSet.removeAttributes(AttributeSet attributes) 删除一组具有给定name的属性。voidSimpleAttributeSet.removeAttributes(AttributeSet attributes) 从列表中删除一组属性。voidStyleContext.NamedStyle.removeAttributes(AttributeSet attrs) 删除元素的一组属性。StyleContext.removeAttributes(AttributeSet old, Enumeration<?> names) 删除元素的一组属性。StyleContext.removeAttributes(AttributeSet old, AttributeSet attrs) 删除元素的一组属性。voidAbstractDocument.replace(int offset, int length, String text, AttributeSet attrs) 删除从offset到offset + length的文本区域,并将其替换为text。abstract voidDocumentFilter.FilterBypass.replace(int offset, int length, String string, AttributeSet attrs) 删除从offset到offset + length的文本区域,并将其替换为text。voidDocumentFilter.replace(DocumentFilter.FilterBypass fb, int offset, int length, String text, AttributeSet attrs) 在替换指定文档中的文本区域之前调用。voidJTextComponent.AccessibleJTextComponent.setAttributes(int startIndex, int endIndex, AttributeSet as) 为两个索引之间的文本设置属性。voidDefaultStyledDocument.setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace) 为文档的某些部分设置属性。voidStyledDocument.setCharacterAttributes(int offset, int length, AttributeSet s, boolean replace) 更改用于文档中给定范围的现有内容的内容元素属性。protected final voidStyledEditorKit.StyledTextAction.setCharacterAttributes(JEditorPane editor, AttributeSet attr, boolean replace) 将给定的属性应用于字符内容。voidDefaultStyledDocument.setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace) 设置段落的属性。voidStyledDocument.setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace) 设置段落属性。protected final voidStyledEditorKit.StyledTextAction.setParagraphAttributes(JEditorPane editor, AttributeSet attr, boolean replace) 将给定的属性应用于段落。protected voidCompositeView.setParagraphInsets(AttributeSet attr) 从给定属性中指定的段落属性设置insets。voidAbstractDocument.AbstractElement.setResolveParent(AttributeSet parent) 设置解析父级。voidMutableAttributeSet.setResolveParent(AttributeSet parent) 设置解析父级。voidSimpleAttributeSet.setResolveParent(AttributeSet parent) 设置解析父级。voidStyleContext.NamedStyle.setResolveParent(AttributeSet parent) 设置解析父级。protected voidAbstractWriter.writeAttributes(AttributeSet attr) 将属性集写出为“<name>=<value>”对。voidStyleContext.writeAttributes(ObjectOutputStream out, AttributeSet a) 写出属性的上下文特定处理static voidStyleContext.writeAttributeSet(ObjectOutputStream out, AttributeSet a) 将一组属性写入给定的对象流以进行序列化。javax.swing.text 中的构造函数,参数类型为 AttributeSet修饰符构造方法描述AbstractElement(Element parent, AttributeSet a) 创建一个新的抽象元素。AttributeUndoableEdit(Element element, AttributeSet newAttributes, boolean isReplacing) 构造一个AttributeUndoableEdit。BranchElement(Element parent, AttributeSet a) 构造一个最初不包含子元素的复合元素。ElementSpec(AttributeSet a, short type) 当标记不存储在文档中时,构造方法对标记很有用。ElementSpec(AttributeSet a, short type, char[] txt, int offs, int len) 用于在外部创建规范以将内容和标记批量输入到文档中的构造方法。ElementSpec(AttributeSet a, short type, int len) 当已经添加了数据但需要 len 信息时,用于在文档内部解析的构造方法。LeafElement(Element parent, AttributeSet a, int offs0, int offs1) 构造一个表示文档中内容的元素(没有子元素)。SimpleAttributeSet(AttributeSet source) 根据提供的属性集创建新的属性集。SmallAttributeSet(AttributeSet attrs) 构造一个 SmallAttributeSet。 -
AttributeSet 在 javax.swing.text.html 中的用法
修饰符和类型类描述class表示 HTML 结构 block 的元素。class代表一段文本的元素,该文本块分配有一组 HTML 字符级属性。javax.swing.text.html 中返回 AttributeSet 的方法修饰符和类型方法描述StyleSheet.addAttribute(AttributeSet old, Object key, Object value) 向给定集合添加一个属性,并返回新的代表集合。StyleSheet.addAttributes(AttributeSet old, AttributeSet attr) 向元素添加一组属性。BlockView.getAttributes()获取渲染时要使用的属性。abstract AttributeSetHTMLDocument.Iterator.getAttributes()返回此标记的属性。ImageView.getAttributes()获取渲染时要使用的属性。InlineView.getAttributes()获取渲染时要使用的属性。Option.getAttributes()获取与此选项关联的属性。ParagraphView.getAttributes()获取渲染时要使用的属性。StyleSheet.getDeclaration(String decl) 将 CSS 声明转换为表示 CSS 声明的 AttributeSet。HTMLDocument.BlockElement.getResolveParent()获取解析父对象。HTMLDocument.RunElement.getResolveParent()获取解析父对象。StyleSheet.getViewAttributes(View v) 获取一组属性以在视图中用于显示。StyleSheet.removeAttribute(AttributeSet old, Object key) 从集合中移除一个属性。StyleSheet.removeAttributes(AttributeSet old, Enumeration<?> names) 删除元素的一组属性。StyleSheet.removeAttributes(AttributeSet old, AttributeSet attrs) 删除一组属性。StyleSheet.translateHTMLToCSS(AttributeSet htmlAttrSet) 将一组 HTML 属性转换为等效的一组 CSS 属性。javax.swing.text.html 中的方法,参数类型为 AttributeSet修饰符和类型方法描述StyleSheet.addAttribute(AttributeSet old, Object key, Object value) 向给定集合添加一个属性,并返回新的代表集合。StyleSheet.addAttributes(AttributeSet old, AttributeSet attr) 向元素添加一组属性。protected voidHTMLWriter.closeOutUnwantedEmbeddedTags(AttributeSet attr) 搜索属性集并搜索存储在标签向量中的每个标签。protected ElementHTMLDocument.createBranchElement(Element parent, AttributeSet a) 创建一个文档分支元素,它可以包含其他元素。protected MutableAttributeSetStyleSheet.createLargeAttributeSet(AttributeSet a) 创建大量属性,这些属性应该以空间换取时间。protected ElementHTMLDocument.createLeafElement(Element parent, AttributeSet a, int p0, int p1) 创建一个直接表示文本的文档叶元素(没有任何子元素)。protected StyleContext.SmallAttributeSetStyleSheet.createSmallAttributeSet(AttributeSet a) 创建一组可以共享的紧凑属性。StyleSheet.getBackground(AttributeSet a) 获取一组属性并将其转换为背景颜色规范。StyleSheet.getBoxPainter(AttributeSet a) 获取框格式化程序以用于给定的 CSS 属性集。StyleSheet.getFont(AttributeSet a) 获取用于给定属性集的字体。StyleSheet.getForeground(AttributeSet a) 获取一组属性并将其转换为前景颜色规范。static intHTML.getIntegerAttributeValue(AttributeSet attr, HTML.Attribute key, int def) 获取整数属性值。StyleSheet.getListPainter(AttributeSet a) 获取列表格式化程序以用于给定的 CSS 属性集。protected voidHTMLDocument.insertUpdate(AbstractDocument.DefaultDocumentEvent chng, AttributeSet attr) 作为文本插入的结果更新文档结构。protected booleanHTMLWriter.isBlockTag(AttributeSet attr) 确定与元素关联的 HTML.Tag 是否为块标记。protected booleanHTMLWriter.matchNameAttribute(AttributeSet attr, HTML.Tag tag) 如果 StyleConstants.NameAttribute 等于作为参数传入的标记,则返回 true。StyleSheet.removeAttribute(AttributeSet old, Object key) 从集合中移除一个属性。StyleSheet.removeAttributes(AttributeSet old, Enumeration<?> names) 删除元素的一组属性。StyleSheet.removeAttributes(AttributeSet old, AttributeSet attrs) 删除一组属性。protected voidHTMLWriter.selectContent(AttributeSet attr) 写出 SELECT 表单元素的内容。voidHTMLDocument.setParagraphAttributes(int offset, int length, AttributeSet s, boolean replace) 设置段落的属性。protected voidHTMLWriter.textAreaContent(AttributeSet attr) 写出包含在 TEXTAREA 表单元素中的文本。StyleSheet.translateHTMLToCSS(AttributeSet htmlAttrSet) 将一组 HTML 属性转换为等效的一组 CSS 属性。protected voidHTMLWriter.writeAttributes(AttributeSet attr) 写出属性集。protected voidMinimalHTMLWriter.writeAttributes(AttributeSet attr) 写出以下类型的所有属性:StyleConstants.ParagraphConstants、StyleConstants.CharacterConstants、StyleConstants.FontConstants、StyleConstants.ColorConstants。protected voidHTMLWriter.writeEmbeddedTags(AttributeSet attr) 在 AttributeSet 中搜索嵌入的标签并将它们写出。protected voidMinimalHTMLWriter.writeHTMLTags(AttributeSet attr) 根据文本的属性设置为文本生成粗体 <b>、斜体 <i> 和 <u> 标记。protected voidMinimalHTMLWriter.writeNonHTMLAttributes(AttributeSet attr) 以符合 HTML 的方式写出剩余的字符级属性(粗体、斜体和下划线以外的属性)。javax.swing.text.html 中的构造函数,参数类型为 AttributeSet修饰符构造方法描述BlockElement(Element parent, AttributeSet a) 构造一个最初不包含子元素的复合元素。Option(AttributeSet attr) 创建一个新的选项对象。RunElement(Element parent, AttributeSet a, int offs0, int offs1) 构造一个表示文档中内容的元素(没有子元素)。