This week's book giveaway is in the Agile forum.
We're giving away four copies of Head First Agile and have Andrew Stellman & Jennifer Greene on-line!
See this thread for details.
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with a JTextPane  RSS feed

 
Mario A. Villamizar
Ranch Hand
Posts: 35
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
this is a fragment of code. Basicly what it happends is that when it shows this windonw the JTextPane appears without the caret and I used setCaretPosition(), but it doesn't work

thanks.
 
Chantal Ackermann
Ranch Hand
Posts: 508
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the text pane needs the focus to display the caret. use JTextPane.requestFocus() to switch the focus. this method works _only_ if it is invoked after the window/frame has been made visible or pack has been called. use an ancester listener on the textpane to wait for these events, then call request focus.
if you need more help, post again
c
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!