Form Editor Code Generation Questions

Kenneth Love <[email protected]>
Newsgroups gmane.comp.java.netbeans.user-interface
Message-ID <[email protected]>
Hi!

I'm new to Java, NetBeans, and mailing lists.  Please be kind if I do
something stupid, but please let me know.

I have been using the NetBeans v3.6 form designer for a couple of days
now and I noticed it doesn't place import statements at the top of the
class file for the controls I place on the form.  Instead, it fully
qualifies the control name.

For example, creating a JDialog (or a JFrame) with 3 JPanel, 17 JLabel,
14 JTextField, 2 JComboBox, and 2 JButton controls yields fully
qualified references in the generated code.  Like this:

	String licenseArray = { "normal", "motorcycle", "other" };

        informationLabel = new javax.swing.JLabel();
        labelsPanel = new javax.swing.JPanel();
        licenseNumber = new javax.swing.JTextField();
        licenseType = new javax.swing.JComboBox(licenseArray);
        saveButton = new javax.swing.JButton();

There are, of course, many other code snippets that could be shortened
with import statements at the beginning of the class file.  My Java
course book specifically mentions the following:

import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

I find the fully qualified reference style to be too wordy.

I realize the three lines above include a lot of extra stuff.  I also
realize specifying only those pieces I need would be more efficient.

Finally, here are my questions:

1. Is there a recommended coding style for this?  If so, what is the
recommendation?

2. Does NetBeans have a way to force the use of import statements?

3. Just how inefficient is using the 3 import statements above versus
the NetBeans way?

Thank you, in advance, for any insight/advice you can give me.

Kenneth

----
My opinions are my own, my employer knows nothing about it.
Kenneth Love             [email protected] (most reliable)
Programmer/Analyst       [email protected]
Oklahoma Tax Commission
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.