Provides classes and interfaces that deal with editable and noneditable text components. Examples of text components are text fields and text areas, of which password fields and document editors are special instantiations. Features that are supported by this package include selection/highlighting, editing, style, and key mapping.
Related DocumentationFor overviews, tutorials, examples, guides, and tool documentation, please see:
- Using Text Components, a section in The Java Tutorial
Interface Summary Interface Description AbstractDocument.AttributeContextAn interface that can be used to allow MutableAttributeSet implementations to use pluggable attribute compression techniques. AbstractDocument.ContentInterface to describe a sequence of character content that can be edited. AttributeSetA collection of unique attributes. AttributeSet.CharacterAttributeThis interface is the type signature that is expected to be present on any attribute key that contributes to character level presentation. AttributeSet.ColorAttributeThis interface is the type signature that is expected to be present on any attribute key that contributes to presentation of color. AttributeSet.FontAttributeThis interface is the type signature that is expected to be present on any attribute key that contributes to the determination of what font to use to render some text. AttributeSet.ParagraphAttributeThis interface is the type signature that is expected to be present on any attribute key that contributes to the paragraph level presentation. CaretA place within a document view that represents where things can be inserted into the document model. DocumentThe
Documentis a container for text that serves as the model for swing text components.
ElementInterface to describe a structural piece of a document. HighlighterAn interface for an object that allows one to mark up the background with colored areas. Highlighter.HighlightA highlight. Highlighter.HighlightPainterHighlight renderer. KeymapA collection of bindings of KeyStrokes to actions. MutableAttributeSetA generic interface for a mutable collection of unique attributes. PositionRepresents a location within a document. StyleA collection of attributes to associate with an element in a document. StyledDocumentInterface for a generic styled document. TabableViewInterface for
Views that have size dependent upon tabs.
TabExpanderSimple interface to allow for different types of implementations of tab expansion. ViewFactoryA factory to create a view of some portion of document subject.
Class Summary Class Description AbstractDocumentAn implementation of the document interface to serve as a basis for implementing various kinds of documents. AbstractDocument.ElementEditAn implementation of ElementChange that can be added to the document event. AbstractWriterAbstractWriter is an abstract class that actually does the work of writing out the element tree including the attributes. AsyncBoxViewA box that does layout asynchronously. BoxViewA view that arranges its children into a box shape by tiling its children along an axis. ComponentViewComponent decorator that implements the view interface. CompositeView
CompositeViewis an abstract
Viewimplementation which manages one or more child views.
DateFormatterDateFormatter is an
InternationalFormatterthat does its formatting by way of an instance of
DefaultCaretA default implementation of Caret. DefaultEditorKitThis is the set of things needed by a text component to be a reasonably functioning editor for some type of text document. DefaultEditorKit.BeepActionCreates a beep. DefaultEditorKit.CopyActionCopies the selected region and place its contents into the system clipboard. DefaultEditorKit.CutActionCuts the selected region and place its contents into the system clipboard. DefaultEditorKit.DefaultKeyTypedActionThe action that is executed by default if a key typed event is received and there is no keymap entry. DefaultEditorKit.InsertBreakActionPlaces a line/paragraph break into the document. DefaultEditorKit.InsertContentActionPlaces content into the associated document. DefaultEditorKit.InsertTabActionPlaces a tab character into the document. DefaultEditorKit.PasteActionPastes the contents of the system clipboard into the selected region, or before the caret if nothing is selected. DefaultFormatter
DefaultFormatterformats arbitrary objects.
DefaultFormatterFactoryAn implementation of
DefaultHighlighterImplements the Highlighter interfaces. DefaultHighlighter.DefaultHighlightPainterSimple highlight painter that fills a highlighted area with a solid color. DefaultStyledDocumentA document that can be marked up with character and paragraph styles in a manner similar to the Rich Text Format. DefaultStyledDocument.AttributeUndoableEditAn UndoableEdit used to remember AttributeSet changes to an Element. DefaultStyledDocument.ElementSpecSpecification for building elements. DefaultTextUI Deprecated. DocumentFilter
DocumentFilter, as the name implies, is a filter for the
DocumentFilter.FilterBypassUsed as a way to circumvent calling back into the Document to change it. EditorKitEstablishes the set of things needed by a text component to be a reasonably functioning editor for some type of text content. ElementIteratorElementIterator, as the name suggests, iterates over the Element tree. FieldViewExtends the multi-line plain text view to be suitable for a single-line editor view. FlowViewA View that tries to flow it's children into some partially constrained space. FlowView.FlowStrategyStrategy for maintaining the physical form of the flow. GapContentAn implementation of the AbstractDocument.Content interface implemented using a gapped buffer similar to that used by emacs. GlyphViewA GlyphView is a styled chunk of text that represents a view mapped over an element in the text model. GlyphView.GlyphPainterA class to perform rendering of the glyphs. IconViewIcon decorator that implements the view interface. InternationalFormatter
DefaultFormatter, using an instance of
java.text.Formatto handle the conversion to a String, and the conversion from a String.
JTextComponentis the base class for swing text components.
JTextComponent.DropLocationRepresents a drop location for
JTextComponent.KeyBindingBinding record for creating key bindings. LabelViewA
LabelViewis a styled chunk of text that represents a view mapped over an element in the text model.
LayeredHighlighter LayeredHighlighter.LayerPainterLayered highlight renderer. LayoutQueueA queue of text layout tasks. MaskFormatter
MaskFormatteris used to format and edit strings.
NavigationFiltercan be used to restrict where the cursor can be positioned.
NavigationFilter.FilterBypassUsed as a way to circumvent calling back into the caret to position the cursor. NumberFormatter
InternationalFormatteradding special behavior for numbers.
ParagraphViewView of a simple line-wrapping paragraph that supports multiple fonts, colors, components, icons, etc. PasswordViewImplements a View suitable for use in JPasswordField UI implementations. PlainDocumentA plain document that maintains no character attributes. PlainViewImplements View interface for a simple multi-line text view that has text in one font and color. Position.BiasA typesafe enumeration to indicate bias to a position in the model. SegmentA segment of a character array representing a fragment of text. SimpleAttributeSetA straightforward implementation of MutableAttributeSet using a hash table. StringContentAn implementation of the AbstractDocument.Content interface that is a brute force implementation that is useful for relatively small documents and/or debugging. StyleConstantsA collection of well known or common attribute keys and methods to apply to an AttributeSet or MutableAttributeSet to get/set the properties in a typesafe manner. StyleConstants.CharacterConstantsThis is a typesafe enumeration of the well-known attributes that contribute to a character style. StyleConstants.ColorConstantsThis is a typesafe enumeration of the well-known attributes that contribute to a color. StyleConstants.FontConstantsThis is a typesafe enumeration of the well-known attributes that contribute to a font. StyleConstants.ParagraphConstantsThis is a typesafe enumeration of the well-known attributes that contribute to a paragraph style. StyleContextA pool of styles and their associated resources. StyledEditorKitThis is the set of things needed by a text component to be a reasonably functioning editor for some type of text document. StyledEditorKit.AlignmentActionAn action to set paragraph alignment. StyledEditorKit.BoldActionAn action to toggle the bold attribute. StyledEditorKit.FontFamilyActionAn action to set the font family in the associated JEditorPane. StyledEditorKit.FontSizeActionAn action to set the font size in the associated JEditorPane. StyledEditorKit.ForegroundActionAn action to set foreground color. StyledEditorKit.ItalicActionAn action to toggle the italic attribute. StyledEditorKit.StyledTextActionAn action that assumes it's being fired on a JEditorPane with a StyledEditorKit (or subclass) installed. StyledEditorKit.UnderlineActionAn action to toggle the underline attribute. TableViewImplements View interface for a table, that is composed of an element structure where the child elements of the element this view is responsible for represent rows and the child elements of the row elements are cells. TabSetA TabSet is comprised of many TabStops. TabStopThis class encapsulates a single tab stop (basically as tab stops are thought of by RTF). TextActionAn Action implementation useful for key bindings that are shared across a number of different text components. UtilitiesA collection of methods to deal with various text related activities. ViewA very important part of the text package is the
WrappedPlainViewView of plain text (text with only one font and color) that does line-wrapping. ZoneViewZoneView is a View implementation that creates zones for which the child views are not created or stored until they are needed for display or model/view translations.
Exception Summary Exception Description BadLocationExceptionThis exception is to report bad locations within a document model (that is, attempts to reference a location that doesn't exist). ChangedCharSetExceptionChangedCharSetException as the name indicates is an exception thrown when the charset is changed.