gpt4 book ai didi

javafx - 为什么 TableCloumn 需要 2 个元素?

转载 作者:行者123 更新时间:2023-12-02 04:56:21 25 4
gpt4 key购买 nike

JavaDoc 说:

Type Parameters:
S - The type of the TableView generic type (i.e. S == TableView<S>)
T - The type of the content in all cells in this TableColumn.

在这种情况下,“通用类型”是什么意思?如果内容是字符串,那么泛型类型也应该是字符串,不是吗?

我正在尝试使用字符串编译以下代码:

TableColumn col = new TableColumn<?, String>();

public void append(String str) {
col.add(str);
}

为什么我不能这样做?

最佳答案

  • S 是你的领域对象
  • T 是你想要的域对象的值显示在该列中。

有关此类问题,请查看 Javadoc:

http://docs.oracle.com/javafx/2/api/javafx/scene/control/TableView.html

关于javafx - 为什么 TableCloumn<S,T> 需要 2 个元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21748781/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com