This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Inserting JLabel into JTextPane  RSS feed

 
sunita reddy
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai,
i am inserting JLabel into textpane ,then i have to insert some text into documnet.i am sending my code and exceptions ..pl help me
Thanks
Sunitha
AttributeSet attr=textPane.getCharacterAttributes();
textPane.setCaretPosition(0);
JLabel iconLabel=new JLabel("Hello");
//iconLabel.setPreferredSize(new Dimension(20,16));
textPane.insertComponent(iconLabel);
textPane.getDocument().insertString(1,"Hell0 \n",attr);
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!