我尝试使用我的第一个过滤器,FilteredList但当然它不起作用.
public class ListRemove {
public static void main(String[] args) {
ObservableList<CashBalance> cashBalanceList = FXCollections.observableArrayList();
LocalDate f1 = LocalDate.of(2011, Month.JANUARY, 1);
LocalDate f2 = LocalDate.of(2015, Month.AUGUST, 2);
CashBalance c1 = new CashBalance();
CashBalance c2 = new CashBalance();
c1.setData(f1);
c2.setData(f2);
cashBalanceList.setAll(c1, c2);
FilteredList<CashBalance> filteredList = new FilteredList<CashBalance>(cashBalanceList);
filteredList.stream().filter(p -> p.getData().isAfter(LocalDate.of(2012, Month.JUNE, 2)))
.collect(Collectors.toList());
for (CashBalance l : filteredList) {
System.out.println(l.getData());
}
}
}
Run Code Online (Sandbox Code Playgroud)
应显示一个日期,但显示两个.我究竟做错了什么 ?
我尝试在 JavaFX 中创建谷歌日历,但我遇到了 setOnMouseDragged 的问题。我的班级创建日历事件。
public class Events extends Pane {
public Events(Double x, Double y, String name) {
Rectangle events = new Rectangle();
events.setWidth(100);
events.setHeight(50);
Label label = new Label(name);
this.getChildren().addAll(events, label);
this.setLayoutX(x - 40);
this.setLayoutY(y);
this.setOnMouseDragged(m -> {
System.out.println(m.getX() + " " + m.getY());
this.setLayoutX(m.getX());
this.setLayoutY(m.getY());
});
}
Run Code Online (Sandbox Code Playgroud)
有趣的是当它改变 getX 到 getSceneX 一切正常。在日志之后我看到有一个双档: 在日志之后我看到有一个双拖:Drag 44.0 20.0 Dragg 176.0 29.0
有什么建议吗?
我的应用程序中有任务,我不知道它是如何从这个任务返回的。
public class TimeManager extends Service<String> {
@Override
protected Task<String> createTask() {
return new Task<String>() {
@Override
protected String call() throws Exception {
String txt = null;
while (!isCancelled()) {
try {
txt = "some txt";
Thread.sleep(1000);
} catch (InterruptedException e) {
System.out.println(e.getMessage());
}
}
return txt;
}
};
}
Run Code Online (Sandbox Code Playgroud)
在主类中:
TimeManager time = new TimeManager();
time.start();
time.getValue();
Run Code Online (Sandbox Code Playgroud)
时间总是返回空值。我该怎么做才能返回值?线程运行良好,我可以将数据从线程发送到应用程序
我的 VBA 项目中有一个枚举类:
Enum ruleEnum
admins
manager
users
supervisor
End Enum
Run Code Online (Sandbox Code Playgroud)
现在,我想获取此类的所有枚举值并将其插入到组合框中。我希望它能够动态运行,因为我将来可能会制定新规则。谁获取枚举类中的所有规则来循环或收集