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 202850 - Setting Separator to Default Collapses it and Makes Panel/Frame Smaller
Summary: Setting Separator to Default Collapses it and Makes Panel/Frame Smaller
Status: RESOLVED INVALID
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Natural Layout (show other bugs)
Version: 7.1
Hardware: PC Windows Vista
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-29 23:29 UTC by MackSix
Modified: 2011-10-01 10:22 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 MackSix 2011-09-29 23:29:52 UTC
If I add a separator to a panel and then right click on it, click "Set to Default Size" it collapses to Zero and makes the Panel & Frame smaller.

Expected Behavior: The Separator default size should be the same size as it is when you add it to a Panel. If setting it to Default Size, it should not change the size of your Panel & Frame.

Workaround: Use undo to go back.

Product Version: NetBeans IDE Dev (Build 201109290601)
Java: 1.7.0; Java HotSpot(TM) Client VM 21.0-b17
System: Windows Vista version 6.0 running on x86; Cp1252; en_US (nb)
Comment 1 MackSix 2011-09-29 23:38:52 UTC
Actually, all Swing Controls will cause the Panel & Frame to become smaller if they are set to default size, it's just that the separator that collapses to zero instead of it's real default size.
Comment 2 Jan Stola 2011-10-01 10:22:04 UTC
There are two aspects of this issue: collapsed separator and resized panel.

The prefered width of JSeparator is 0. When you add JSeparator into the form then we do not honor its prefered size because it is hard to manipulate zero-width components. On the other hand, when you explicitly ask the GUI Builder to set the size of the separator to the default size then you probably know what you are doing, i.e., there is no reason to do anything else then setting the size of the separator to its default size (which means to set the width to zero). So, this behavior is as designed.

When you change size of some component (like the size of the separator using Set to Default Size action) then there are various possibilities what you may expect to happen to the enclosing container. For example, you may expect the container to keep the same size and the remaining space to be somehow distributed in the container's layout. On the other hand, you may expect the rest of the layout constraints to stay the same and modify the size of the enclosing container to reflect that.

Consider, for example, the following layout:

horizontal layout:
separator of width 100 followed by a gap of width 200

vertical layout
separator of height 5 followed by a gap of height 295

The first approach (suggested by you) would lead to layout
separator of width 0 followed by a gap of width 300
separator of height 2 followed by a gap of height 298
(notice the modified sizes of gaps)

The second approach (used by GUI Builder) leads to layout
separator of width 0 followed by a gap of width 200
separator of height 2 followed by a gap of height 295
(all sizes not related to separator are honored)

Both these approaches have pros and cons, but one has to be choosen and used by GUI Builder when performing Set to Default Size action. The second one was selected for various reasons. So, this behavior is as designed as well.

I am closing this issue as invalid because the described behavior is as designed.