![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Dec 2006
Location: Norway
Posts: 4
Rep Power: 0
![]() |
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.
java Syntax (Toggle Plain Text)
And the code I'm tring to port it from. Just so the previous makes more sense. java Syntax (Toggle Plain Text)
|
|
|
|
|
|
#2 |
|
Hobbyist Programmer
|
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
__________________
i dont know much about programming but i try to help |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Dec 2006
Location: Norway
Posts: 4
Rep Power: 0
![]() |
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.
java Syntax (Toggle Plain Text)
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| input data from user into array | lilmul123 | C++ | 5 | May 26th, 2006 9:29 AM |
| User input | jayme | C++ | 38 | Nov 25th, 2005 7:27 PM |
| Should i use fgets to set user input to a variable? | linuxpimp20 | C | 3 | Nov 25th, 2005 5:04 AM |
| User Input for Number Format | ericelysia1 | Java | 0 | Jul 21st, 2005 3:41 PM |
| Problem read'ing from file and user input | jmsilver | Bash / Shell Scripting | 3 | May 20th, 2005 2:35 PM |