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.
Say you have a widget which is a pure container - its bounds should only be as large as its contents (which in my case can be dragged around to make the container larger or smaller). This should be the default behavior - and it is clear that is the intention since an empty rectangle is returned from calculateClientArea() by default. However, in the private method Widget.calculatePreferredBounds(), the return value of calculateClientArea() is used - it is added to with Rectangle.add(). Result: If all the children of a container have non-zero offsets, you get unnecessary whitespace because the x,y position of the 0,0 rectangle returned from calculateClientBounds() is used. Clearly this is not what is intended. A simple fix is for calculatePreferredBounds to test Rectangle.isEmpty(), and if true, ignore the client bounds. It is also obvious that this is what this method was intended to do - however new Rectangle(0,0,0,0).add(new Rectangle (20, 20, 20, 20)) gets a Rectangle (0, 0, 40, 40).
Ugly workaround: Override calculateClientBounds() to find the coordinates of the first child and return a zero width, zero height rectangle using its x/y coordinates.