aspose file tools
The moose likes Swing / AWT / SWT and the fly likes Disable part of the Textarea Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply Bookmark "Disable part of the Textarea" Watch "Disable part of the Textarea" New topic
Author

Disable part of the Textarea

Ramaprasad Kolla
Greenhorn

Joined: Oct 22, 2008
Posts: 23
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


Thanks,
Ramaprasad K
In Love with Java -@
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
put the
"Predefined string of length 130 characters"
in the (top) border
Ramaprasad Kolla
Greenhorn

Joined: Oct 22, 2008
Posts: 23
Thanks Michael
Ramaprasad Kolla
Greenhorn

Joined: Oct 22, 2008
Posts: 23
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

Joined: Sep 20, 2005
Posts: 852
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 ]

bitguru blog
Ramaprasad Kolla
Greenhorn

Joined: Oct 22, 2008
Posts: 23
Sorry it was typed mistakenly in the post
Thanks for another solution. I will try this once.

Thanks,
Ramprasd Kolla
 
I agree. Here's the link: http://zeroturnaround.com/jrebel - it saves me about five hours per week
 
subject: Disable part of the Textarea
 
Similar Threads
JScrollpane - Force autoscroll to bottom
JTextArea as a pop up
Wordwrap in GridLayout
Unicode in TextArea
Two separate classes (not inner classes) and ActionListener question