Article View: borland.public.jbuilder.java.swing
Article #8752Re: Inversed text in JTextPane
From: Jeroen Zwartepoorte
Date: Tue, 18 Jul 2000 00:00
Date: Tue, 18 Jul 2000 00:00
38 lines
2040 bytes
2040 bytes
"Paul Furbacher [TeamB]" <pnf@home.com> wrote in message news:3973C20B.1AD68AA2@home.com... > Jeroen Zwartepoorte wrote: > > > 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??? > > > > [...](this stuff is a bit too advanced for most people). > > For this "advanced" stuff, you might benefit from reading Kim > Topley's "Core Java: advanced programming." (Topley has written > several "Core Java" titles.) He devotes a good number of chapters > in the first half of the book to increasingly advanced text > manipulation in Java and definitely covers you question. For those interested in the book, it's "Core Swing: Advanced Programming" (not Core Java). Jeroen
Technical Details
Message-ID:
<8l2cnd$4uq8@bornews.borland.com>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<8kv4ee$50e4@bornews.borland.com> <3973C20B.1AD68AA2@home.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 111d45,827bfd654b83f85d X-Google-Attributes: gid111d45,public From: "Jeroen Zwartepoorte" <Jeroen@xs4all.nl> Subject: Re: Inversed text in JTextPane Date: 2000/07/18 Message-ID: <8l2cnd$4uq8@bornews.borland.com> X-Deja-AN: 647911438 References: <8kv4ee$50e4@bornews.borland.com> <3973C20B.1AD68AA2@home.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 Organization: Another Netscape Collabra Server User X-MSMail-Priority: Normal Newsgroups: borland.public.jbuilder.java.swing