javafx 8 - Adding a custom component to SceneBuilder 2.0 -


i have need have selection listener , select method on pane able monitor , present highlight when node clicked on.

i did following:

public class panewithselectionlistener extends pane {  private objectproperty<annotation> selectedannotation = new simpleobjectproperty<>();  public panewithselectionlistener() {      super();     selectedannotation.addlistener((obs, oldanno, newanno) -> {         if (oldanno != null) {             oldanno.setstyle("");         }         if (newanno != null) {             newanno.setstyle("-fx-border-color: blue;-fx-border-insets: 5;-fx-border-width: 1;-fx-border-style: dashed;");         }     });      setonmouseclicked(e->selectannotation(null)); }  public void selectannotation(annotation ann){     selectedannotation.set(ann); } 

}

and works great - not able work scenebuilder anymore since fxml references panewithselectionlistener rather pane. not sure how custom pane scenebuilder. have looked @ other questions , combination of fxml , controllers - pane.

does know of way this, or perhaps swap pane panewithselectionlistener @ initialization time?

thanks

if issue make custom class available in scenebuilder, can following steps:

  1. bundle custom class (and supporting classes, such annotation) jar file
  2. in scenebuilder, activate drop-down button next "library" in top of left pane: enter image description here
  3. choose "import jar/fxml file..."
  4. select jar file created step 1
  5. make sure class need access in scenebuilder (panewithselectionlistener) checked
  6. press "import component"
  7. panewithselectionlistener appear in scenebuilder under "custom" in left pane: enter image description here

you'll notice drop-down in scenebuilder has "custom library folder" option, can open folder jar files stored. quick option, can copy jar files folder , (after short delay), contained classes appear in "custom" list.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -