|
| ||||||||||
| Tags: javafx, programming language, runtime, script, threads |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| Threads in JavaFX
I try to develop a chat client with javafx, I have a java class that implements Runnable. When I create an instance this class since main.fx, the class performs 5 or 6 loop then the thread dies automatically. I have no idea regarding this problem. Also, do I have to implement threads in javafx in a different way or as i would to do in java? Any help will interest me. Thank you. |
|
#2
| |||
| |||
| Re: Threads in JavaFX
You can try the following part of code Code: public void run() (
while (Thread.currentThread().isAlive())(
/ / reception of message from the server
)
) |
|
#3
| |||
| |||
| Re: Threads in JavaFX
To call another Thread and especially to execute Java code from JavaFX must use the class JavaTaskBase and create a java class that extends RunnableFuture. Here is the code showing the same Code: def test: JavatestBase JavatestBase =(
/ ** * (@ inheritDoc) * /
public override function create(): JavatestBase (
MyRunnable()
)
)
test.start(); |
|
#4
| |||
| |||
| Re: Threads in JavaFX
If you need you can try the following code as an alternative, this is just the syntax of the code you will need to insert the code manually. Here is the code Code: public class test implements RunnableFuture (
/ ** * (@ inheritDoc) * /
@ Override
public void run() throws Exception (
[...]
)
) |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "Threads in JavaFX" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| What would be a limit for threads per day? | Cauvery | Technology & Internet | 7 | 21-07-2011 11:47 PM |
| Threads in Java | Addis | Guides & Tutorials | 4 | 18-02-2010 11:47 AM |
| threads concept in java | vijji191 | Software Development | 2 | 30-11-2009 02:44 PM |
| Syntax for Creating and Terminating C# Threads | Jesus2 | Software Development | 3 | 12-11-2009 05:44 PM |