Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #944 > unrolled thread

disabling word wrap in a

Started by"Eric Smith" <eric.smith@THRWHITE.remove-dii-this>
First post2011-04-27 15:30 +0000
Last post2011-04-27 15:30 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.lang.java.gui


Contents

  disabling word wrap in a "Eric Smith" <eric.smith@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000
    Re: disabling word wrap i "IchBin" <ichbin@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000
      Re: disabling word wrap i "Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this> - 2011-04-27 15:30 +0000

#944 — disabling word wrap in a

From"Eric Smith" <eric.smith@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
Subjectdisabling word wrap in a
Message-ID<qhps8bghl0.fsf@ruckus.brouhaha.com>
  To: comp.lang.java.gui
I've got a JTextPane in a JScrollPane, which I'm using to let a user
display/edit some assembly source code.  I definitely do not want word
wrap.  If I override getScrollableTracksViewportWidth() to return
false, I don't get the word wrap.

But what I do get is a grey background in the JScrollPane to the right
of the rightmost character of the actual document.  If the document
is empty, there's just a sliver of white background where the insertion
point is, and as I type in text, the white background expands to
accomodate the text.  It looks really ugly, and I haven't found a
way to fix it.

I tried setting the background color of both the JTextPane and the
JScrollPane to white, but that didn't result in any visible change.

I also tried an alternative approach to avoiding word wrap, using
a custom subclass of StyledEditorKit and overriding the view used
for paragraphs.  That did disable word wrap, but had the same problem
with leaving part of the background grey.

Has anyone run into this before and solved it?

Thanks!
Eric

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [next] | [standalone]


#949 — Re: disabling word wrap i

From"IchBin" <ichbin@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
SubjectRe: disabling word wrap i
Message-ID<aqycnazqya6UdEnYUSdV9g@ptd.net>
In reply to#944
  To: comp.lang.java.gui
Eric Smith wrote:
> I've got a JTextPane in a JScrollPane, which I'm using to let a user
> display/edit some assembly source code.  I definitely do not want word
> wrap.  If I override getScrollableTracksViewportWidth() to return
> false, I don't get the word wrap.
> 
> But what I do get is a grey background in the JScrollPane to the right
> of the rightmost character of the actual document.  If the document
> is empty, there's just a sliver of white background where the insertion
> point is, and as I type in text, the white background expands to
> accomodate the text.  It looks really ugly, and I haven't found a
> way to fix it.
> 
> I tried setting the background color of both the JTextPane and the
> JScrollPane to white, but that didn't result in any visible change.
> 
> I also tried an alternative approach to avoiding word wrap, using
> a custom subclass of StyledEditorKit and overriding the view used
> for paragraphs.  That did disable word wrap, but had the same problem
> with leaving part of the background grey.
> 
> Has anyone run into this before and solved it?
> 
> Thanks!
> Eric

Try...

scrollPane.getViewport().setBackground(Color.white);

-- 
Thanks in Advance...           http://weconsultants.prophp.org
IchBin, Pocono Lake, Pa, USA   http://ichbinquotations.awardspace.com
______________________________________________________________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [next] | [standalone]


#957 — Re: disabling word wrap i

From"Rogan Dawes" <rogan.dawes@THRWHITE.remove-dii-this>
Date2011-04-27 15:30 +0000
SubjectRe: disabling word wrap i
Message-ID<er4b1n$bdk$2@wblv-ip-nnrp-1.saix.net>
In reply to#949
  To: comp.lang.java.gui
IchBin wrote:
> Eric Smith wrote:
>> I've got a JTextPane in a JScrollPane, which I'm using to let a user
>> display/edit some assembly source code.  I definitely do not want word
>> wrap.  If I override getScrollableTracksViewportWidth() to return
>> false, I don't get the word wrap.
>>
>> But what I do get is a grey background in the JScrollPane to the right
>> of the rightmost character of the actual document.  If the document
>> is empty, there's just a sliver of white background where the insertion
>> point is, and as I type in text, the white background expands to
>> accomodate the text.  It looks really ugly, and I haven't found a
>> way to fix it.
>>
>> I tried setting the background color of both the JTextPane and the
>> JScrollPane to white, but that didn't result in any visible change.
>>
>> I also tried an alternative approach to avoiding word wrap, using
>> a custom subclass of StyledEditorKit and overriding the view used
>> for paragraphs.  That did disable word wrap, but had the same problem
>> with leaving part of the background grey.
>>
>> Has anyone run into this before and solved it?
>>
>> Thanks!
>> Eric
> 
> Try...
> 
> scrollPane.getViewport().setBackground(Color.white);
> 

Or else, use JTextArea rather than JTextPane, and call setLineWrap(false);

Rogan

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.java.gui


csiph-web