FXML Patterns / best practices

Dr. Michael Paus mp at jugs.org
Thu Feb 23 08:00:46 PST 2012

My idea was just to present a very simple example in order to 
demonstrate that
dependency injection and FXML can be used together. Your example is much 
elaborate of course and well worth investigating.


Am 23.02.2012 15:28, schrieb Werner Lehmann:
> Michael,
> I believe you are up to the same thing as I am - almost:
> On 23.02.2012 14:58, Dr. Michael Paus wrote:
>>               root = 
>> FXMLLoader.load(getClass().getResource("myview.fxml"));
>>               firstNameField = 
>> (TextField)root.lookup("#firstNameField");
> Here I would prefer to have a choice that the loader accepts "this" as 
> an instance of PersonView and then wires up the firstNameField etc 
> exactly as it does for a controller today - instead of creating a new 
> instance, requiring me to lookup everything again. In this way the 
> fxml loader really just replaces manual control creation with fxml 
> specified controls.
> Please see my proposal at the following URL for a way to achieve this 
> in the current framework (with 2.1):
> https://forums.oracle.com/forums/thread.jspa?threadID=2350343
> Rgds
> Werner

Dr. Michael Paus, Chairman of the Java User Group Stuttgart e.V. (JUGS).
For more information visit www.jugs.de.

More information about the openjfx-dev mailing list