jtextfield t=new jtextfield(); jtextfield t1=new jtextfield(); jtextfield t2=new jtextfield(); i want to get the values of textfield t and t1 and display in t2 like i want to add values of t and t1 and store in t2
Have another look at setText... your syntax is wrong in t3.settext=t1.gettext()-t2.getText();
We will help you with your problem, but it's your homework, we won't do it for you. You have made a start, so keep going! If you get stuck post your latest code and the details of why you're stuck, and someone will help.
t1.getText() will give you the current contents of the field as a String. Next you have to convert that to a numeric value (eg int or float). Then you can add/subtract etc the values Then convert the result back to a String Finally set the result field's text to that String.
To convert between Strings and numbers there are useful methods in the appropriate numeric classes, eg Integer.parseInt(aString); // converts String to Integer Integer.toString(anInt): // converts int to String You should look these up yourself to learn about them properly.