views:

719

answers:

2

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?

A: 

This sounds like your Netbeans ISDE is using 1.5 instead of 1.6. You can run Netbeans under an older JDK and develop for a newer JDK since the project JDK is decoupled from the IDE JRE.

Try this:

Open NETBEANS_INSTALL_DIR\etc\netbeans.conf.

Modify the line: netbeans_jdkhome="path_to_jdk"

To point at a JDK 1.6 install.

James Schek
I've already done that. Accorinding to the about-box, NetBeans is running under Java: 1.6.0_07; Java HotSpot(TM) 64-Bit Server VM 1.6.0_07-b06-57So I guess this is not the problem.
Erik Itland
James Schek
+2  A: 

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.

James Schek
Hi again James. Seem like this didn't work either. (I did't find the option at the same place, I found it under Options->Miscellaneous->GUI Builder. Btw: Not sure if it explains anything, but I'm using a Mac at the moment.)Giving you an upvote anyway, and if you find anything else that could solve this problem I'd be glad to hear.
Erik Itland