Article View: borland.public.jbuilder.java.swing
Article #8928JEditorPane: switching between html-Source and preview
From: Werner Moschina
Date: Thu, 29 Jun 2000 00:00
Date: Thu, 29 Jun 2000 00:00
51 lines
1892 bytes
1892 bytes
Hi,
I want to display a html-file's source and to look the result. My idea
is to use a JEditorPane and switch the contentType from "text/plain" to
"text/html".
My problem is, that the stylesheet is not used after switching from
source to preview. Using the method call
"remarksView.setPage(URL-to-html-file-to-display);"
to initialize the JEditorPane, the file is displayed well, including the
definitions in the stylesheet.
Does anybody has a hint for me?
tia
Regards, Werner (using JBuilder3.5 Foundation)
------ further information --------
The stylesheet
<link rel="stylesheet" href="Z:/demo/root/common/styles/glossary.css">
is used in the HTML-file
------ method for switching between "text/plain" and "text/html"
/** switch from HTML source (editable) to HTML preview (not editable)
* bSOURCE is defined as true,
* bPREVIEW is defined as false.
* remarksEditor is instance of JEditorPane.
*/
public void setViewType(boolean flag)
{
String text;
text = remarksEditor.getText();
if (flag == bSOURCE)
{
remarksEditor.setEditable(true);
remarksEditor.setContentType("text/plain");
}
else
{
remarksEditor.setEditable(false);
remarksEditor.setContentType("text/html");
}
remarksEditor.setText(text);
}
Technical Details
Message-ID:
<395B3CF4.A51CA6D3@stutensee.net>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,b037e31ddfb7586b,start X-Google-Attributes: gid111d45,public From: Werner Moschina <wmo@stutensee.net> Subject: JEditorPane: switching between html-Source and preview Date: 2000/06/29 Message-ID: <395B3CF4.A51CA6D3@stutensee.net> X-Deja-AN: 640370334 Content-Transfer-Encoding: 7bit Organization: Another Netscape Collabra Server User X-Accept-Language: de Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 Newsgroups: borland.public.jbuilder.java.swing