Skip to main content

how can i program as do{} in javaFX daily version ?

7 replies [Last post]
expsan
Offline
Joined: 2008-06-12
Points: 0

i'm migrating my application to latest version .

problem is :

System.out.println("start");
do{
while(true){
something.....
}
}
System.out.println("stop");

it works
print 'start' > works something in thread > print 'stop'

i replaced do{} by Timeline{}.

and it works
print 'start' > print 'stop'. works some....

how can i do?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
expsan
Offline
Joined: 2008-06-12
Points: 0

it's diffcult to esplain exactly.

thank's for repling kindly.

alexsch
Offline
Joined: 2007-07-12
Points: 0

If I understand correctly the problem is that the code below prints
[code]
start
stop
something
something
something
something
[/code]
instead of
[code]
start
something
something
something
something
stop
[/code]

[code]
import java.lang.System;
import javafx.animation.*;

System.out.println("start");

Timeline {
repeatCount: 10
keyFrames: KeyFrame {
time : 0.01s
action: function() {
System.out.println("something");
}
}

}.start();

System.out.println("stop");
[/code]

michael_heinrichs
Offline
Joined: 2007-11-15
Points: 0

The question is, why did you use do{} in the first place? In the code, I migrated from F3 to JavaFX, I usually simply removed the do{}-construct and it worked. Maybe you can do so as well, but I cannot tell without knowing the use-case.

alexsch
Offline
Joined: 2007-07-12
Points: 0

[code]
import java.lang.System;
import javafx.animation.*;

System.out.println("start");

var timeline = Timeline {
repeatCount: Timeline.INDEFINITE
keyFrames : [
KeyFrame {
time : 1s
action: function() {
System.out.println("something");
}
}
]
}

timeline.start();

System.out.println("stop");
[/code]

Is it what are you looking for?

expsan
Offline
Joined: 2008-06-12
Points: 0

for example::
System.out.println("start");
var b=true ;
var i=0 ;
do{
while(b){
if(i > 100){ b=true;}
i++;
System.out.println("something");
}
}

System.out.println("stop");

it works :
start
something
..
..
something
stop <-- works after do{} finish

but your example works
start
stop <--works before do{} finish
something

thanks.

Message was edited by: expsan

michael_heinrichs
Offline
Joined: 2007-11-15
Points: 0

Can you please explain a little more, what you are trying to achieve?

expsan
Offline
Joined: 2008-06-12
Points: 0

sorry, i can't english well.

the javaFX daily version is 2008-07-22_02-32-48

i want to replace 'do{}' by Timeline or something.