More work on reflection and prefs
Posted by mholmes on 06 Jun 2007 in Activity log
Revisiting my Apparatus app, I hooked it into the preferences object, and tried adding support for JFileChooser. This proved more complicated than I expected, because the JFileChoosers are usually created on the fly, so they're not owned by any other component in the hierarchy; they're just instance variables in the JFrame class. We had to use some reflection code to iterate through all the variables in the class to find any which are JFileChoosers. In order to make this work, they have to be public rather than private, but that's not a big deal.
This entry was posted by Martin and filed under Activity log.