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 137738 - [65cat] LAYOUT: NullPointerException at org.netbeans.modules.form.layoutdesign.LayoutFeeder.addSimplyAligned
Summary: [65cat] LAYOUT: NullPointerException at org.netbeans.modules.form.layoutdesig...
Status: VERIFIED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Natural Layout (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: issues@guibuilder
URL: http://statistics.netbeans.org/except...
Keywords:
Depends on:
Blocks:
 
Reported: 2008-06-19 16:10 UTC by misterm
Modified: 2008-09-11 12:09 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 8636


Attachments
stacktrace (2.34 KB, text/plain)
2008-06-19 16:10 UTC, misterm
Details
stacktrace (2.34 KB, text/plain)
2008-06-19 16:16 UTC, misterm
Details
PRoblematic form... (8.25 KB, text/xml)
2008-08-20 22:24 UTC, Michel Graciano
Details
Problematic Java source (7.44 KB, text/plain)
2008-08-20 22:24 UTC, Michel Graciano
Details

Note You need to log in before you can comment on or make changes to this bug.
Description misterm 2008-06-19 16:10:46 UTC
Build: NetBeans IDE 6.1 (Build 200804211638)
VM: Java HotSpot(TM) Client VM, 10.0-b19, Java(TM) SE Runtime Environment, 1.6.0_04-b12
OS: Windows XP, 5.1, x86

User Comments:
Comment 1 misterm 2008-06-19 16:10:53 UTC
Created attachment 63118 [details]
stacktrace
Comment 2 misterm 2008-06-19 16:16:35 UTC
Created attachment 63119 [details]
stacktrace
Comment 3 Jan Stola 2008-06-19 18:17:40 UTC
I am sorry, I am not able to reproduce this issue and the attached exception is not sufficient to track the problem 
down. Are you still able to reproduce it? If so, could you, please, attach the problematic form (both .java and .form) 
files saved in the last good state and describe exact steps that lead to this exception. Thank you in advance.
Comment 4 Jana Maleckova 2008-06-20 08:19:22 UTC
StackTrace:
===========
java.lang.NullPointerException
        at org.netbeans.modules.form.layoutdesign.LayoutFeeder.addSimplyAligned(LayoutFeeder.java:732)
        at org.netbeans.modules.form.layoutdesign.LayoutFeeder.add(LayoutFeeder.java:186)
        at org.netbeans.modules.form.layoutdesign.LayoutDesigner.addComponents(LayoutDesigner.java:806)
        at org.netbeans.modules.form.layoutdesign.LayoutDesigner.endMoving(LayoutDesigner.java:750)
        at org.netbeans.modules.form.HandleLayer$ResizeComponentDrag.end(HandleLayer.java:2504)
        at org.netbeans.modules.form.HandleLayer$ComponentDrag.end(HandleLayer.java:2145)
Comment 5 Jan Stola 2008-07-01 10:50:48 UTC
No additional information provided => closing as non-reproducible. Feel free to reopen if you are still able to 
reproduce it, but provide more information then. Thank you in advance.
Comment 6 Michel Graciano 2008-08-20 22:21:09 UTC
It is happen in 6.5 and I can't change my form.
Comment 7 Michel Graciano 2008-08-20 22:22:49 UTC
Product Version: NetBeans IDE Dev (Build 200808141419)
Java: 1.6.0_07; Java HotSpot(TM) Client VM 10.0-b23
System: Linux version 2.6.24-19-generic running on i386; ISO-8859-1; pt_BR (nb)
Userdir: /home/hmichel/.netbeans/dev
Comment 8 Michel Graciano 2008-08-20 22:24:16 UTC
Created attachment 67986 [details]
PRoblematic form...
Comment 9 Michel Graciano 2008-08-20 22:24:51 UTC
Created attachment 67987 [details]
Problematic Java source
Comment 10 Michel Graciano 2008-08-20 22:29:06 UTC
1-Open the attached form
2-Drag the 'Dados' panel right border to the center until the alignment guideline is shown. Then release it.
Comment 11 Michel Graciano 2008-08-20 22:30:15 UTC
P1 because 'Product feature does not work, no workaround exists'.
Comment 12 Jan Stola 2008-08-21 09:44:49 UTC
> 2-Drag the 'Dados' panel right border to the center until the alignment guideline is shown. Then release it.

What do you want to accomplish? This use-case doesn't make sense to me. The cancelar and fechar buttons are centered 
below jPanel1. It is not clear what should be done when you attempt to align the right edge of the jPanel1 with the 
right edge of fechar button. Both these constraints (right and center alignment) cannot be satisfied at once - at least 
one must be dropped.

> P1 because 'Product feature does not work, no workaround exists'.

Lowering priority back to P3. One strange resizing attempt in one particular form definitely is not a product feature. 
Also there is a workaround (that depends on what you want to accomplish). For example, you can drag cancelar and fechar 
buttons to the lower left corner temporarily, then resize jPanel1 and then return the buttons back to any desired 
position.

But thanks for a reproducible test-case for this exception. I have extracted (from your form) a simple one:

1. Put two JButtons into a row (align them on baseline for example).
2. Put one JToggleButton into a new row below these two buttons.
3. Select all three buttons and invoke Center horizontally.
4. Drag the right edge of JToggleButton slightly to the right.
   => exception is thrown when the edge is dropped.
Comment 13 Michel Graciano 2008-08-21 14:55:32 UTC
>> 2-Drag the 'Dados' panel right border to the center until the alignment guideline is shown. Then release it.
>What do you want to accomplish? This use-case doesn't make sense to me. The cancelar and fechar buttons are centered 
>below jPanel1. It is not clear what should be done when you attempt to align the right edge of the jPanel1 with the 
>right edge of fechar button. Both these constraints (right and center alignment) cannot be satisfied at once - at least 
>one must be dropped.

The attempt is to move jPanel1 roght border to close with jScrollPane1 right border. In this case, the cancelar and
fechar buttons should be centered following the new jPanel1 constraints. And it is a real case when doing maintenance in
views, because natual layout is crazy and when I remove/add new components several times the all layout is broken and I
need to reorder components.

And to prove that it is a real case, I found a workaround, move the JDialog (main component) border to close with the
jScrollPane1 border, and this time Matisse knows what should be done. Why it can't do it in the first time? Increasing
the priority since the feature is really broken.
It should be fixed asap, I hope it can be fixed for 6.5.
Comment 14 Jan Stola 2008-08-21 15:22:37 UTC
I understand that this issue bothers you - that's why you reported it, but please stop increasing its priority without 
an appropriate justification. This issue doesn't break any general feature, it is about one special case that doesn't 
work. You even found a workaround and another one was provided by me => setting back to P3.
Comment 15 Michel Graciano 2008-08-21 18:20:24 UTC
Your workaround is not viable when you have complex UI. We are talking about real projects, not simple or demo UI. I
need to be productive when doing maintenance in legacy UI and this is not helping. I am always try to use the original
JDK layouts instead natural layout, since the editor always show several problems.
Back to the issue, the workaround I presented is better since is really fast to solve my current problem, what is not
true in another scenarios, where your workaround should be used. The question is, why the inner container don't have the
same behaviour as when resizing the JDialog? In my scenario the result was really good.
Comment 16 Exceptions Reporter 2008-09-03 03:04:44 UTC
This issue has already 20 duplicates 
see http://statistics.netbeans.org/exceptions/detail.do?id=8636
Comment 17 Jana Maleckova 2008-09-03 14:16:31 UTC
would be nice to fix it in 6.5.
Comment 18 Tomas Pavek 2008-09-10 10:38:15 UTC
Hopefully fixed.

http://hg.netbeans.org/main/rev/7829fb4b9540

Note to hmichel: Your suggested workaround by resizing whole form was actually a better way to eliminate the gap on the
right. Resizing the inner centered panel now works, but after that you'd have to resize the whole form anyway.
Comment 19 Quality Engineering 2008-09-10 17:22:13 UTC
Integrated into 'main-golden', will be available in build *200809101401* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/7829fb4b9540
User: Tomas Pavek <tpavek@netbeans.org>
Log: #77875: resizing vertically may move component out of sequential group
#137738: don't try to reposition centered or baselined components
Comment 20 Jana Maleckova 2008-09-11 12:09:51 UTC
verified on 
Product Version: NetBeans IDE Dev (Build 20080910214311)
Java: 1.6.0_10-rc; Java HotSpot(TM) Client VM 11.0-b13
System: Windows XP version 5.1 running on x86; Cp1252; en_GB (nb)