🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.swing
Article #12384

Using select with JEditorPane

#12384
From: Yoni Mizrahi
Date: Mon, 18 Jan 1999 00:00
19 lines
1528 bytes
I'm building a Text File Viewer that can display text files within a
JEditorPane with the html/text attribute set. I'm doing  it like that
becouse I want to use HTML tags to mark some text in color.
The problem starts when I display the file - The JEditorPane does not
recognize the \n for end of line. I need to go over the file and replace
the \n with <br> tags.
When I use select() to select some text, after I do all the calculations
to find the right place (the tags take space even though they are not
seen), I always miss the position by the line number.
for example : if I want to select the word "hello" on the 3rd line, the
selection will start by the second l.
I checked my algorithm and didn't find anything that can couse such a
thing. If you think you know the reason please tell me (guesses are also
welcomed).
Also if anyone knows of a good tutorial\explanation about JEditorPane
(not the sun tutorial) please send me the URL.

Thanks,
Yoni.
Technical Details
Message-ID: <36A3062B.A8EC1988@cioware.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,3af783505d879c37,start
X-Google-Attributes: gid111d45,public
From: Yoni Mizrahi <yoni@cioware.com>
Subject: Using select with JEditorPane 
Date: 1999/01/18
Message-ID: <36A3062B.A8EC1988@cioware.com>
X-Deja-AN: 433939945
X-NNTP-Posting-Host: 209.88.155.211
Content-Transfer-Encoding: 7bit
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
X-Trace: 18 Jan 1999 11:58:04 +0200, 209.88.155.211
MIME-Version: 1.0
Newsgroups: borland.public.jbuilder.java.swing