Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>All of the Document classes you list have the same base functionality and each expands based on a niche that needs to be filled. Really, it's just a matter of realizing what you need to do and use the appropriate document type. For instance, if I am editing an HTML file, then I would use the HTMLDocument class.</p> <p>I included a brief description of each of the Document classes you requested in your question below.</p> <p><a href="http://java.sun.com/j2se/1.4.2/docs/api/org/w3c/dom/Document.html" rel="nofollow noreferrer">Document</a></p> <blockquote> <p>The Document interface represents the entire HTML or XML document. Conceptually, it is the root of the document tree, and provides the primary access to the document's data.</p> </blockquote> <p>This is the interface that all other Document types will inherit from. It provides the contract for all other Document types to follow.</p> <p><a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/AbstractDocument.html" rel="nofollow noreferrer">AbstractDocument</a></p> <blockquote> <p>This class implements a locking mechanism for the document it allows multiple readers or one writer, and writers must wait until all observers of the document have been notified of a previous change before beginning another mutation to the document.</p> </blockquote> <p>This class allows you to work with different types of documents and uses a very lose ruleset. This class is more difficult to implement because it is so generic.</p> <p><a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/StyledDocument.html" rel="nofollow noreferrer">StyledDocument</a></p> <p>Another interface that provides a contract for all styled documents. <a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/DefaultStyledDocument.html" rel="nofollow noreferrer">DefaultStyledDocument</a> implements this interface, so we'll get to that next.</p> <p><a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/DefaultStyledDocument.html" rel="nofollow noreferrer">DefaultStyledDocument</a></p> <blockquote> <p>A document that can be marked up with character and paragraph styles in a manner similar to the Rich Text Format. The element structure for this document represents style crossings for style runs. These style runs are mapped into a paragraph element structure (which may reside in some other structure). The style runs break at paragraph boundaries since logical styles are assigned to paragraph boundaries.</p> </blockquote> <p>DefaultStyledDocument allows you to place special characters within the document to help with formatting etc... Think Microsoft Word when you think about DefaultStyledDocument.</p> <p><a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/DocumentFilter.html" rel="nofollow noreferrer">DocumentFilter</a></p> <blockquote> <p>hen a Document containing a DocumentFilter is modified (either through insert or remove), it forwards the appropriate method invocation to the DocumentFilter.</p> </blockquote> <p>This is an extremely useful class that "listens" for events to occur against your document (i.e. modification) and will perform an action when each event occurs.</p> <p><a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/PlainDocument.html" rel="nofollow noreferrer">PlainDocument</a></p> <p>implements AbstractDocument and does not contain any kind of formatting special characters (Think notepad vs. Word). You should use this when you just want to store text (log file, etc.)</p> <p><a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/text/html/HTMLDocument.html" rel="nofollow noreferrer">HTMLDocument</a></p> <blockquote> <p>A document that models HTML. The purpose of this model is to support both browsing and editing.</p> </blockquote> <p>HTMLDocument should be used when you are creating/modifying documents that contain HTML code and are intended to be viewed in a browser.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload