1

I am using MVP in my JavaFX application.

Resources:

public class InfoStageResources{

     StringProperty lblBlogText;
     Hyperlink linkBlog;

     InfoStageResources() {
         this.lblBlogText = new SimpleStringProperty("link");
         this.linkBlog = new Hyperlink("link");
     }

}

Controller:

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);
     }
}

View

In my InfoStageView in just init my labels and style my view.

How can bind my Hyperlink to my label. I tried some things but without success. My StringProperty lblBlogText isn't clickable but easy to bind.

My goal: I want to open the browser with the link.

xNappy
  • 158
  • 1
  • 4
  • 12

1 Answers1

0

I think you are looking for

 this.view.lblBlog.textProperty().bind(this.res.linkBlog.textProperty());
James_D
  • 201,275
  • 16
  • 291
  • 322
  • yes I found this too but then in my GUI is only a "text" and not a clickable hyperlink --> now I replaced my label with a Hyperlink and it works :) – xNappy Apr 15 '16 at 13:38