🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: subscript / superscript in JTextPane?

#11372
From: Gavster McRavster
Date: Thu, 03 Jun 1999 00:00
28 lines
1628 bytes
if there is an answer i believe it will lie with the FontMetrics class,
which, without looking at the book i think allows you to control the pitch
(y position (?)) of a character on the line - take a look,

apologies if i am barking up the wrong tree..


Roman Huerlimann <Roman.Huerlimann@tamedia.ch> wrote in message
news:37568478.D38D3DE3@tamedia.ch...
> Hi
>
> How is it possible to subscript / superscript some text? My closeset
> approch til now is:
>
>   SimpleAttributeSet attrs = new SimpleAttributeSet();
>   StyleConstants.setSuperscript(attrs, true);
>   textPane.getStyledDocument().setCharacterAttributes(1, 1, attrs,
> true);
>
> In my understanding this should make the second Character smaller and
> paint it higher, but it only makes the Character smaller, it isn't
> painted higher. I've got the same result with subscript.
>
> Has anybody an idea?
>
> Thanks.
>
> Roman
Technical Details
Message-ID: <928428596.15895.0.nnrp-06.c1c3e175@news.demon.co.uk>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <37568478.D38D3DE3@tamedia.ch>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 111d45,a21ae235b8bf8619
X-Google-Attributes: gid111d45,public
From: "Gavster McRavster" <gavinc@demon.net>
Subject: Re: subscript / superscript in JTextPane?
Date: 1999/06/03
Message-ID: <928428596.15895.0.nnrp-06.c1c3e175@news.demon.co.uk>
X-Deja-AN: 485319334
X-NNTP-Posting-Host: gavinc.eng.demon.net:193.195.225.117
References: <37568478.D38D3DE3@tamedia.ch>
X-Priority: 3
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300
X-Complaints-To: abuse@demon.net
X-Trace: news.demon.co.uk 928428596 nnrp-06:15895 NO-IDENT gavinc.eng.demon.net:193.195.225.117
X-MSMail-Priority: Normal
Newsgroups: borland.public.jbuilder.java.swing