样式修改

dev
youhong.ai 2023-07-12 15:26:34 +08:00
parent 870d31fa40
commit 5651c7ca45
2 changed files with 15 additions and 1 deletions

View File

@ -213,6 +213,7 @@ public class BuilderPackageEcology extends Application {
checkBox = new CheckBox();
checkBox.getStyleClass().add("check-box");
checkBox.selectedProperty().addListener((observable, oldValue, newValue) -> {
FileInfo item = getItem();
item.setSelected(newValue);
String filePath = item.getFilePath();
@ -223,6 +224,15 @@ public class BuilderPackageEcology extends Application {
} else {
filePaths.remove(filePath);
}
String iconName = "icons/folder.png";
if (item.isSelected()) {
iconName = "icons/folder_active.png";
}
Node rootIcon = new ImageView(
new javafx.scene.image.Image(Objects.requireNonNull(getClass().getResourceAsStream(iconName)))
);// 定义一个图片类型节点对象
checkBox.setGraphic(rootIcon);
});
}
@ -236,8 +246,12 @@ public class BuilderPackageEcology extends Application {
checkBox.setSelected(item.isSelected());
checkBox.setText(item.getFileName().replace("_", "__"));
if (item.isDirectory()) {
String iconName = "icons/folder.png";
if (item.isSelected()) {
iconName = "icons/folder_active.png";
}
Node rootIcon = new ImageView(
new javafx.scene.image.Image(Objects.requireNonNull(getClass().getResourceAsStream("icons/folder.png")))
new javafx.scene.image.Image(Objects.requireNonNull(getClass().getResourceAsStream(iconName)))
);// 定义一个图片类型节点对象
checkBox.setGraphic(rootIcon);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 289 B

After

Width:  |  Height:  |  Size: 226 B