![]() |
Help needed with using TextFields as user input
I'm slowly learning java so I can make midlets for my cell phone. I thought it would be best to start with a simple calculator program, so I could get familiar with java. It was easy enough to make a working version for command line use, but porting it over to a midlet is proving to be more difficult. So far I've put together a form with the input fields required, but I can't extract values from the textfields. I've tried several methods, but my IDE just returns errors. What I need help with is gathering values from the textfields, and displaying values in the textfields. Here's the code so far. Oh btw, it's a chemistry calc.
:
And the code I'm tring to port it from. Just so the previous makes more sense. :
|
Re: Help needed with using TextFields as user input
I do not have ME installed so i cannot compile your code. what errors do you get?
I do not have experiance with ME and MIDlets but I have some experiance with awt and swing. If you are using TextFields you need to import them form import java.awt.TextField. For swing gui's to get text from a JTextField use .getText |
Re: Help needed with using TextFields as user input
I forgot to mention, the code above compiles and works, I just want to extract the values from the textfields and put them into variables. There is no code in place to do so yet. The IDE I'm using is Netbeans. I've tried using .getText and declaring a JTextField, but neither work. I was finally able to get a number from a textfield, but decimal numbers cause the program to crash.
:
Is there some kind of midlet limitation, which prevents certain codes from working? It seems I can only use .getString, .setString and not .getText, .setText. |
| All times are GMT -5. The time now is 10:16 AM. |
Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC