我升级到Windows 10的情况非常好,只需要重新安装几个程序.Java就是其中之一,因为Eclipse不再启动了:eclipse 64位没有运行但是32位运行了,我在64位机器上运行它.通过卸载并重新安装Java和JDK可以轻松解决这个问题.但是,仍有一个问题.
System.getProperty(" ... ") 返回下一个错误的值:
"os.name" = "Windows 8.1" 应该说 "Windows 10""os.version" = "6.3" 这也错了吗?这是Java的问题还是因为Windows 10是通过系统更新完成的,而我的系统在技术上仍然是"Windows 8.1"?
在我的应用程序中,我有一个带有 VBox 的 ScrollPane,它可能包含 0 到 1000 个窗格,每个窗格的设置高度为 90。每个窗格都有相关的项目,这些项目可以从内部的按钮加载,该按钮清除 VBox 并添加其子项以及加载前一个列表并应返回到 ScrollPane 中相同位置的“返回到结果”按钮。但是, setVvalue() 似乎不起作用。窗格和它们的子级属于同一类。
package application;
import java.util.ArrayList;
import java.util.List;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ScrollPane;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
public class Main extends Application {
public VBox resultsBox;
public ScrollPane scroll;
public List<CustomClass> results = new ArrayList<CustomClass>();
public Button returnToResults;
public class CustomClass extends HBox {
public List<CustomClass> items;
public boolean hasItems() {
return items != null && …Run Code Online (Sandbox Code Playgroud) 轻微的图形烦恼,但我设置了ListView来显示自定义对象,这些对象的设置高度大于默认值。我尝试使用setFixedCellSize()在大多数情况下都能正常使用的方法,但在某些情况下,某些单元的单元高度可能会根据用户的交互作用而增大和缩小。
class Example extends Label {
private boolean change = true;
public Example(String text) {
super(text);
setMinHeight(150);
setPrefHeight(150);
setMaxHeight(150);
Hyperlink link = new Hyperlink("Change");
setGraphic(link);
link.setOnAction(ae -> {
change = !change;
if(change) {
setMinHeight(80);
setPrefHeight(80);
setMaxHeight(80);
} else {
setMinHeight(180);
setPrefHeight(180);
setMaxHeight(180);
}
});
}
}
ListView<Node> list = new ListView<>();
list.setFixedCellSize(150);
list.getSelectionModel().setSelectionMode(SelectionMode.MULTIPLE);
list.getItems().addAll(new Example("Hello world"), new Example("12345"));
Run Code Online (Sandbox Code Playgroud)
在上面的示例中,单击超链接时,标签会更改高度。setFixedCellSize()添加时不再执行此操作。是否有另一种方法可以实现更改虚拟行的相同效果,但允许自定义节点更改高度?