<Swing Dev> Bug 6491856: JTextArea incorrect preferred size
Walter Laan
W.Laan at costengineering.eu
Tue Mar 16 15:59:58 UTC 2010
Hi,
The fix for bug 6491856 "For JTextArea the standard text terminal size
80x24 seems to be the reasonable default." doesn't seem to work
correctly. When I tested it in JDK7-ea-b76 the preferred size returned
from the example code is [width=0,height=1376] while I would expect
[width=880,height=384] (the result of new JTextArea(24,
80).getPreferredScrollableViewportSize() on my system).
Perhaps the default [width=400,height=400] for the preferred scrollable
viewport size when preferred size is null should be used though. The 880
width seems a bit too wide to me - for reference 6u18 gives currently
[width=100,height=16] for JTextArea with the sample text.
Although I ran into this issue while using a JTextArea without scroll
pane (Jide's MultiLineLabel which is a JTextArea with a label look), the
zero width/very big height is also used for the preferred scrollable
viewport size when you put the text area in a JScrollPane.
Thanks,
Walter Laan.
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6491856
More information about the swing-dev
mailing list