Re: Form Editor Code Generation Questions
David Strupl <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.user-interface |
|---|---|
| Message-ID | <[email protected]> |
Hello,
this question might be more suited for the nbusers mailing list - please see
http://www.netbeans.org/community/lists/top.html
The feature you are requesting is not implemented in NetBeans. The request comes
from time to time but has never been very high on the developers list to be
implemented. See
http://www.netbeans.org/issues/show_bug.cgi?id=7781
You can add your comments there, vote for the issue ...
Best regards,
David
Kenneth Love wrote:
> 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
>