I have to create a midlet using netbeans. It says have 1 form that allows the user to enter data. Second form shows a gauge. The third form displays results. It must also have 2 threads. 1 thread that reads the users input and another thread that carries out some tasks and then displays the results.

What i dont understand is how to create the first thread as i thought the user would enter data then once they press 'Ok' the second thread would be launched and the second form shown. But this would mean that i have only created the second thread as the program itself that netbeans has generated is already a thread as it constantly listens for user input.

I might of explained it poorly so what i am asking is when you create a midlet using netbeans is it automatically considered a thread as it constantly listens for user input?

If not how would i go about creating a thread that grabs the users input from from text fields?

Recommended Answers

All 2 Replies

Every program is, by default, a thread. This thread can spawn other threads (such as classes that extend Thread or implement Runnable in Java). From what you said it sounds like you technically have two threads in your model already. The main program (or whatever produced the button) is a thread. The threads it spawns to handle the work would count as separate threads, so you'd have your two threads!

I'm not familiar with midlets, but I can't imagine how they would differ in terms of thread management.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.