You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@netbeans.apache.org by Fernando Calderón <fc...@gmail.com> on 2023/04/28 11:07:48 UTC
javax.swing.GroupLayout changed to org.jdesktop.layout.GroupLayout by form designer
Hi
I have a file template for a java class that extends JPanel. I have
copied the JPanel template and changed "extends JPanel" to "extends
MyClass" (MyClass extends JPanel).
When I create a new MyClass file (using the template) everything is
fine. The problem arises when I drag a component to my MyClass object.
When I do that the library "javax.swing" is not used anymore.
Instead,the code generator uses the old library "org.jdesktop".
For example:
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
is changed to:
org.jdesktop.layout.GroupLayout layout = new
org.jdesktop.layout.GroupLayout(this);
Is there a known bug about this? Seems to be the code generator messing
things up.
Be aware that this does not happen with JPanel form template (or JFrame,
JDialog for that matter), just with MyClass template.
The MyClass template, as I said before, is an exact copy of the JPanel
template except from that it extends MyClass instead of JPanel. The
corresponding form file is exactly the same as JPanel's.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
Re: javax.swing.GroupLayout changed to org.jdesktop.layout.GroupLayout by form designer
Posted by Fernando Calderón <fc...@gmail.com>.
Thanks Tim,
I was having this issue in another project which had a reference to the
project with the class extending JPanel as a dependency. Erasing and
re-adding the dependency seemed to work and I don't have the issue
anymore (for now).
Anyways, if I came across the issue again I'll try what you said.
Regards.
On 7/5/23 2:40, Tim de Vries wrote:
> Hi Fernando,
>
> Probably the way you'll find most useful is to declare a class that
> receives a package name and class name that generates the file the way
> you want it. Generate your specific imports that Netbeans doesn't
> accommodate you for and work from that. I have a TextFile class in
> ca.tecreations that you declare according to a file and then
> add("linetext") and write();, or you can write your own. You probably
> won't have much help or support from the 'so-called' 'Apache
> Meritocracy'.
>
> Tim
>
> On 2023-04-28 5:07 a.m., Fernando Calderón wrote:
>> Hi
>>
>>
>> I have a file template for a java class that extends JPanel. I have
>> copied the JPanel template and changed "extends JPanel" to "extends
>> MyClass" (MyClass extends JPanel).
>>
>>
>> When I create a new MyClass file (using the template) everything is
>> fine. The problem arises when I drag a component to my MyClass object.
>>
>>
>> When I do that the library "javax.swing" is not used anymore.
>>
>> Instead,the code generator uses the old library "org.jdesktop".
>>
>>
>> For example:
>>
>> javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
>>
>> is changed to:
>>
>> org.jdesktop.layout.GroupLayout layout = new
>> org.jdesktop.layout.GroupLayout(this);
>>
>>
>> Is there a known bug about this? Seems to be the code generator
>> messing things up.
>>
>>
>> Be aware that this does not happen with JPanel form template (or
>> JFrame, JDialog for that matter), just with MyClass template.
>>
>> The MyClass template, as I said before, is an exact copy of the
>> JPanel template except from that it extends MyClass instead of
>> JPanel. The corresponding form file is exactly the same as JPanel's.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
>> For additional commands, e-mail: users-help@netbeans.apache.org
>>
>> For further information about the NetBeans mailing lists, visit:
>> https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@netbeans.apache.org
For additional commands, e-mail: users-help@netbeans.apache.org
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists