Borders created with BorderFactory don't show in Designer

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

Borders created with BorderFactory don't show in Designer

Postby Stu » Mon Sep 05, 2005 7:10 am

We have a lot of existing UI code that uses javax.swing.BorderFactory to create Border objects, which are then used on JPanels etc.

When working with this code in Designer, the borders are not visible (though of course they do work properly outside of designer - i.e. when the code is executed).

I tried searching for information regarding this in these forums but the only thing I could find related to this was that Designer doesn't support UI elements which are not directly created with a zero-argument constructor (including objects created through factory methods).

Is this indeed the reason my Borders don't display? And if so, is there any chance you could make an exception for things like BorderFactory which are an official part of the swing framework & recommended by Sun's swing tutorial? (Actually it would be super-nice if there was a way for me to use custom factory methods also)

Also, although I don't know the exact history of this code, I know that it has been edited with JBuilder's GUI designer (though I'm not sure that the use of BorderFactory comes from JBuilder since the code has also been manually edited).


RELEVANT SWING TUTORIAL PAGE

http://java.sun.com/docs/books/tutorial/uiswing/misc/border.html

OUR CODE

Code: Select all
Border etchedBorder = BorderFactory.createEtchedBorder(EtchedBorder.LOWERED);
Border myBorder = BorderFactory.createTitledBorder(etchedBorder,"Automobile",TitledBorder.LEFT,TitledBorder.TOP,new Font("SansSerif", Font.BOLD, 12),new Color(12,50,116));
panel.setBorder(myBorder);


Thanks for all your help. I'm amazed that Designer can do so well with our messy code - if it can be made to handle this pattern then I think it will be 100% useful for designing our legacy views (keeping us forever away from JBuilder).
Stu
 

Help plz

Postby Guest » Sun Sep 25, 2005 1:47 pm

Does any one know what is wrong here?
Guest
 

Re: Help plz

Postby Eric Clayberg » Mon Sep 26, 2005 12:20 pm

Anonymous wrote:Does any one know what is wrong here?

No. I tried the above code and it seemd to work fine...

Image

Are you using the latest v4.1.1 build?
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