Results 1 to 7 of 7
- 10-18-2010, 08:00 PM #1
Member
- Join Date
- Oct 2010
- Posts
- 16
- Rep Power
- 0
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.
- 10-18-2010, 09:51 PM #2
Member
- Join Date
- Oct 2010
- Posts
- 9
- Rep Power
- 0
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 :)
- 10-18-2010, 09:52 PM #3
Member
- Join Date
- Oct 2010
- Posts
- 9
- Rep Power
- 0
Sorry !!
String with capital S :)
- 10-18-2010, 10:17 PM #4
Member
- Join Date
- Oct 2010
- Posts
- 16
- Rep Power
- 0
Wonderful! Thank you for the help!
- 10-25-2010, 03:30 AM #5
Member
- Join Date
- Sep 2010
- Posts
- 61
- Rep Power
- 0
what if you want to do a calculation and return the result the second text field
- 10-25-2010, 03:32 AM #6
Member
- Join Date
- Sep 2010
- Posts
- 61
- Rep Power
- 0
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);
}
}
-
Globo, if you have a question, please ask it in its own thread. Don't hijack someone else's (corbokhan's) thread.
Locking this thread.
Similar Threads
-
use an intermediate variable in the money transfer and not manually input the amount
By SOLOshadow in forum New To JavaReplies: 2Last Post: 09-25-2010, 07:03 PM -
JTextArea on PopUp -JTextArea isn't editable
By Richy76 in forum AWT / SwingReplies: 3Last Post: 02-01-2010, 07:51 PM -
user input with JTextArea
By andre1011 in forum Advanced JavaReplies: 6Last Post: 04-16-2009, 04:09 AM -
Turn off sounds in Eclipse
By gio.fou in forum EclipseReplies: 2Last Post: 09-06-2008, 08:31 PM -
To turn a view jsp to a pdf file
By Daniel in forum JavaServer Pages (JSP) and JSTLReplies: 1Last Post: 07-05-2007, 06:23 PM


LinkBack URL
About LinkBacks

Bookmarks