[英]Accessing observable list in another class
Let's say I have a class: 假设我有一节课:
public class FutureTask extends Task<ObservableList<Future>> {
@Override protected ObservableList<Future> call() throws Exception
ObservableList<Future> futureList = FXCollections.ObservableArrayList();
....
/// a bunch of things here to build and manipulate the list
....
return futureList;
If I had another class 如果我有另一堂课
public class {
// What would I enter here to get a variable x so:
x = futureList?
I tried doing ObservableList<Future> x = FutureTask.call()
but I keep getting a static reference error. 我尝试了ObservableList<Future> x = FutureTask.call()
但我一直收到静态引用错误。
FutureTask is only used once in the code, so would I have to declare it static
? FutureTask只在代码中使用过一次,所以我必须将它声明为static
吗?
ObservableList<Future> x = new FutureTask().call();
会做魔术。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.