How can I insert a table in a JTextPane?
Created May 4, 2012
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(); tp.setText("Hello"); sa = new SimpleAttributeSet(); StyleConstants.setComponent(sa, new JTree()); doc = tp.getDocument(); doc.insertString(doc.getLength(), " ", sa);