N
N
Neonoviiwolf2017-11-30 20:32:25
Java
Neonoviiwolf, 2017-11-30 20:32:25

How to split code into several controls in javafx?

Good!
How to set several in one Sample.fxml

fx:controller="controller.Controller"
well, then I dump everything into one controller, it’s extremely inconvenient

public class Controller implements Initializable {
@FXML
TextFieldId ....
.....

I want to break this code into parts

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey, 2017-12-01
@Neonoviiwolf

In your main fxml, write the connection of child fxml
For example, you make one main fxml in it, create some kind of vbox
, set the vbox cells to a fixed size and connect window elements spaced apart by different controllers
So connect the child fxml-ku
In the child fxml, specify the fx:controller parameter, which will refer to the child controllers,
I didn’t explain very clearly if it doesn’t work, write an example

S
Sergey, 2017-12-01
@red-barbarian

Break down functionality. Delegate the execution of something not directly related to the mapping to separate classes.
Read about MVP. And clean architecture.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question