|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbuoy.event.EventSource
buoy.widget.Widget
buoy.widget.BDocumentViewer
public class BDocumentViewer
A BDocumentViewer is used for displaying formatted text documents. The supported document types include HTML, Rich Text Format (RTF), and plain text. This class is most often used for displaying help screens or documentation within a program.
When the user clicks on a hyperlink inside an HTML document, the BDocumentViewer generates a
DocumentLinkEvent
. You can then pass that event to
processLinkEvent()
, which will load the
new document pointed to by the hyperlink. This can be done most easily by having the BDocumentViewer
listen for its own events directly:
viewer.addEventLink(DocumentLinkEvent.class, viewer, "processLinkEvent");
Alternatively, you can have another object listen for the events and then pass them on to the BDocumentViewer. This would be useful, for example, if you wanted to filter the events and only allow certain hyperlinks to be followed.
When you tell the BDocumentViewer to load a new document, either by calling
setDocument()
or
processLinkEvent()
, the loading is usually
done asynchronously. When loading is complete, it generates a
ValueChangedEvent
. If you want to show a
progress bar while the document is being loaded, for example, you can listen for the event to
know when to stop animating the progress bar.
In addition to the event types generated by all Widgets, BDocumentViewers generate the following event types:
Constructor Summary | |
---|---|
BDocumentViewer()
Create an empty BDocumentViewer. |
|
BDocumentViewer(java.net.URL document)
Create a new BDocumentViewer displaying the document referenced by a URL. |
Method Summary | |
---|---|
javax.swing.JEditorPane |
getComponent()
Get the java.awt.Component corresponding to this Widget. |
java.lang.String |
getContentType()
Get the MIME type of the document currently being displayed. |
java.net.URL |
getDocument()
Get the URL for the document currently being displayed. |
void |
processLinkEvent(DocumentLinkEvent event)
Process a DocumentLinkEvent generated by this viewer, and handle it appropriately. |
void |
setDocument(java.lang.String text,
java.lang.String type)
Set the document to display in this BDocumentViewer. |
void |
setDocument(java.net.URL document)
Set the document to display in this BDocumentViewer. |
Methods inherited from class buoy.widget.Widget |
---|
addEventLink, dispatchEvent, getBackground, getBounds, getCursor, getFont, getMaximumSize, getMinimumSize, getName, getParent, getPreferredSize, hasFocus, isEnabled, isFocusable, isVisible, repaint, requestFocus, setBackground, setCursor, setEnabled, setFocusable, setFont, setName, setVisible |
Methods inherited from class buoy.event.EventSource |
---|
addEventLink, addEventLink, removeEventLink |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BDocumentViewer()
public BDocumentViewer(java.net.URL document) throws java.io.IOException
document
- a URL pointing to the document to display
java.io.IOException
Method Detail |
---|
public javax.swing.JEditorPane getComponent()
Widget
getComponent
in class Widget
public java.net.URL getDocument()
public void setDocument(java.net.URL document) throws java.io.IOException
document
- a URL pointing to the document to display
java.io.IOException
public void setDocument(java.lang.String text, java.lang.String type)
text
- the text of the document to displaytype
- the MIME type of the documentpublic java.lang.String getContentType()
public void processLinkEvent(DocumentLinkEvent event) throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |