Netbeans has a very powerful feature for its Swing designer, but too bad the default swing designer generates soucecode using javax.swing.GroupLayout and it’s only available at Java 6. I found this problem early this morning, somehow i design the Swing UI using Netbeans but i have to deploy my application in a Java 5 environment. Btw, im using Netbeans 6.9.
So, the workarouds are whether i change all the UI layout designs from GroupLayout to NullLayout, or find a way so GroupLayout is compatible with Java 5.
Because the second workaround is much promising, so i googled a while and found out that it’s actually not to difficult to make GroupLayout is compatible with Java 5. This is how i do it.
Suddenly all the javax.swing.GroupLayout changed into org.jdesktop.layout.GroupLayout. And dont forget to include swing-layout*.jar, because org.jdesktop.layout.GroupLayout located in it.
See, it’s not that hard right?