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 200714 - initComponents method exceeding 65535 bytes limit
Summary: initComponents method exceeding 65535 bytes limit
Status: RESOLVED WONTFIX
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 7.0.1
Hardware: PC Windows 7 x64
: P3 normal (vote)
Assignee: issues@guibuilder
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-05 18:37 UTC by dirsyncpro
Modified: 2011-08-07 21:17 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 dirsyncpro 2011-08-05 18:37:41 UTC
I have come across the problem that initComponents method gets too large. I have used the gui builder to create a complex JFrame with a couple of JDialogs with lots of swing components. As a result, the automatically created initComponents has got too big. The compiler complains that its code is exceeding the 65535 bytes limit.

Problem is clear. Of course I can use a work arround e.g. to split the initComponents manually in smaller parts or to split my gui in smaller files. However, it would be much better if the gui builder handles this issue automatically. One solution may be to create more 'initComponent' methods, perhaps one for each JFrame, JDialog (or something like that) to avoid this limit.

Thanks!
Comment 1 Jan Stola 2011-08-07 16:15:35 UTC
I am sorry, I cannot imagine how this can be handled by GUI Builder automatically. I can imagine that some modification of the code generation would make this problem less probable but if we ever change it then it will be for stronger reasons then for this one. In fact, if you encounter problem like this then it is probably the last hint that there is probably something odd with this class. GUI Builder, of course, is not able to find the right refactorings needed to fix the problems with the bad design of the class.
Comment 2 dirsyncpro 2011-08-07 21:17:13 UTC
Jan,

Based on your answer I have a feeling the probelm is not clear enough. You're talking about 'refactoring' and I cannot imagine what do you mean by refactoring the code in this case. There is nothing to refactor. The issue concerns generating the code for all GUI components just in one method. The code generator of Gui Builder generates all the components initializations just in one method which may run to the Java limitaion of 65535 bytes for large gui's. It makes sense to have more smaller 'initComponents' methodes for each JDialog or JFrame. Doesn't it?

You misjudge the design of the class based on the information you don't have. Please don't! The GUI is well designed. It consist of a JFrame and a couple of JDialogs. For some valid reasons I prefer keeping the JFrame and the JDialogs in one gui builder Form. Unfortunately Gui Builders piles up all the initializations in one big method which ends up exceeding the 65535 bytes limit for that method.