r/JavaFX • • Jan 16 '25

Help Grouping @JXML into an entity

Is it possible to combine several

```

\@FXML private TextField myField

```

into a separate class, which then would be used in a `\@FxmlView`?

1 Upvotes

14 comments sorted by

View all comments

Show parent comment

1

u/sedj601 Jan 16 '25

You are going to have to inject the fields the normal way. Other options are to create a custom node or do your fields in pure code and add them to an FXML node.

1

u/Draaksward_89 Jan 16 '25 edited Jan 16 '25

I'm starting to remember why I head a headache the first time I worked with JavaFX.

My current UI (WIP) is a ListView of entities on the left, with a "detailed" view on the right. I want to create entities (not actually creating, but getting their data as DTO and edit in the detailed view).

And now I'm thinking of adding a second window, which will be triggered by an Add-like button, which would be aimed at finding the record and (somehow) adding it to the list of the main window. Figured it out.