Monday July 07, 2008
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() {
initComponents();
}
/** 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.
*/
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">
private void initComponents() {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.LEADING)
.add(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.LEADING)
.add(0, 300, Short.MAX_VALUE)
);
pack();
}// </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.
Jul 07 2008, 10:19:46 AM PDT Permalink
This will be a nice usability improvement to Matisse!
Posted by Tom Wheeler on July 07, 2008 at 11:42 AM PDT #
Getting closer... :)
But there's still no imports of JFrame and EventQueue. :(
Posted by pete on July 07, 2008 at 04:13 PM 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 08:53 PM PDT #
Of course. I'm sure that's a bug.
Posted by Geertjan on July 07, 2008 at 09:13 PM PDT #
Hi,
I don't see this happening in NetBeans 6.5 Milestone 1!
I downloaded it today!
Its working, I have to uncheck the selection of "Generate Qualified Names Of Classes"!
Great work!
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 08, 2008 at 01:45 AM 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 07:04 PM PDT #
@swpalmer
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)!
Regards!
thanks friends.
Posted by hekimboard on July 25, 2008 at 12:34 AM PDT #


