本文整理汇总了Java中javafx.beans.value.WritableStringValue类的典型用法代码示例。如果您正苦于以下问题:Java WritableStringValue类的具体用法?Java WritableStringValue怎么用?Java WritableStringValue使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
WritableStringValue类属于javafx.beans.value包,在下文中一共展示了WritableStringValue类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: CommonsChoiceBoxTableCell
import javafx.beans.value.WritableStringValue; //导入依赖的package包/类
public CommonsChoiceBoxTableCell(ObservableList<CodeDVO> codes, StringConverter<CodeDVO> stringConverter) {
this.codes = codes;
this.stringConverter = stringConverter;
choiceBox = new ChoiceBox<>(codes);
choiceBox.setConverter(stringConverter);
choiceBox.setOnAction(event -> {
CodeDVO value = choiceBox.getValue();
if (value == null)
return;
ObservableValue<String> cellObservableValue = getTableColumn().getCellObservableValue(getIndex());
WritableStringValue writableStringValue = (WritableStringValue) cellObservableValue;
if (cellObservableValue instanceof WritableStringValue) {
writableStringValue.set(value.getCode());
}
event.consume();
});
}
示例2: testJavaFXStringUnidirectional
import javafx.beans.value.WritableStringValue; //导入依赖的package包/类
@Test
public void testJavaFXStringUnidirectional() {
Property<String> stringDolphinProperty = new MockedProperty<>();
StringProperty stringJavaFXProperty = new SimpleStringProperty();
WritableStringValue writableStringValue = new SimpleStringProperty();
stringDolphinProperty.set("Hello");
assertNotEquals(stringJavaFXProperty.get(), "Hello");
Binding binding = FXBinder.bind(stringJavaFXProperty).to(stringDolphinProperty);
assertEquals(stringJavaFXProperty.get(), "Hello");
stringDolphinProperty.set("Hello JavaFX");
assertEquals(stringJavaFXProperty.get(), "Hello JavaFX");
stringDolphinProperty.set(null);
assertEquals(stringJavaFXProperty.get(), null);
binding.unbind();
stringDolphinProperty.set("Hello JavaFX");
assertEquals(stringJavaFXProperty.get(), null);
binding = FXBinder.bind(writableStringValue).to(stringDolphinProperty);
assertEquals(writableStringValue.get(), "Hello JavaFX");
stringDolphinProperty.set("Dolphin Platform");
assertEquals(writableStringValue.get(), "Dolphin Platform");
stringDolphinProperty.set(null);
assertEquals(writableStringValue.get(), null);
binding.unbind();
stringDolphinProperty.set("Dolphin Platform");
assertEquals(writableStringValue.get(), null);
}