Component « JTextPane « Java Swing Q&A





1. Retrieving components inserted into a JTextPane    coderanch.com

Solving this was really a pain... JTextPane has Container as an ancestor, so using getComponentAt( x, y ) was a pretty obvious choice to use... However, it kept returning some stupid inner class of javax.swing.text.ComponentView as the component insteand of the JLabel... This inner class was not documented in the APIs, so I used reflection on it to figure out which ...

2. Adding Components to JTextPane    coderanch.com