Java – NetBeans gui design tool (matisse) seems to use Java 5 instead of Java 6

javajava-6netbeansnetbeans6.5swing

When trying to open a custom JPanel class in the NetBeans GUI design tool, I get the following error:

Warning – Form loaded with errors

Error in loading component property: [JPanel]->someScrollPane->somePlainJTable->autoCreateRowSorter
No such property exists in the component.

The offending code:

somePlainJTable.setAutoCreateRowSorter(true);

In maven pom:

<configuration>
    <source>1.6</source>
    <target>1.6</target>
</configuration>

The javadocs says: it is available in 1.6.

Also the source code editor gives no error.

To me it seems like the GUI editor is using source level 1.5 for some reason.

Any ideas?

Best Solution

Another possible answer:

  • In 'Tools | Options | Advanced Options | Options | Editing | GUI Builder' , set the 'Layout Generation' style to 'Standard Java 6 Code'.
  • Ensure that 'Swing Layout Extensions' library is not part of the project (thus ensuring it will not be packaged in the final application jar file).

This usually affects which version of GroupLayout is used (i.e. the 1.5 JDesktop version or the JDK 1.6 version). However, I have seen this affect other, non-layout options a few times.

Related Question