JavaFX 2:表:更新数据后更新显示 [英] JavaFX 2: Tables: Update display after having updated data

查看:143
本文介绍了JavaFX 2:表:更新数据后更新显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这就是我完成回答我的上一个问题所需的全部内容。

This is all I need to finish answering my last question.

如果你查看我的上一个问题,你会看到我的班级,其中包含四个字段,对应于我表格​​的四列

If you look at my last question, you will see my class, containing four fields, corresponding to the four columns of my table

public static class ContactOptions {

    private final StringProperty one;
    private final StringProperty two;
    private final StringProperty three;
    private final StringProperty four;

    ContactOptions(String col1, String col2, String col3, String col4) {
        this.one = new StringProperty(col1);
        this.two = new StringProperty(col2);
        this.three = new StringProperty(col3);
        this.four = new StringProperty(col4);
    }

    public String getOne() {
        return one.get();
    }

    public String getTwo() {
        return two.get();
    }

    public String getThree() {
        return three.get();
    }

    public String getFour() {
        return four.get();
    }
}

运行后如何让GUI更新 ContactOptions.one.set

How do I get the GUI to update after I run ContactOptions.one.set?

当我向下滚动并备份时,它会更新。如何在不滚动的情况下更新它。

When I scroll down and back up, it updates. How can I get it to update without scrolling.

我也在 https://forums.oracle.com/forums/thread.jspa?threadID=2275725

推荐答案

也许您应该使用以下方法之一:

Maybe you should use one of the methods below:

updateTableColumn(TableColumn col) 

更新与此TableCell关联的TableColumn。

Updates the TableColumn associated with this TableCell.

updateTableRow(TableRow tableRow) 

更新与此关联的TableRow TableCell。

Updates the TableRow associated with this TableCell.

updateTableView(TableView tv) 

更新与此TableCell关联的TableView。

Updates the TableView associated with this TableCell.

(来自 http://docs.oracle.com/javafx/2.0/api/javafx/scene/control/TableCell.html

但我认为你已经处理过这个问题了)

But I think you had already handled this problem)

这篇关于JavaFX 2:表:更新数据后更新显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆