Article View: borland.public.jbuilder.java.swing
Article #8829Inversed text in JTextPane
From: Jeroen Zwartepoorte
Date: Mon, 17 Jul 2000 00:00
Date: Mon, 17 Jul 2000 00:00
26 lines
1450 bytes
1450 bytes
Hi all,
I need to have some piece of text show up "inversed" in my JTextPane
(Background color = foreground and foreground = background).
To accomplish this i've written the following code:
SimpleAttributeSet fAttr = new SimpleAttributeSet();
StyleConstants.setBackground(fAttr, Color.black);
StyleConstants.setForeground(fAttr, Color.blue); // use
blue here, easier to see than white during debugging.
The above code does NOT have the desired effect: the Foreground attribute
overrides the background attribute: the entire region of the text is blue.
Now, if i comment the setBackground method, the text is correctly colored,
and the background is still white (as it was originally).
What am i doing wrong here???
(maybe somebody from the JBuilder team (editor component developer) can help
me out here? (this stuff is a bit too advanced for most people)).
Thanks,
Jeroen
Technical Details
Message-ID:
<8kv4ee$50e4@bornews.borland.com>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,827bfd654b83f85d,start X-Google-Attributes: gid111d45,public From: "Jeroen Zwartepoorte" <Jeroen@xs4all.nl> Subject: Inversed text in JTextPane Date: 2000/07/17 Message-ID: <8kv4ee$50e4@bornews.borland.com> X-Deja-AN: 647340920 X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing