Results 1 to 7 of 7
  1. #1
    corbokhan is offline Member
    Join Date
    Oct 2010
    Posts
    16
    Rep Power
    0

    Default Turn JTextArea Input into Variable

    Hey Everyone,


    I'm working on a small application involving moving text input by a user from one JTextArea to another. There will be other actions going on here but that is the bulk of it.

    How exactly do I turn the text that is input into the first JTextArea and turn it into a variable so that I can move it to the next JTextArea.

    Hope this is clear.

  2. #2
    SQUALL is offline Member
    Join Date
    Oct 2010
    Posts
    9
    Rep Power
    0

    Default

    hi ...

    ok just declare string variable and put the value of JTextArea on it :

    string value = JTextArea1.getText();

    Now put the variable inside JTextArea2 :
    JTextArea2.setText(value);

    I hope That answered your Question :)

  3. #3
    SQUALL is offline Member
    Join Date
    Oct 2010
    Posts
    9
    Rep Power
    0

    Default

    Sorry !!

    String with capital S :)

  4. #4
    corbokhan is offline Member
    Join Date
    Oct 2010
    Posts
    16
    Rep Power
    0

    Default

    Wonderful! Thank you for the help!

  5. #5
    globo is offline Member
    Join Date
    Sep 2010
    Posts
    61
    Rep Power
    0

    Default

    what if you want to do a calculation and return the result the second text field

  6. #6
    globo is offline Member
    Join Date
    Sep 2010
    Posts
    61
    Rep Power
    0

    Default

    This is my code. I want to calculate tax and show the result in the tax field.
    class txtHandler implements ActionListener
    {

    public void actionPerformed(ActionEvent event)
    {


    double income;
    //double tax = 0.25;
    /*String input;
    input = txt1.getText();
    double txt1 = Double.parseDouble(input);
    input = txt2.getText();
    double txt2 = Double.parseDouble(input);*/

    income = txt1 *= 0.25;

    String s = txt1.getText();
    String income = s ;
    txt2.setText(income);

    //income = (txt1 * tax);

    }
    }

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,315
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. Replies: 2
    Last Post: 09-25-2010, 08:03 PM
  2. JTextArea on PopUp -JTextArea isn't editable
    By Richy76 in forum AWT / Swing
    Replies: 3
    Last Post: 02-01-2010, 08:51 PM
  3. user input with JTextArea
    By andre1011 in forum Advanced Java
    Replies: 6
    Last Post: 04-16-2009, 05:09 AM
  4. Turn off sounds in Eclipse
    By gio.fou in forum Eclipse
    Replies: 2
    Last Post: 09-06-2008, 09:31 PM
  5. To turn a view jsp to a pdf file
    By Daniel in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 07-05-2007, 07:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •