-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathFXDemo.java
More file actions
executable file
·33 lines (27 loc) · 914 Bytes
/
FXDemo.java
File metadata and controls
executable file
·33 lines (27 loc) · 914 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import java.awt.EventQueue;
import java.io.BufferedReader;
import java.io.FileReader;
import javax.script.ScriptEngine;
import javax.script.ScriptEngineManager;
public class FXDemo {
public static void main(String[] args){
try{
ScriptEngineManager manager = new ScriptEngineManager(null);
final ScriptEngine engine = manager.getEngineByName("FX");
engine.put("msg:java.lang.String", "JavaFX Script");
Runnable r = new Runnable() {
public void run() {
try {
System.out.println("EDT running: " + EventQueue.isDispatchThread());
engine.eval(new BufferedReader(new FileReader("script.fx")));
} catch (Exception e) {
e.printStackTrace();
}
}
};
EventQueue.invokeLater(r);
}catch(Exception ex){
System.out.println("Exception: "+ex.getMessage());
}
}
}