Have a look at the TextSamplerDemo.java referenced/discussed on the How to Use Editor Panes and Text Panes page. In the addStylesToDocument method, at the bottom, a JButton is added to a Style in the StyledDocument with a static StyleConstants method. Thinking about reversing this to get a reference to a component you might get the StyledDocument, get the Styles, traverse them, get the attribute names for each Style (look for StyleConstant with ComponentAttribute) and use them to look up the attribute values (look for a Component (instanceof JComponent)). DefaultStyledDocument has a getStyleNames method that looks handy.
Joined: Jan 07, 2005
My problem stems from mainly in the ComponentView of the main JTextPane, the links you showed me does not seem to have anything about ComponentViews.