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 203345 - [71cat] ClassCastException: javax.swing.GroupLayout cannot be cast to java.awt.GridBagLayout
Summary: [71cat] ClassCastException: javax.swing.GroupLayout cannot be cast to java.aw...
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.0
Hardware: All All
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-08 06:54 UTC by sunbiz
Modified: 2011-10-16 00:59 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter: 181770


Attachments
stacktrace (2.88 KB, text/plain)
2011-10-08 06:55 UTC, sunbiz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sunbiz 2011-10-08 06:54:58 UTC
Build: NetBeans IDE Dev (Build 201110030601)
VM: Java HotSpot(TM) 64-Bit Server VM, 20.2-b06, Java(TM) SE Runtime Environment, 1.6.0_27-b07
OS: Windows 7

User Comments:
sunbiz: Press Undo on the Customize Layout for GridBagLayout designer




Stacktrace: 
java.lang.ClassCastException: javax.swing.GroupLayout cannot be cast to java.awt.GridBagLayout
   at org.netbeans.modules.form.layoutsupport.griddesigner.GridBagInfoProvider.getLayout(GridBagInfoProvider.java:139)
   at org.netbeans.modules.form.layoutsupport.griddesigner.GridBagInfoProvider.getY(GridBagInfoProvider.java:279)
   at org.netbeans.modules.form.layoutsupport.griddesigner.GlassPane.findColumnHeader(GlassPane.java:1015)
   at org.netbeans.modules.form.layoutsupport.griddesigner.GlassPane.updateActiveHeaders(GlassPane.java:442)
   at org.netbeans.modules.form.layoutsupport.griddesigner.GlassPane$Listener.mouseMoved(GlassPane.java:1368)
   at java.awt.Component.processMouseMotionEvent(Component.java:6333)
Comment 1 sunbiz 2011-10-08 06:55:02 UTC
Created attachment 111694 [details]
stacktrace
Comment 2 Jan Stola 2011-10-08 08:50:27 UTC
I am sorry, I am not able to reproduce this issue and the attached stack-trace is not sufficient to track the problem down. It is not clear to me how to get into the state where undo would result in the mentioned problem.

Are you still able to reproduce this issue? If so, could you, please, provide more details? It would be great to see exact steps to reproduce.

I also saw (in the uploaded message.log) other exceptions thrown shortly before the mentioned one. So, the original exception is probably

java.lang.AssertionError
  at org.netbeans.modules.form.layoutsupport.griddesigner.GridDesigner$4.
       actionPerformed(GridDesigner.java:383)
  at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
  ...

but even for this exception I need to know steps to reproduce.
Comment 3 sunbiz 2011-10-08 08:59:20 UTC
Steps to reproduce:
1.) Create the samples GUI Form example project
2.) Open Antenna.java
3.) Right-click to setLayout and make it GridBag Layout
4.) Customize layout
5.) Press Disable uniform gaps. do not upgrade, press cancel
6.) Now press the Undo icon and you will see the exception.
Comment 4 sunbiz 2011-10-08 09:02:12 UTC
For the other exception that you mention:
java.lang.AssertionError
  at org.netbeans.modules.form.layoutsupport.griddesigner.GridDesigner$4.
       actionPerformed(GridDesigner.java:383)
  at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
  ...

look at issue: http://netbeans.org/bugzilla/show_bug.cgi?id=201786
Comment 5 Jan Stola 2011-10-09 22:20:38 UTC
Thank you for the additional information.

> 5.) Press Disable uniform gaps. do not upgrade, press cancel
> 6.) Now press the Undo icon and you will see the exception.

These steps show the root of the problem. When you press Cancel then the change in gaps is undone automatically. Unfortunately, undo/redo support used in the customizer misinterprets this automatic undo and considers it to be a regular change. In other words, Undo action shouldn't be enabled after step 5. (because no change has been done in the customizer yet).

I have fixed the mentioned problem.

Modified files: http://hg.netbeans.org/jet-main/rev/216e0dc0a655