Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



Threads in JavaFX

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 15-07-2010
Member
 
Join Date: Mar 2010
Posts: 303
Threads in JavaFX
  

Hello,
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.

Reply With Quote
  #2  
Old 15-07-2010
Member
 
Join Date: Mar 2010
Posts: 197
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
    
        )
)
Infinite loops, it is nice but it may need to do a sleep () system to let the story breathe and allow other threads to run. But hey I guess when you expect the server info should be ca call blocks? So it can allow time to do other things during the crash.
Reply With Quote
  #3  
Old 15-07-2010
Member
 
Join Date: Dec 2009
Posts: 263
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();
Reply With Quote
  #4  
Old 15-07-2010
Member
 
Join Date: Dec 2009
Posts: 192
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 (
    [...]
  )
)
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


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


All times are GMT +5.5. The time now is 05:13 AM.