Here's some sample code about how to use JTextPane:
JTextPane textPane = new JTextPane(new DefaultStyleDocument());
SimpleAttributeSet s = new SimpleAttributeSet();
StyleConstants.setFontFamily(s, "Times New Roman");
StyleConstants.setFontSize(s, 16);
StyleConstants.setBold(s, true);
StyleConstants.setForeground(s, Color.red);
textPane.getDocument().insertString(0, "hi, I am here\n", s);
Hope this helps.
Originally posted by anukampa malhi:
you are correct that i shd u use JTextPane but i m not able to get how can i actually use it. I have spend almost 3 days to work thru JTextPane but of no use. Can u please help me in same.
Thanx
Anukampa