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 212253

Summary: [72cat] Align Center action not working correctly
Product: guibuilder Reporter: Michel Graciano <hmichel>
Component: CodeAssignee: issues@guibuilder <issues>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:
Attachments: Sample project
Sample project with reproducible use case

Description Michel Graciano 2012-05-09 16:31:52 UTC
[ BUILD # : 201205030400 ]
[ JDK VERSION : 1.7.4 ]

I will attach a sample form and the steps to reproduce it soon.
Comment 1 Michel Graciano 2012-05-09 16:32:20 UTC
Reproducible with build Build 20120508-bc77094b1af6.
Comment 2 Michel Graciano 2012-05-09 16:33:57 UTC
Created attachment 119223 [details]
Sample project

Just open the form at 7.1 and 7.2 to see the difference. There is a gap at 7.2 which is not present at 7.1. Even the preview works differently.
Comment 3 Michel Graciano 2012-05-09 16:39:47 UTC
Created attachment 119226 [details]
Sample project with reproducible use case

This reproducible case explains some issues I was facing and wasn't able to reproduce easily. To reproduce the problem:
1. Open the;
2. Select buttons 1, 2, 3, 4 and the table (in this specific order);
3. Right click at the selection, Align > Center to Column.

It is reproducible in both IDEs, if you try this at 7.1, it is shown correctly on 7.1 but wrong at 7.2, and if you do this directly in 7.2 you can see the error right away.
Comment 4 Tomas Pavek 2012-05-11 13:04:24 UTC
In fact the current NetBeans version shows the "NB71" form correctly, i.e. with the resizing gaps next to the table and the panel, that's what is in the form file.

The reason why it seems correct in NB 7.1 is due to a workaround of a specific bug in GroupLayout that affects some layouts with a resizing gap at the container border. This workaround changes the resizing gap to fixed when it builds the design view or when it generates code, not to let GroupLayout screw up the layout. The form given here looks correct because you'd really want fixed gaps there. But there are resizing gaps in the form, which NB 7.2 presents correctly, because we fixed the detection of the GroupLayout bug situation - in 7.1 the workaround was applied under broader conditions than necessary. (The form in this issue does not expose the bug, so the workaround was applied incorrectly.)

So NB 7.2 shows the truth here. I don't think we should change it back, this would prevent many valid layouts to be built/generated correctly. The bug is in NB 7.1.

You can easily fix the form in 7.2 by making the gaps really fixed: doubleclick the gap next to the table and uncheck the "Resizable" checkbox. Same with the gap next to the panel.

As for the ReproducibleForm and the steps, this shows that the Align Center action is buggy, as it produces the unwanted resizing gap at the right (it is wrong because the table is already resizing). NB 7.1 just hid this bug. So we can keep this as a report of a bug in center aligning.
Comment 5 Michel Graciano 2012-05-11 13:55:11 UTC
I agree with you, it really seems to be a bug at 7.1. Since the issue's summary is generic, I think we don't need to change it to track the align issue. Thanks Tomas for the evaluation.
Comment 6 Tomas Pavek 2012-05-15 09:45:01 UTC
Two problems with the aligning action when centering a sequence of fixed components with a large resizable component in parallel:
1) The size of the resizable component is adjusted to the sequence of components (if they occupy smaller space).
2) A resizing gap is created next to the group which already is resizing.