322
|
Chapter 8, Rendering
#64 Turn the Spotlight on Swing
HACK
The Metaphor
If you have ever been to a comic show, to the theatre, or to the circus,
you’ve probably noticed how spotlights are used to move your focus to a
particular location on the stage. A search operation can be compared to a
theatre stage, where actors have been replaced by search results. You just
need to get the user to focus on the right location.
Take a look at an example application, shown in Figure 8-12, which dis-
plays a predefined set of books and lets you search for one or more of them
by entering a search query in the text field at the bottom of the window.
Since the application is just a demo, you can only enter one of the following
queries: books, sci-fi, adams, and pratchett. Each query, when validated by
the Enter key, will find the related books and spotlight them, as shown in
Figure 8-13.
Figure 8-11. All the problems provoked by mixing Java3D and Swing have been solved
Turn the Spotlight on Swing #64
Chapter 8, Rendering
|
323
HACK
Figure 8-12. The bookshelf application must let the user search for books
Figure 8-13. Searching for “sci-fi” highlights Science Fiction books

Get Swing Hacks now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.