Geertjan's Blog

  • November 1, 2009

Tip for Wicket Users in NetBeans IDE

Geertjan Wielenga
Product Manager
If you're using Wicket, you're using its forms, text fields, labels, and so on. So, you call up code completion and you see "java.awt" and "java.text" being offered first, meaning you need to scroll down in each drop-down for the applicable Wicket class:

You can save yourself that trouble, by excluding the "java.awt" and "java.text" packages (which you're not using with Wicket anyway) in the "Editor" section of the Options window (under the Tools menu):

With those packages excluded, the first class that appears in code completion is the one you want for your Wicket applications:

Then just press OK and you have all the imports from Wicket and you're ready to continue coding right away.

Join the discussion

Comments ( 2 )
  • Yves Chaves Sunday, November 1, 2009

    Great way to get rid off the annoying Swing libs. Like Geertjan said: Who needs them, since Wicket rocks your world anyway ;-)?

  • Jesse Glick Monday, November 2, 2009

    The problem with this workaround - besides the fact that the user has to know to do it - is that it applied globally, which would be irritating if you were making a Wicket app which launched a JNLP Swing app, and had them both open at once, etc.

    http://qa.netbeans.org/nonav/issues/show_bug.cgi?id=170231 suggests a new API - or rather, an extension of the applicability of an existing API - which (among other things) would let the project itself omit sections of rt.jar from not only code completion but compilation generally (i.e. treat usages as errors). In this case, web applications might omit java.awt.\*\* and javax.swing.\*\* classes from the boot classpath by default. (JSR 294 would provide a cleaner mechanism for this case, but that is a long way off.)

    As to java.text.Normalizer.Form being offered by default in Fix Imports instead of org.apache.wicket.markup.html.form.Form, I would suggest that this be corrected simply by making the IDE always offer top-level classes before any nested classes. In general, this kind of logic can probably be tuned to better guess what you meant, e.g. by looking to see if you were already using a class with that simple name elsewhere in the same source root.

Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.