This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 195183 - JTextArea causes MinimumSize to increase to window size
Summary: JTextArea causes MinimumSize to increase to window size
Status: RESOLVED INCOMPLETE
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: PC Windows Vista
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-08 17:03 UTC by ekenschaft
Modified: 2011-02-23 18:26 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ekenschaft 2011-02-08 17:03:07 UTC
If you use a JTextArea without an explicitly defined minimum size, then any time you expand the window, the JTextArea.minimumSize increases to fill the window. This may duplicate a comment in #71244, but I'm listing it separately because I consider it a bug, not an enhancement request.

What led me to this observation was finding that I could never adjust a JScrollPane -- the scroll position was always fixed. After several days of digging around (I'm not a Java expert), I discovered that the culprit was a JTextArea embedded in a JPanel/CardLayout, which kept increasing its minimum size to fill all available space. This, of course, prevents the enclosing JScrollPane from resizing.

The JTextArea was non-editable, intended only to display wrapped text. It was immediately embedded in a JPanel/GridBagLayout, with weightx=1 and horizontal fill. (I actually had three different panels in the CardLayout with similar configurations.)

After considerable trial and error, the workaround turned out to be painfully simple: make sure the JTextArea (or some enclosing component) has an explicitly defined (i.e. non-default) minmimum size.

Honestly, I don't know whether I should report this here or find some Sun -- excuse me, Oracle -- Java/Swing forum.

I have not tried to reproduce this under a dev build or JDK 7.
Comment 1 Marian Mirilovic 2011-02-23 18:26:27 UTC
what JDK are you using ? Could you also please attach the screenshot ? Thanks in advance.