Custom Components don't show

Swing Designer allows you to quickly create the frames, panels, dialogs, applets and other UI elements that comprise Java Swing applications.

Moderators: Konstantin.Scheglov, gnebling, Alexander.Mitin, jwren, Eric Clayberg

Custom Components don't show

Postby jonaumann » Tue Nov 01, 2005 7:54 am

I have a custom AutoComplete-Textfield that inherits from JTextField. If I add it to the container (in the source code), it does not show up in the designer, but it is shown with the correct icon in the component tree.
jonaumann
 
Posts: 7
Joined: Tue Nov 01, 2005 3:02 am

Re: Custom Components don't show

Postby Eric Clayberg » Tue Nov 01, 2005 10:44 am

jonaumann wrote:I have a custom AutoComplete-Textfield that inherits from JTextField. If I add it to the container (in the source code), it does not show up in the designer, but it is shown with the correct icon in the component tree.

Any exceptions in your Eclipse ".log" file?

Can you provide a test case?

We have lots of examples of custom JTextFields and they all work fine on our end.
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA

Postby jonaumann » Wed Nov 02, 2005 11:56 pm

I have sent you the classes, maybe you can find the reason.
jonaumann
 
Posts: 7
Joined: Tue Nov 01, 2005 3:02 am

Postby Eric Clayberg » Thu Nov 03, 2005 8:31 am

jonaumann wrote:I have sent you the classes, maybe you can find the reason.

If you look in your Eclipse ".log" file, you should see an InstantiationException for each of the widgets indicating that neither could be instantiated.

The basic problem is that these widgets are not valid JavaBeans because they are missing their default constructors.

Add a default constructor to each, and they will both work fine. For example...

Code: Select all
public JAutoTextField() {
    this(new ArrayList());
}
Eric Clayberg
Software Engineering Manager
Google
http://code.google.com/webtoolkit/download.html

Author: "Eclipse Plug-ins"
http://www.qualityeclipse.com
Eric Clayberg
Moderator
 
Posts: 4503
Joined: Tue Sep 30, 2003 6:39 am
Location: Boston, MA USA


Return to Swing Designer

Who is online

Users browsing this forum: No registered users and 1 guest