<Swing Dev> Bug 6491856: JTextArea incorrect preferred size
W.Laan at costengineering.eu
Tue Mar 16 08:59:58 PDT 2010
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.
More information about the swing-dev