Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

StyledDocuments in Swing

Status
Not open for further replies.

stormbind

Technical User
Mar 6, 2003
1,165
0
0
GB
Code:
JTextPane a = new JTextPane();
DefaultStyledDocument b = new DefaultStyledDocument();
a.setDocument(b);

My application was working with an error. When I extended DefaultStyledDocument everything fell apart and it materialised that.. getStyledDocument() does not return b!

I cannot cast the returned StyledDocument to a DefaultStyledDocument (or its extended brother).

Can someone clarify why this is happening, and what needs to change?

Thanks.

--Glen :)

Memoria mihi benigna erit qui eam perscribam
 
Should you be doing ..
Code:
a.setStyledDocument(b);

??

Tim
 
Ahahaha... okies, it looks like you may have the answer to my programming woes. I will try it out soon and post back to confirm. Thanks :)

--Glen :)

Memoria mihi benigna erit qui eam perscribam
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top