SimpleStringProperty和StringProperty之间的区别 [英] Difference between SimpleStringProperty and StringProperty

查看:1353
本文介绍了SimpleStringProperty和StringProperty之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用JavaFx TableView,发现有一些类使用TableView,例如SimpleStringProperty,StringProperty,SimpleBooleanProperty和BooleanProperty等。现在我想知道哪个用于TableView的SimpleStringProperty或者只有StringProperty和什么是它们之间的区别。

I am working with JavaFx TableView and found there are some classes to use a TableView for example SimpleStringProperty, StringProperty, SimpleBooleanProperty and BooleanProperty, etc. Now I am wondering about which one to use for TableView either SimpleStringProperty or only StringProperty and what are the difference between them.

推荐答案

StringProperty是可观察字符串属性的抽象基类,SimpleStringProperty是一个具体的实现。

StringProperty is the abstract base class for observable string properties, SimpleStringProperty is a concrete implementation.

规则是:


  1. 在API中显示StringProperty

  2. 使用SimpleStringProperty作为代码中的具体实现

您有时会看到JavaFX代码本身从StringPropertyBase创建匿名内部类,并且这样做的原因是它在记忆方面更有效,但你通常不必打扰自己。

You sometimes see JavaFX code itself createing anonymous inner classes from StringPropertyBase and the reason for this is that it is a bit more effecient memorywise but nothing you normally have to bother yourself.

这篇关于SimpleStringProperty和StringProperty之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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