Visual cues to represent lost focus on tree, table, etc.

B

B Young

Open most any native Windows app and deactivate the window or swap
between controls inside the app and you'll immediately notice that
when a component like a tree or table loses focus, the renderers
change from typically a dark blue background to a light grey
background, emphasizing the loss of focus. This has several usability
advantages.

JTable, JTree, etc. don't have this behavior by default. Their
renderers do have a boolean hasFocus parameter you can use to change
the background color yourself, but this falls apart in a multiple
selection environment since the hasFocus parameter is per renderer,
not per the whole tree or table.

I'm either missing something pretty obvious, or this is just going to
be a total focus subsystem nightmare to implement completely from
scratch.

Thanks
 
B

B Young

Hmm, perhaps I should have phrased this more as a question. But, I've
searched the net for several days and haven't found a single post with
anybody talking about this particular concern with Swing.

The importance of this feature becomes obvious with certain scenerios.
Assume you have a basic GUI with a toolbar, JTree and JTable. The
toolbar has a delete button. The delete button can be used against a
node in the tree, or a row in the table, depending upon which
component has focus. You are really going to mess with the user's
head if you can't show a visual cue to indicate which component (the
treel or table) has focus.

Any feedback on how to accomplish this in an elegant fashion would be
appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top