Quantcast
Channel: User Filip Milovanović - Software Engineering Stack Exchange
Viewing all articles
Browse latest Browse all 167

Comment by Filip Milovanović on Avoiding instanceofs with GUI composites

$
0
0
What you want is some sort of Chain of Responsibility-style mechanism - receive focus request, handle it by passing the request onto the first child, if any; if the child indicates the request is not handled (e.g. it already has focus or is not focusable), continue on to the next. If no child handles it, and the control itself can't handle it, indicate "not handled" to the caller. The tricky bit is to figure out how to do it in your particular framework - from a quick glance, search for "requestFocusInWindow" & "FocusTraversalPolicy" (could be that you need to implement this class, not sure).

Viewing all articles
Browse latest Browse all 167

Trending Articles