This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Disable Caret in a Document  RSS feed

 
Mike DeStefano
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an uneditable JTextArea embedded within a JScrollPane. Is there any way to remove the caret in the JTextArea document so that UP and DOWN don't move the document.

Thanks in advance..
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
textArea.getCaret().setVisible(false);
 
Matti Poro
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can still use the arrow keys to scroll the text area after setting the caret invisible.

JTextArea.setFocusable(false);
 
Mike DeStefano
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OMG!!! It worked!!! Praise Zeus and the Java Gods! To think disabling scrolling on UP and DOWN keyboard events was that easy! GGGGEEEEEEZZZZ!!!

Thanks very much!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!