How can I insert a table in a JTextPane?

Sandip Chitale

This example shows how to add a JTree, however the principle is same.

// import packages
import javax.swing.*;
import javax.swing.text.*;

tp = new JTextPane();

sa = new SimpleAttributeSet();
StyleConstants.setComponent(sa, new JTree());

doc = tp.getDocument();
doc.insertString(doc.getLength(), " ", sa);

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact