Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

selectAll() method on a JTextArea  RSS feed

 
Eric Daly
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to test the selectAll() method on a JTextArea, but the button does nothing. I'm sure it is a simple fix, I just don't understand how to use this function the way I want apparently. When I click the Select All button, I am expecting all the text to be selected... However, all the text is deselected instead. Here's my code:


[ January 24, 2007: Message edited by: Eric Daly ]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add the indicated line, in actionPerformed()

text.requestFocusInWindow();//<----------
text.selectAll();
 
Eric Daly
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I knew it was something simple. Thank you very much for your reply Michael.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!