The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
August 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

how can i insert a button into import javax.swing.text.DefaultStyledDocument

Posted by kevinchen on December 24, 2001 at 1:33 AM

i use:
myitembutton=new itembutton("itembutton");
myitembutton.setPreferredSize(spotsize);
StyleConstants.setComponent(mystyle[0],myitembutton);
//sadoc is a DefaultStyledDocument
sadoc.insertString(sadoc.getLength(), "mystyle", mystyle[0]);
but the button can not see,if i add the button into JTextPane directly like:
sa.insertComponent(myitembuttoninner);//sa is a JTextPane
the button can work,but because some resons i want add the button into DefaultStyledDocument.
Please tell me the method....
thanks
Merry christmas!!



Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us