A
A
Anton @ Lyalin2017-04-09 11:57:10
JavaFX
Anton @ Lyalin, 2017-04-09 11:57:10

How to pass text to another window in javafx?

There are two windows, two controllers, how can I transfer text from one window to another window??
I tried to call the constructor of the second window to pass the text in the main window, but the Controller of the second window is apparently called before the call of the window itself, and therefore I have null instead of the String variable.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton @ Lyalin, 2017-04-10
@toxa_1995

Issue resolved, I figured it out.
Can be passed using the class constructor, which is called in the controller of the main class. For example, launch a window by clicking on a button, in this case the controller has a method on the button, in which the constructor is passed, and that's it =)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question