首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

Java FX 数据绑定demo

后端 4.55KB 10 需要积分: 1
立即下载

资源介绍:

将变化的数据统一抽象为IntegerProperty与圆和进度条进行数据绑定,然后add 和sub只管更改IntergerProperty(),最后实现通过addButon和subButton来控制圆和进度条
package com.example.bindingdemon; import javafx.application.Platform; import javafx.beans.property.IntegerProperty; import javafx.beans.property.SimpleIntegerProperty; import javafx.event.ActionEvent; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.Button; import javafx.scene.control.Label; import javafx.scene.control.ProgressBar; import javafx.scene.shape.Arc; import java.net.URL; import java.util.ResourceBundle; public class HelloController implements Initializable { @FXML public Arc arc; @FXML public Label numLabel; @FXML public Button addBtn; @FXML public Button subBtn; @FXML public ProgressBar bar; IntegerProperty integerProperty = new SimpleIntegerProperty(0); @Override public void initialize(URL url, ResourceBundle resourceBundle) { arc.setStartAngle(90); arc.setLength(-0); numLabel.textProperty().bind(integerProperty.asString()); addBtn.disableProperty().bind(integerProperty.greaterThanOrEqualTo(100)); subBtn.disableProperty().bind(integerProperty.lessThanOrEqualTo(0)); integerProperty.addListener((observableValue, number, t1) -> { arc.setStartAngle(90); arc.setLength(-t1.intValue() * 3.6); bar.setProgress(t1.intValue() / 100.0); }); } @FXML public void sub(ActionEvent actionEvent) { integerProperty.set(integerProperty.get() - 10); } @FXML public void add(ActionEvent actionEvent) { integerProperty.set(integerProperty.get() + 10); } }

资源文件列表:

BindingDemon.zip 大约有15个文件
  1. BindingDemon/pom.xml 2.82KB
  2. BindingDemon/src/
  3. BindingDemon/src/main/
  4. BindingDemon/src/main/java/
  5. BindingDemon/src/main/java/com/
  6. BindingDemon/src/main/java/com/example/
  7. BindingDemon/src/main/java/com/example/bindingdemon/
  8. BindingDemon/src/main/java/com/example/bindingdemon/HelloApplication.java 630B
  9. BindingDemon/src/main/java/com/example/bindingdemon/HelloController.java 1.57KB
  10. BindingDemon/src/main/java/module-info.java 182B
  11. BindingDemon/src/main/resources/
  12. BindingDemon/src/main/resources/com/
  13. BindingDemon/src/main/resources/com/example/
  14. BindingDemon/src/main/resources/com/example/bindingdemon/
  15. BindingDemon/src/main/resources/com/example/bindingdemon/hello-view.fxml 1.23KB
0评论
提交 加载更多评论
其他资源 stm32f103基于LL库实现CT1712温度传感器的控制
stm32f103基于LL库实现CT1712温度传感器的控制
unity游戏资源提取工具AssetStudio多语言版
AssetStudio(简称AS)是一款Github上的开源软件,可以解包未加密的资源数据 具体来讲,用于2d手游提取立绘是它最常用的功能.。 github开源地址:https://github.com/zhangjiequan/AssetStudio 基于https://github.com/SiMaLaoShi/AssetStudio_Tuanjie修改的汉化版,添加了多语言支持
基于wxauto的AI微信聊天助手
基于wxauto的AI微信聊天助手
高一学生eeid账号.zip
高一学生eeid账号.zip
STM32F407移植FreeRTOS 202212.01版
本文使用的是优信电子的STM32F407VGT6开发板,开发环境KeilV5.38。使用优信电子提供的库函数例程-例3 串口实验作为模板,包含串口1初始化和串口发送、接收功能,以便于验证移植后功能。
Java FX MVVM架构 构建 登录界面
使用MVVM架构实现简易的登录界面 业务逻辑代码单独抽离抽离出来, view与ViewModel进行数据绑定 控制器调用业务逻辑代码进行相应。
Mind+自制程序免费提供
Mind+自制程序免费提供
Citypersons数据集(标签已转换成yolo格式,数据集太大无法上传)
Citypersons数据集(标签已转换成yolo格式,数据集太大无法上传),放在百度网盘。