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 139020 - Make preview of position of new component more exact in BoxLayout
Summary: Make preview of position of new component more exact in BoxLayout
Status: NEW
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: issues@guibuilder
Depends on:
Reported: 2008-07-04 11:28 UTC by pribyl
Modified: 2008-07-04 12:16 UTC (History)
0 users

See Also:
Exception Reporter:

Indicated position (1.95 KB, image/gif)
2008-07-04 11:29 UTC, pribyl
Real position after placing (1.04 KB, image/gif)
2008-07-04 11:30 UTC, pribyl

Note You need to log in before you can comment on or make changes to this bug.
Description pribyl 2008-07-04 11:28:17 UTC
Product Version: NetBeans IDE Dev (Build 200806260103)
Java: 1.6.0_10-beta; Java HotSpot(TM) Client VM 11.0-b11
System: Windows XP version 5.1 running on x86; Cp1250; sk_SK (nb)

Create new JFrame (or JPanel) and set its Layout to Y-axis BoxLayout.
Then add any component (e.g. JButton) by Drag&Drop.
The container indicates placement location by yellow dashed line, but the final position of the element is different.
(Suggested - top center, Real - top left). See attached pics.

Note: It works this way only in case of the first element, other are indicated corretly.
Comment 1 pribyl 2008-07-04 11:29:19 UTC
Created attachment 63935 [details]
Indicated position
Comment 2 pribyl 2008-07-04 11:30:06 UTC
Created attachment 63936 [details]
Real position after placing
Comment 3 Jan Stola 2008-07-04 11:57:22 UTC
This is as designed in the following sense: we do not attempt to do an exact preview where the component will be 
placed. The only purpose of the indicated position is to let the user know between which components the new component 
will be dropped. Try to play with more components with different sizes - the indicated position is never exact, the 
size of the rectangle, for example, is different than the actual size of the component.

As for your test case, the indicated position is painted as if the component had alignmentX property equal to 0.5 e.g. 
it is painted in the center. We don't consider the alignment property (or other - min, pref, max size properties of the 
component) because we don't want to indicate exact final location of the component, but its order among other 
components only.

Leaving this issue as an enhancement request.
Comment 4 pribyl 2008-07-04 12:16:15 UTC
I see, thanks for explaining. 
And for leaving this issue "alive" as enhancement request (I take it as a sign that it was not a complete nonsense :) )