Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / September 2003

Tip: Looking for answers? Try searching our database.

loss of formatting using jEditorPane

Thread view: 
Scott Bolland - 08 Sep 2003 01:30 GMT
Hi Guys,

I am writing an app. in which I would like the user to be able to save and
load information typed into a jEditorPane.  However, there seems to be
formatting that is crucial to me that is lost in this converstion.  In
particular, when you "getText()" from a jEditorPane, tabs are encoded as
"\t" rather than "<tab>" and line breaks that have been entered into a table
are saved as "\n" rather than "<br>".  Thus, when reloading the page, the
formatting is lost, as HTML treats the above characters as whitespace.
Search and replacing "\t" with <tab> may fix the first problem (before the
file is saved), but replacing "\n" with "<br>" would place breaks all over
the place.

Any suggestions would be greatly appreciated.

Cheers,

Scott.
Christian Kaufhold - 08 Sep 2003 23:31 GMT
Hello!

> I am writing an app. in which I would like the user to be able to save and
> load information typed into a jEditorPane.  However, there seems to be
[quoted text clipped - 6 lines]
> file is saved), but replacing "\n" with "<br>" would place breaks all over
> the place.

1. There is no such thing as <tab> in HTML. It is confusing that HTML-
EditorKit maps the Tab key to inserting a Tab (instead of just inserting a
space or doing nothing and leave Tab for focus management).

2. Why should "line-breaks" be saved as <br> and not separate pararaphs?

3. The problem seems to be that within implied paragraphs (direct content
in <li> or <td> as in <table><tr><td>Content</td></tr></table) only work
if there is a single one of them. Otherwise all except the first must be
converted into real <p>-paragraphs (and then usually the first as well
for consistency). But this is not done by HTMLDocument.

See, for a start,

From: usenet@chka.de (Christian Kaufhold)
Subject: Re: HTML editor with JEditorPane - linebreaks
Newsgroups: comp.lang.java.gui
References: <7f2e4a3e.0203280043.58287b43@posting.google.com>
Message-ID: <1t3ca393f9i4017n64@simia.chka.de>
Date: Thu, 28 Mar 2002 22:17:57 -0000

Christian


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.