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 143248 - [65cat] ClassCastException: javax.swing.JMenuItem cannot be cast to javax.swing.JMenu
Summary: [65cat] ClassCastException: javax.swing.JMenuItem cannot be cast to javax.swi...
Status: RESOLVED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (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-08-07 23:26 UTC by wobster
Modified: 2008-08-26 06:00 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter: 9934


Attachments
stacktrace (2.04 KB, text/plain)
2008-08-07 23:27 UTC, wobster
Details
stacktrace (2.04 KB, text/plain)
2008-08-11 19:46 UTC, wobster
Details

Note You need to log in before you can comment on or make changes to this bug.
Description wobster 2008-08-07 23:27:00 UTC
Build: NetBeans IDE Dev (Build 200808061401)
VM: Java HotSpot(TM) Client VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06
OS: Windows XP, 5.1, x86

User Comments: 


Stacktrace: 
java.lang.ClassCastException: javax.swing.JMenuItem cannot be cast to javax.swing.JMenu
Comment 1 wobster 2008-08-07 23:27:15 UTC
Created attachment 66874 [details]
stacktrace
Comment 2 Jan Stola 2008-08-08 07:49:03 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, describe exact steps that lead to this exception? 
Thank you in advance.
Comment 3 wobster 2008-08-08 15:01:27 UTC
I was using the Matisse editor in a Java desktop project. I attempted to graphically move a "menu item" from one menu to
another and got the exception. It worked fine if I used the component inspector to move the menu items.
Comment 4 Jiri Vagner 2008-08-11 09:08:25 UTC
Thank you for your description, but we are still not able to reproduce it.

My steps:
 - Create fresh new JDA Project
 - In main view in designer drag "Exit" menuitem from "File" menu and drop it into "Help" menu
 - Or add new menuitem from palette into "Help" menu and then move it from "Help" menu to "File" menu

It works (NB IDE Dev Build 200808110201, JDK 1.6.0_05). Maybe there is someting wrong with your form. Can you please
attach sources of your form (form and java file) or whole zipped project?

Comment 5 wobster 2008-08-11 19:46:44 UTC
Build: NetBeans IDE Dev (Build 200808111401)
VM: Java HotSpot(TM) Client VM, 10.0-b23, Java(TM) SE Runtime Environment, 1.6.0_07-b06
OS: Windows XP, 5.1, x86

User Comments: 


Stacktrace: 
java.lang.ClassCastException: javax.swing.JMenuItem cannot be cast to javax.swing.JMenu
        at org.netbeans.modules.form.VisualReplicator.addToMenu(VisualReplicator.java:850)
        at org.netbeans.modules.form.VisualReplicator.addComponent(VisualReplicator.java:378)
        at org.netbeans.modules.form.VisualReplicator.updateAddedComponents(VisualReplicator.java:350)
        at org.netbeans.modules.form.FormDesigner$FormListener.run(FormDesigner.java:2266)
        at org.netbeans.modules.form.FormLAF$3.run(FormLAF.java:307)
        at org.openide.util.Mutex.doEventAccess(Mutex.java:1355)
Comment 6 wobster 2008-08-11 19:46:49 UTC
Created attachment 67068 [details]
stacktrace
Comment 7 wobster 2008-08-11 19:48:33 UTC
I was able to duplicate the problem today with the latest build. I noticed that if I carefully dropped the menu item
into the menu space below the menu that it worked fine. But, if I dropped the menu item onto the menu then I got the
class cast exception.
Comment 8 Jana Maleckova 2008-08-12 09:31:54 UTC
reproducible on NetBeans IDE Dev (Build 20080804044921)

detailed description: drag menuItem and move it on margin line between File and Help menu and try to drop it. Then
ClassCastException is thrown
Comment 9 Jiri Vagner 2008-08-25 20:15:47 UTC
Fixed

Modified file: http://hg.netbeans.org/main/rev/3ffeddec8d9e
Comment 10 Quality Engineering 2008-08-26 06:00:03 UTC
Integrated into 'main-golden', available in build *200808260201* on http://bits.netbeans.org/dev/nightly/
Changeset: http://hg.netbeans.org/main/rev/3ffeddec8d9e
User: Jiri Vagner <jvagner@netbeans.org>
Log: #143248 - Fixed ClassCastException while moving menu items