Geertjan's Blog

  • July 7, 2008

Prevent the Generation of Fully Qualified Class Names

Geertjan Wielenga
Product Manager
One big improvement in 6.5 that you're unlikely to hear about (anywhere else) is this very significant improvement (among several others) in the NetBeans Matisse GUI Builder—you can let Matisse generate code without fully qualified names. That's something I've wanted a long time, as well as others I've seen commenting on this online.

Simply choose Tools | Options | GUI Builder and then uncheck the "Generate Fully Qualified Names of Classes" checkbox. The result is that when you, for example, create a new JFrame, you'll get the following code:

package demo;
import javax.swing.WindowConstants;
import org.jdesktop.layout.GroupLayout;
\* @author geertjan
public class NewJFrame extends javax.swing.JFrame {
/\*\* Creates new form NewJFrame \*/
public NewJFrame() {
/\*\* This method is called from within the constructor to
\* initialize the form.
\* WARNING: Do NOT modify this code. The content of this method is
\* always regenerated by the Form Editor.
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
GroupLayout layout = new GroupLayout(getContentPane());
.add(0, 400, Short.MAX_VALUE)
.add(0, 300, Short.MAX_VALUE)
}// </editor-fold>
\* @param args the command line arguments
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new NewJFrame().setVisible(true);
// Variables declaration - do not modify
// End of variables declaration

That's pretty cool and very welcome news. But there are several other options that you'll be able to set. So, here's the GUI Builder options tab in 6.1:

While here it is again, from a recent trunk build:

In other news. Read this great overview of the recent Manila Sun Tech Days by Randell, who was there to witness it all.

Join the discussion

Comments ( 11 )
  • Tom Wheeler Monday, July 7, 2008

    This will be a nice usability improvement to Matisse!

  • pete Monday, July 7, 2008

    Getting closer... :)

    But there's still no imports of JFrame and EventQueue. :(

  • michael Monday, July 7, 2008

    > But there's still no imports of JFrame

    > and EventQueue. :(

    I agree with Pete - it seems odd to only go half way on this

  • Geertjan Monday, July 7, 2008

    Of course. I'm sure that's a bug.

  • Varun Monday, July 7, 2008


    I don't see this happening in NetBeans 6.5 Milestone 1!

    I downloaded it today!

  • Varun Monday, July 7, 2008

    Its working, I have to uncheck the selection of "Generate Qualified Names Of Classes"!

    Great work!

  • Geertjan Tuesday, July 8, 2008

    Yes, Varun. Like I said: "Simply choose Tools | Options | GUI Builder and then <u>uncheck</u> the "Generate Fully Qualified Names of Classes" checkbox."

  • swpalmer Tuesday, July 8, 2008

    Why do people care about fully qualified names in protected code blocks? This "feature" seems useless.

  • Varun Wednesday, July 9, 2008


    There might be 2 sides of this coin;

    1. Its useless for those who are adept at using Java API's, they know what all qualified names would be, so they ignore such utilities.

    2. Its useful for those, who use this IDE as a medium to learn basic Java programming concepts, the modular framework etc.

    My point of view would be that, it makes the code look compact, and enhance readability of the code, as I no longer have to read javax.swings.JButton jButton = new javax.swings.JButton(); // for example

    Also, as imports are shown, so let you know, that where those auto-generated components classes could be located for further exploration (helpful for many Java programmers)!


  • hekimboard Friday, July 25, 2008

    thanks friends.

  • oyun Saturday, November 1, 2008

    Thanks you really perfect one writing.I m always follow you.

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