Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text areas

Status
Not open for further replies.

robmif76

Programmer
Feb 1, 2003
10
GB
Hi,

I am trying to gather some input using Swing classes.
Basically, I have a number of text areas and a combo box in the same frame and I need to "grey out" some of the text areas according to the selection in the combo box.

Any help?

Thanks
Rob
 
If you are asking how to grey out the text box, you can just use the setEditable method in JTextArea

JTextArea jta = new JTextArea();
jta.setEditable(false);


you could toggle this property based on what is selected in the combo box.

 
If you want to mark up text in the area, I think you might need to consider using the JTextPane rather than JTextArea. It's a more complex Class than the JTextArea, however I don't believe the JTextArea will highlight parts of the text (other than the user selecting text by mouse)
 
Thanks for your help.

Once again...problem solved!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top