Perhaps we should add one. :)
Using the focusable attribute might be a good hint too. I'm taking
all
suggestions at this point.
While on the topic of focus rings, when creating a custom focusable
component (e.g. by specializing JPanel), what is the best way to add
a focus ring?
That is a great question, and I don't think I have any good answer to
it at the moment.
Should I paint it myself in my component, create my own border class
to paint it, or use an Aqua PLAF class? If I paint it myself, what
colour should I use -- I can't find a UIDefaults value for the focus
ring colour, nor is there a java.awt.SystemColor entry for it.
We should hijack one of the SystemColor's, or at least a UIManager
entry for it. Please file an enhancement request at http://bugreporter.apple.com
. I have thought a little bit about this before, and I'm a bit
concerned about developers caching the color away if they retrieve it
from the UIManager, but I suppose it's not the end of the world if the
user is bouncing back and forth between Blue and Graphite, and notices
that a custom control is "stuck" in the color the app started in.
And what is the best technique to get the "glow" effect -- draw
multiple outlines (e.g. rect or round rect) with increasing size and
transparency? Is there some funky trick in Java2D to get the right
gradient with a single outline?
Actually, I've never done the focus ring drawing in Java2D before. The
lower levels of the OS have the ability to draw the ring for any
random custom drawing, which is how we got focus rings around toolbar
icons (see SwingSet). I think it would be really cool to have a Border
that you could apply to a component that could just "envelop" the
outer edge of the component with the focus fuzz, but that would mean
screwing with the natural paint order somehow...again, this would
require some careful thought.
The last custom component I wrote I wound up refactoring to inherit
from a component that already had a focus ring. That may not always
be possible, or the best solution.
I'm glad that you're working hard to ensure a consistent user
experience for your custom controls. If you think of any more
suggestions to help make better native-looking controls, please feel
free to file enhancement requests.
Cheers,
Mike Swingler
Java Frameworks Engineer
Apple Inc.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden