Prevent the Generation of Fully Qualified Class Names

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.


This will be a nice usability improvement to Matisse!

Posted by Tom Wheeler on July 07, 2008 at 04:42 AM PDT #

Getting closer... :)

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

Posted by pete on July 07, 2008 at 09:13 AM PDT #

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

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

Posted by michael on July 07, 2008 at 01:53 PM PDT #

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

Posted by Geertjan on July 07, 2008 at 02:13 PM PDT #


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

I downloaded it today!

Posted by Varun on July 07, 2008 at 04:07 PM PDT #

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

Great work!

Posted by Varun on July 07, 2008 at 04:14 PM PDT #

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

Posted by Geertjan on July 07, 2008 at 06:45 PM PDT #

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

Posted by swpalmer on July 08, 2008 at 12:04 PM PDT #


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)!


Posted by Varun on July 08, 2008 at 06:37 PM PDT #

thanks friends.

Posted by hekimboard on July 24, 2008 at 05:34 PM PDT #

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

Posted by oyun on November 01, 2008 at 10:10 AM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.


« June 2016