Tuesday, October 20, 2009

Visual Lib and Widget Locations after resize

After a longer (rather frustrating) debugging I have found a way to fix what is mentioned under http://www.netbeans.org/issues/show_bug.cgi?id=173997 (see at the end of this issue a test app)

The key to success here is to ignore whatever is returned by the widget.getPreferredLocation() and only focus using the widget.getPreferredBounds().

As David (father of Visual Lib) nicely reminded me about we have the view/scene/local coordinates are described at:

http://bits.netbeans.org/dev/javadoc/org-netbeans-api-visual/org/netbeans/api/visual/widget/doc-files/documentation.html#CoordinationSystem

but even though the coordinates are getting somehow mixed up and the only safe way is to ask for the getPreferredBounds() and than convert those to the Scene coordinate system.