小编B. *_*aza的帖子

将图像添加到 JavaFX TableView 列中

我是 Java 和 OOP 新手,并且陷入了向 tableview 列添加图像的困境。代码似乎有效,我可以看到学生的姓名正确,但图像未显示在列中。我收到此错误并且无法理解如何使其工作:

javafx.scene.control.cell.PropertyValueFactory getCellDataReflectively
WARNING: Can not retrieve property 'picture' in PropertyValueFactory: javafx.scene.control.cell.PropertyValueFactory@5b0da50f with provided class type: class model.StudentModel
java.lang.IllegalStateException: Cannot read from unreadable property picture
Run Code Online (Sandbox Code Playgroud)

学生型号:

package model;

import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.scene.image.ImageView;

import java.util.ArrayList;
import java.util.List;

public class StudentModel {

    private ImageView picture;
    private String name;
    private SubjectModel major;
    private SubjectModel minor;
    private String accountPassword;
    public String getAccountPassword()
    {
        return accountPassword;
    }
    public List<LectureModel> lectureModelList = new ArrayList<>();

    public StudentModel(String name, SubjectModel …
Run Code Online (Sandbox Code Playgroud)

java javafx scene imageview

3
推荐指数
1
解决办法
730
查看次数

标签 统计

imageview ×1

java ×1

javafx ×1

scene ×1