The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.

So, textOne and textTwo are two text areas. Their Editable feature is set by a boolean named writeMode. In the beginning, it is set to true. So I can type whatever I want into the areas. However, I want to disable this after a while.
Under the Mod menu, there are two choices: Edit Mode (mmEdit menu item) and View Mode (mmView menu item). I thought I can perform this task easily by changing the value of writeMode. But nothing happened. So I googled it a little. I found out that revalidate invalidates and revalidates the components. I tried this, but it did not help. Then I tried repaint() with it. That did not help either.

I also tried revalidating and repainting the textOne and textTwo components. But that failed too.

So, I want to change the Editable feature of these components, but I cannot do it. Can you guide me please?

EDIT: I put some sysout statements to see if the value really changes. It does change.
This frame was created using WindowBuilder.
It does not give me any errors about anything.

Re: TextArea Editable value does not change

Thanks for the reply Norm.

So you say, when I pass a value of a boolean variable to a JTextArea object, it does not get the variable, but it only gets the value of the variable?
Then when I change the value of the boolean variable (writeMode in this case), the JTextArea does not know about it?

Re: TextArea Editable value does not change

Yes. There will not be a connection to the variable that was used to pass the value. The value at the time of the call to the set method was saved and used. No changes to the variable will change the original value that was passed.