Skip to main content

JXTextField backgroundPainter

4 replies [Last post]
zonski
Offline
Joined: 2003-06-27
Points: 0

Hi guys,
I'm putting together a simple little toolkit for defining the style aspects (colors, fonts, borders, etc) of a Swing GUI into an external class (i.e. similar concept to CSS fot HTML, but java/swing friendly):
http://java.net/projects/swing-style/pages/Home
In doing this I discovered that there is no setBackgroundPainter on JXTextField, which I would like to be able to do. Is this just an oversight, or is there some special way to paint the background for text fields in swingx? I searched the web and the forum but couldn't find a lot of info on the JXTextPane.
Cheers,
zonski

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kschaefe
Offline
Joined: 2006-06-08
Points: 0

I am getting a 404 on your project page.  For your reference it looks as if the old JavaCSS project was not ported to the new Kenai-based Java.net, but you should check out: http://weblogs.java.net/blog/enicholas/archive/2008/07/introducing_jav.html 

Karl

kschaefe
Offline
Joined: 2006-06-08
Points: 0

We never implemented it. The JXTextField class was ported in from the XSwingX project when we incorporated the PromptSupport code.

If you think it's necessary then, please file an feature request for it.

Karl

zonski
Offline
Joined: 2003-06-27
Points: 0

Hi Karl,
Thanks for the feedback, it is good to know I wasn't just missing something.
I have submitted this as an enhancement (http://java.net/jira/browse/SWINGX-1450) but it is pretty minor as I can easily roll my own extension. I also submitted an enhancment that is an extension of this, which is defining all these common methods on common interfaces (http://java.net/jira/browse/SWINGX-1451), again, pretty minor as there is an easy work around.
It seems my 'Swing Style' project is not yet approved so only I can see it (when logged in). I opened it a month ago, so I'm not sure why. Does anyone know what I have to do or who I contact to get it 'approved'? I can't seem to find anything in the FAQs or other docco about it but I may be looking in the wrong place.
The Java-CSS project looks interesting and I will definitely look into it. The Swing Style approach is very different (all Java code, the goal is to separate the 'style' code into re-usable classes, not necessarily into a 'CSS' text file) so I suspect it may have different strengths (such as easy use of painters, complex borders, and easy extensibility) and weaknesses to the Java-CSS project so I think the two projects will each have their own merits. I will however, investigate further and see what the general community response is as well. I use Swing Style in my own projects so I have to write the code either way :)
Cheers,
zonski

kschaefe
Offline
Joined: 2006-06-08
Points: 0

zonski,

For the interface issue, see the discussion that Steve and I had when he was having some issue with background painting.  I also have comments related to this on SwingXUtilities.updateMnemonicBinding.  Also note that Matt Nathan has a somewhat well-rounded abstract JXComponent class in his incubator section.

For your style project, you should also review Better Swing Application Framework for its property injection.

Karl