• Post Reply Bookmark Topic Watch Topic
  • New Topic

Disable part of the Textarea

 
Ramaprasad Kolla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a TextArea which is instantiated as below:
private javax.swing.JTextArea getDescriptionTextArea() {
if(jTextArea == null) {
jTextArea = new javax.swing.JTextArea();
jTextArea.setColumns(0);
jTextArea.setWrapStyleWord(true);
jTextArea.setLineWrap(true);
}
return jTextArea;
}

I populate the TextArea using getDescriptionTextArea().setText("Predefined string of length 130 characters") and user is given a choice to enter text after these 130 characters. And My project requires these first 130 characters not to be edited by the user.

Please help me in disabling part of the TextArea.

Thanks in advance,
Ramprasad Kolla
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
put the
"Predefined string of length 130 characters"
in the (top) border
 
Ramaprasad Kolla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Michael
 
Ramaprasad Kolla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry.. forgot to post in my last reply..
It worked fine with title positioned to BELOW_TOP.

Thanks,
Ramprasad Kolla
 
Brian Cole
Author
Ranch Hand
Posts: 920
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Ramaprasad Kolla:
I have a TextArea

My project requires these first 130 characters not to be edited by the user.


It shouldn't be too hard to write a DocumentFilter that does this.

btw, what's the point of the jTextArea.setColumns(0) call?
[ November 11, 2008: Message edited by: Brian Cole ]
 
Ramaprasad Kolla
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry it was typed mistakenly in the post
Thanks for another solution. I will try this once.

Thanks,
Ramprasd Kolla
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!