Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

getId() changed from "fx:id" to "id". How can we restore this functionality?

1044511Sep 24 2014 — edited Oct 22 2014

Hi all,

We have a desktop application made in JavaFX. In this application we design and implement the interface using SceneBuilder, so our windows are in fxml code. To give some functional parameters to window nodes, components, we have generic methods that load this parameters information from a database and give them to their component or node. To do this, we indentify each of those components using their id:

ObservableList<Node> componentes = panel.getChildren();

        Iterator<Node> iterador = componentes.iterator();

       

        while (iterador.hasNext()){

      

            final Node componente = iterador.next();

           String idComponente = componente.getId();

(...)

Using the previous JavaFX version, this getId() method returned the fx:id specified in the fxml for this node. The problem for us is that the new JavaFX version, released with Java8, returns us the id of this component in the fxml, which is blank at this moment.

Is there any way to get this fx:id, as before? Any other ideas apart from copying the fx:id to the id in every fxml that we have? (believe me that we have a lot...).

Thanks in advance for your help.

This post has been answered by jsmith on Sep 25 2014
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Nov 19 2014
Added on Sep 24 2014
3 comments
1,726 views