步骤
0. 项目结构
1. 定义数据模型
2. FXML
3. Controller
4. Stage
5. 效果展示
项目结构

定义数据模型
public class Person {
private StringProperty name;
private IntegerProperty id;
public Person(String name, Integer id) {
this.name = new SimpleStringProperty(name);
this.id = new SimpleIntegerProperty(id);
}
public Integer getId() {
return this.id.get();
}
public String getName() {
return this.name.get();
}
public void setId(Integer id) {
this.id.set(id);
}
public void setName(String name) {
this.name.set

本文介绍了使用JavaFX构建一个简单的数据模型(Person类),结合FXML和Controller实现了一个带有姓名和学号的TableView。通过实例展示了如何定义数据模型,配置Fxml界面元素,以及Controller中数据绑定和显示的过程。
最低0.47元/天 解锁文章
329

被折叠的 条评论
为什么被折叠?



