- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我有这个人物 TableView :
<TableView fx:id="table" editable="true" focusTraversable="false" prefHeight="-1.0" prefWidth="-1.0" tableMenuButtonVisible="false" VBox.vgrow="ALWAYS">
<columns>
<TableColumn editable="false" maxWidth="5000.0" minWidth="10.0" prefWidth="100.0" resizable="false" sortable="false" style="-fx-font-size: 13pt;" text="Address">
<cellValueFactory>
<PropertyValueFactory property="id" />
</cellValueFactory>
</TableColumn>
<TableColumn editable="false" maxWidth="5000.0" minWidth="10.0" prefWidth="200.0" resizable="false" sortable="false" style="-fx-font-size: 13pt;" text="Address Type">
<cellValueFactory>
<PropertyValueFactory property="range" />
</cellValueFactory>
</TableColumn>
<TableColumn editable="false" prefWidth="200.0" resizable="false" sortable="false" style="-fx-font-size: 13pt;" text="Timestamp">
<cellValueFactory>
<PropertyValueFactory property="timestamp" />
</cellValueFactory>
</TableColumn>
</columns>
</TableView>
还有类的人:
public class People {
public static enum Range {ONE, TWO, THREE, FOUR}
public People() {
}
private IntegerProperty id = new SimpleIntegerProperty();
public int getId() {
return id.get();
}
public IntegerProperty idProperty() {
return id;
}
public void setId(int id) {
this.id.set(id);
}
private ObjectProperty<Range> range = new SimpleObjectProperty<>();
public Range getRange() {
return range.get();
}
public ObjectProperty<Range> rangeProperty() {
return range;
}
public void setRange(Range range) {
this.range.set(range);
}
private ObjectProperty<Timestamp> timestamp = new SimpleObjectProperty<>();
public Timestamp getTimestamp() {
return timestamp.get();
}
public ObjectProperty<Timestamp> timestampProperty() {
return timestamp;
}
public void setTimestamp(Timestamp timestamp) {
this.timestamp.set(timestamp);
}
}
我的问题是,当我在人员行中设置新的时间戳并且显示 TableView 时,该列不会更新时间戳。我必须使用 StringProperties 来自动刷新?
最佳答案
好的,我找到了解决方案。
我以这种方式更新时间戳:
private Timestamp actualTimestamp = new Timestamp();
private void updateTimeStamp(){
actualTimestamp.setTime(System.currentTimeMillis());
people.setTimestamp(actualTimestamp);
}
不刷新的原因:我没有设置新的 Timestamp 对象,因此失效不会减弱。
正确方法:
private void updateTimeStamp(){
actualTimestamp.setTime(new Timestamp(System.currentTimeMillis()));
people.setTimestamp(actualTimestamp);
}
关于TableView 中的 Java8 ObjectProperty 不刷新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24641295/
我有一个带有 NumberSpinner 的场景元素和 ComboBox元素,我想绑定(bind) minValue NumberSpinner的属性(property)valueProperty 为
我要绑定(bind) dp_date_add.valueProperty().bindBi Direction(model.forDateProperty()); 其中 forDateProperty
我有一个名为Tree的类 public class Tree { private Color c; public Color getColor() { retu
假设我有三个类: class A { val bProperty: ObjectProperty = SimpleObjectProperty(B(C("test"))) val cO
我的应用程序有一个包含多个 ObjectProperty 的对象字段。我正在尝试编写一个执行以下操作的辅助方法: 接受任何类型的 ObjectProperty作为参数 显示ChoiceDialog弹出
我的应用程序有一个包含多个 ObjectProperty 的对象字段。我正在尝试编写一个执行以下操作的辅助方法: 接受任何类型的 ObjectProperty作为参数 显示ChoiceDialog弹出
我刚开始学习kivy,我对ObjectProperty类的用法以及它如何将None作为参数感到非常困惑。有人可以解释一下吗?我在kivy教程中找到了它: class PongGame(Widget):
我正在创建一个 kivy 用户界面来显示由我编写为标准 python 对象的数据模型生成的值。本质上,我希望用户能够按下一个按钮,这将更改底层数据模型,并且此更改的结果将自动更新和显示。据我了解,这可
我正在使用 ScalaFX GUI 和 Akka 远程处理网络制作多人游戏客户端。当我的客户端收到游戏数据时,它会将其存储在 Model.gameData 中。我需要我的 GUI 来响应这个变量变化。
我正在使用 OWL API 和 Java (Eclipse) 开发一种算法。对于我的 ASSOCIATION 案例,我需要创建一个公理,其中 AGGREGATION 和 COMPOSITION 作为
我想了解 ObjectProperty 的工作原理,但仍然没有成功。我有以下 POJO: public class Article{ private LocalDateTime dateTim
我有一个包装 ObservableList 的属性。但我不知道如何初始化它。目前我正在这样做 ObjectProperty> property = new ChoiceBox().itemsPrope
我有这个人物 TableView :
我扩展了 SimpleObjectProperty创建自定义延迟加载实现(see here),LazyLoadingObjectProperty . 要将此通用实现用于 boolean 属性,我使用
在 W3 OWL 规范中,个体的属性分为两组:数据类型属性和对象属性。定义了对象属性(正如我发现的一篇文章所说的那样): "Object properties (owl:ObjectProperty)
ObjectPropertyBase 在 newValue == oldValue 时跳过值失效: /** * {@inheritDoc} */ @Override public void set
在RDF中,语句用S、P和O表示;在 OWL 中,owl:ObjectProperty 表示谓词逻辑。 (S) (P) (O) I like dog
我正在尝试创建一条指向属性中节点的线: ObjectProperty pointedToNode = new SimpleObjectProperty(); 我想要一条线像这样指向它: line.en
我正在尝试加载 ontology在 Protégé 中,但未按预期进行处理。最有问题的是所有对象和数据属性都显示为注释,而不是数据属性和对象属性。 我有一个对象属性kingdom: king
我研究了一些类及其声明,发现了一种新的封装方式,它使得访问实例变量的普通 getter/setter 方式看起来像野蛮行为...... 内部javafx.scene.Scene搜索相机,javafx.
我是一名优秀的程序员,十分优秀!