public class TextDocument extends AbstractDocument
This class also contains a DocumentFactory for documents of this type. The document factory is used by an application to create documents of this type.
Modifier and Type | Class and Description |
---|---|
static class |
TextDocument.Factory
TextDocument.Factory is a factory for Text Documents
|
Constructor and Description |
---|
TextDocument(Application application)
Create an text document for the given application containing an
empty string.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the document.
|
String |
getText()
Return the text contained in this document.
|
void |
open()
Open the document from its current file or URL.
|
void |
save()
Save the document to its current file or URL.
|
void |
saveAs(File file)
Save the document to the given file.
|
void |
saveAs(URL url)
Save the document to the given URL.
|
void |
setText(String text)
Set the text contained by this document.
|
addPropertyChangeListener, getApplication, getEditSupport, getFile, getShortTitle, getTitle, getUndoManager, getURL, isDirty, isEditable, isWritable, removePropertyChangeListener, setDirty, setEditable, setFile, setURL, setWritable
public TextDocument(Application application)
public void close()
close
in interface Document
close
in class AbstractDocument
Exception
- If the close operation fails.public String getText()
public void open() throws Exception
open
in interface Document
open
in class AbstractDocument
Exception
- If the close operation fails.public void save() throws Exception
save
in interface Document
save
in class AbstractDocument
Exception
- If the save operation fails.public void saveAs(File file) throws Exception
public void saveAs(URL url) throws Exception
public void setText(String text)
Copyright © 2024 Central Laboratory of the Research Councils. All Rights Reserved.