0

I have a question related to updating my Java version from version 6 to 7. And while there were very few changes I had to make to my program I did notice something strange. I used to be able to copy the text within the panel and paste it on a note pad if I wanted to. But with the recent Java upgrade I find that I am not able to do this any more. I made changes to the style code for it but I am not sure if there is anything I am missing and the repository does not show any change at all to it.

Here is the code, for my JTextArea:

public void SetStyleForTextAreaLabel( JTextArea ta) {
    ta.setEditable( false);
    ta.setHighlighter( null);
    ta.setLineWrap( true);
    ta.setWrapStyleWord( true);
    ta.setEnabled( false);
    ta.setDisabledTextColor( Color.black);
    ta.setBackground( this.getBackground());
}
Black Frog
  • 11,595
  • 1
  • 35
  • 66
Gilbert V
  • 1,050
  • 5
  • 16
  • 43

1 Answers1

1

You need to setEnabled(true). Also, since you are setting the highlighter to null, it may be that you cannot see what is being selected. Try this:

public void SetStyleForTextAreaLabel( JTextArea ta) {
    ta.setEditable( false);
    ta.setLineWrap( true);
    ta.setWrapStyleWord( true);
    ta.setDisabledTextColor( Color.black);
    ta.setBackground( this.getBackground());
}
martinez314
  • 12,162
  • 5
  • 36
  • 63
  • @GilbertV My suggestion is to NOT remove the highlighter (i.e., do not set it to null) and also to NOT disable text area. – martinez314 Mar 08 '13 at 16:56
  • i tried your suggestion and i was mistaken I was able to get the highlighter to show with your suggestion. Turns out i just needed the set Highlighter alone removed. – Gilbert V Mar 14 '13 at 17:13