This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
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.