Results 1 to 3 of 3
- 12-04-2012, 07:27 AM #1
Member
- Join Date
- Dec 2012
- Posts
- 1
- Rep Power
- 0
Can't use Math operators with variables I saved in Textfields
so i have this code where i want users to input and item name along with some numbers for each item(which i would like to preform some math operations on) I'm using Record store
working using WTK22
//UI Text Fields
TextField searchField = new TextField ("Search By Item Name", "", 25, TextField.ANY);
TextField userId = new TextField ("Item ID", "", 25, TextField.ANY);
TextField customerId = new TextField ("Item", "", 25, TextField.ANY);
TextField productName = new TextField ("CTM", "", 25,TextField.NUMERIC);
TextField productName2 = new TextField ("CTR", "", 25,TextField.NUMERIC);
TextField productName3 = new TextField ("CTC", "", 25,TextField.NUMERIC);
TextField orderQty = new TextField ("Quantity", "", 5,TextField.NUMERIC);
and later on I want to
orderIdForm.append( productName2 - productName);
and it tells me i can do that with textfield
.. so i tried
orderIdForm.append(Float.parse(productName2) - Float.parse(productName)) ;
still no luck... please help and thank you for your time
- 12-04-2012, 08:48 AM #2
Re: Can't use Math operators with variables I saved in Textfields
Cross posted
Cant not use Math operators with Textfield - Dev Shed
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 12-04-2012, 10:38 AM #3
Moderator
- Join Date
- Apr 2009
- Posts
- 10,481
- Rep Power
- 16
Re: Can't use Math operators with variables I saved in Textfields
What are you trying to achieve?
If it's subtracting the integer representation of those Strings then you need to do the parsing, though I would use Integer.parse().
If that doesn't work then you have to give us the full exception, including the stack trace, showing where in your code the exception is thrown.Please do not ask for code as refusal often offends.
Similar Threads
-
where methods final variables are saved
By killutch in forum New To JavaReplies: 7Last Post: 10-24-2012, 05:28 PM -
TextFields not showing up
By Army in forum New To JavaReplies: 7Last Post: 06-20-2012, 06:36 PM -
textfields - cursor
By newbie123 in forum AWT / SwingReplies: 6Last Post: 09-29-2011, 06:39 PM -
How do I input an equation with all of the math operators included?
By jerdaniel in forum New To JavaReplies: 3Last Post: 09-25-2011, 09:56 AM -
adding textfields
By themanepalli in forum Java AppletsReplies: 1Last Post: 12-28-2010, 03:56 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks