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 58238

Summary: Swing builder generates code that JDK1.4 will not compile
Product: guibuilder Reporter: markswanson <markswanson>
Component: CodeAssignee: issues@guibuilder <issues>
Status: RESOLVED INVALID    
Severity: blocker CC: arseniy, jchalupa
Priority: P1    
Version: 4.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description markswanson 2005-04-22 17:26:28 UTC
The swing builder generates code that will not compile with Java 1.4. 
 
My environment is Java 1.5.0_02. The code the swing builder generates is: 
setLayout(new java.awt.GridBagLayout()); 
 
This is correct for 1.5 environments but it will not compile in 1.4 
environments. The generated code MUST instead generate code like this: 
 
getContentPane().setLayout(new java.awt.GridBagLayout()); 
 
This ensures the generated code works in Java 1.4 and Java 1.5.
Comment 1 Jan Chalupa 2005-04-23 18:37:40 UTC
Re-assigning to form.
Comment 2 Jan Stola 2005-04-25 11:12:55 UTC
I am sorry I am not able to reproduce this issue. Could you, please, provide
more details - steps to reproduce would be ideal.
What class does your form extends (e.g. JPanel, JFrame, ...)?
Why the class cannot be compiled on JDK 1.4?
Comment 3 Jan Stola 2005-04-25 14:44:18 UTC
Closing as invalid based on an e-mail from the reporter:

> I retried JFrame, JDialog and NetBeans works perfectly.
> I am a newbie with NetBeans and manually edited the .form. I must have done
> this incorrectly as future edits from NetBeans always forgot getContentPane()
> when calling setLayout(). So I blame me. Sorry for the noise. 
Comment 4 Milan Kubec 2005-04-26 08:22:34 UTC
Even invalid reports should have set correct Target Milestone.