How to convert a TextArea to a String?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Antonioj1015
    New Member
    • Oct 2009
    • 2

    How to convert a TextArea to a String?

    I need to convert a TextArea to a String, and the replace the letter "a" in the string by a "f";
    I have:
    JTextArea Text1 = new JTextArea();
    String Text2;
    ???????? here's where i convert the textarea to a srting ??????????
    Text2 = null;
    Text2 = Text1.replaceAl l("a", "e");

    I haved tried:
    String Text2 = CriptoText.getE lementById("Tex t1");

    Thank you for your help
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Read the API specs for the classes you are using rather than cross posting the same question on many forums.

    Comment

    • Antonioj1015
      New Member
      • Oct 2009
      • 2

      #3
      Originally posted by r035198x
      Read the API specs for the classes you are using rather than cross posting the same question on many forums.
      I already sis but i cant really understand thats why i ask, and if i have 100 thousand forums with the same quiestion is my problem i want a respond thats why i do it...And i only have 2 forums with the same question...

      Comment

      • Yene
        New Member
        • Oct 2009
        • 13

        #4
        Are you trying to convert JtextArea() object in to a string or something else?

        Comment

        • Saser
          New Member
          • Jul 2009
          • 17

          #5
          Haven't tested it, but quite sure this works:

          Code:
          JTextArea TextArea = new JTextArea();
          String text1 = TextArea.getText();
          String text2 = text1.replaceAll("a", "e");

          Comment

          Working...