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


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

disabling word wrap in a

From "Eric Smith" <eric.smith@THRWHITE.remove-dii-this>
Subject disabling word wrap in a
Message-ID <qhps8bghl0.fsf@ruckus.brouhaha.com> (permalink)
Newsgroups comp.lang.java.gui
Date 2011-04-27 15:30 +0000
Organization TDS.net

Show all headers | View raw


  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

Back to comp.lang.java.gui | Previous | NextNext in thread | Find similar | Unroll thread


Thread

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

csiph-web