Insubstantial / insubstantial

Swing look-and-feel library and assorted widgets
193 stars 57 forks source link

SwingX prompt controls not working correctly #7

Open Arcnor opened 13 years ago

Arcnor commented 13 years ago

Hi.

When I use a SwingX control with prompt support (like JXTextField) AND I set a prompt, instead of this (new JXTextField without prompt set):

good

I get this (new JXTextField with prompt set):

bad

(different size is not the issue, of course, but the different border and font). It seems that Substance-SwingX doesn't have an implementation of BuddyTextFieldUI or something similar.

kschaefe commented 13 years ago

The problem is SubstacneTextComponentBorder doesn't fallback correctly when SubstanceCoreUtilities.getTextComponentForTransitions returns a non-null component that has does not have a TransitionAwareUI delegate, as is the case when the prompt is installed. SwingX prompts use a UI delegate to wrap the "active" UI delegate to be able to perform the painting tricks necessary to get prompts to work.

Without adding dependencies in the main codebase on SwingX, I think the best bet is to do some reflection.

A BuddyTextFieldUI subclass that was also a TransitionAwareUI could solve the problem, but that may be a lot harder as we would need to time a SwingX release with that because I bet you'll need some changes over there as well.

Karl

Arcnor commented 13 years ago

Thanks for replying.

I'll try to fix it using reflection, then, although I don't really know where to start, because don't know the internal structure of SwingX (or Insubstantial, for that matter)