【发布时间】:2016-04-15 08:13:17
【问题描述】:
我在我的 JavaFX 应用程序中使用 MVP。
资源:
public class InfoStageResources{
StringProperty lblBlogText;
Hyperlink linkBlog;
InfoStageResources() {
this.lblBlogText = new SimpleStringProperty("link");
this.linkBlog = new Hyperlink("link");
}
}
控制器:
public class InfoStageController{
private InfoStageView view;
private InfoStageResources res;
public void initView(){
this.res = new InfoStageResources();
this.view = new InfoStageView(this.res);
this.initViewBindings();
}
private void initViewBindings(){
this.view.lblBlog.textProperty().bind(this.res.lblBlogText);
//this will not work
this.view.lblBlog.textProperty().bind(this.res.linkBlog);
}
}
查看
在我的 InfoStageView 中,只需初始化我的标签并设置我的视图样式。
如何将我的超链接绑定到我的标签。我尝试了一些东西,但没有成功。
我的 StringProperty lblBlogText 不可点击但易于绑定。
我的目标:我想用链接打开浏览器。
【问题讨论】: