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 31641 - use Container.getPreferredSize instead of getMinimumSize in NbPresenter
Summary: use Container.getPreferredSize instead of getMinimumSize in NbPresenter
Status: VERIFIED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Dialogs&Wizards (show other bugs)
Version: 3.x
Hardware: All All
: P2 blocker (vote)
Assignee: Jiri Rechtacek
URL:
Keywords:
Depends on:
Blocks: 70554
  Show dependency tree
 
Reported: 2003-03-04 09:47 UTC by David Konecny
Modified: 2008-12-22 17:48 UTC (History)
2 users (show)

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 David Konecny 2003-03-04 09:47:46 UTC
It is more apropriate to use getPreferredSize() in
NbPresenter (and other places) rather then
getMinimumSize(). It is conclusion of working on
issue 29054.
Comment 1 David Konecny 2003-03-06 13:00:53 UTC
The background for this issue can be found in issue 29054 which links
to two bugTraq issues. Is is possible that behaviour of getMinimumText
(which is not clearly defined I think) will change in next version of
JDK and so it would be better to use preffered size to prevent any
potential problems.
Comment 2 David Konecny 2003-03-07 08:36:14 UTC
JDK team comment (test case mentioned in the text can be found in
issue 29054 - it is simplified version of what is done in NbPresenter
and demonstrates the problem on JTextArea):

The problem with the current code is that it does something like:

  JTextArea text = new JTextArea();
  Dimension min = text.getMinimumSize();

The problem with this approach is that you are asking for a minimum
size BEFORE the JTextArea has a valid size. As such the JTextArea
assumes it can have infinite space in both directions and will return
a minimum size that is either very very long or very very wide (at
least with the test case you attached). If the JTextArea has a width
it will answer the minimum size assuming you want the current width. A
better solution is to embed the JTextArea in a JScrollPane. If this
isn't possible you should set the size of the JTextArea to match the
width you want and then ask for the preferred size. After that you'll
get a valid size.
Comment 3 _ ttran 2003-03-17 12:45:23 UTC
changed this to a bug and version to 4.0 to make sure we won't miss
this one in the next release
Comment 4 Jiri Rechtacek 2003-11-16 21:55:38 UTC
fixed in
core/windows/src/org/netbeans/core/windows/services/NbPresenter.java,
rev.1.3
Comment 5 pzajac 2004-02-25 14:59:47 UTC
verified