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 106125 - After resize and deselection border is drawn within existing widget border
Summary: After resize and deselection border is drawn within existing widget border
Status: RESOLVED WORKSFORME
Alias: None
Product: platform
Classification: Unclassified
Component: Graph (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: issues@platform
URL:
Keywords:
Depends on:
Blocks: 105060
  Show dependency tree
 
Reported: 2007-06-08 13:30 UTC by Sergey Petrov
Modified: 2007-06-09 16:10 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 Sergey Petrov 2007-06-08 13:30:39 UTC
reproducible with 070607

steps:
1. add widget (may be with some children with flowlayout)
2. add resize action
3. add resize border
border is added outside of initial widget borders, it's good
4. resize the widget
5. deselect the widget (set border to empty and remove resize action)
6. select again (add resize action and resize border)
border is added within widget boundary, it's a bug
Comment 1 Sergey Petrov 2007-06-08 13:44:22 UTC
I miss it in steps above, but after step5 widget fills bounds of (widget+resize
border), it seems the root issue here
Comment 2 David Kaspar 2007-06-08 14:59:25 UTC
Yes, the issue is in the 5. step. You should use/assign borders with the same
insets. If you have ResizeBorder(8), then by deselecting the object, you have to
assign OpaqueBorder(8). Otherwise the widget is going to be resize.
The second part of the issue is that by default the size/boundary of a widget is
calculated. But when you resize it using ResizeAction, then the widget has
overriden preferred-bounds property (Widget.setPreferredBounds). Therefore when
you add a new resize border, the border is added within the previous widget
boundary.
This issue is not resolvable on the side of the library. If it is ok with, I
would close this issue as WorksForMe.
Comment 3 David Kaspar 2007-06-09 15:09:32 UTC
If you do not want to use borders of the same insets, then you would have to
check with Widget.isPreferredBoundsSet method. The bounds includes even
the widget border. If the method returns true, then the preferred bounds
is set and therefore you have to update the preferred bounds:
1) When you are removing a border from the widget, then you have to
shrink the preferred bounds by the border insets.
2) When you are adding a border to the widget, then you have to expand
the preferred bounds by the border insets.
Comment 4 Sergey Petrov 2007-06-09 16:10:13 UTC
Thanks for the solution, it works
not sure if different behavior with not set and with set pref bounds is an issue
or a big issue, at least such behavior allow to shrink-expand preferred bounds
in my case and do nothing if there is no preferred bounds