样式修改
parent
870d31fa40
commit
5651c7ca45
|
@ -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 |
Loading…
Reference in New Issue