Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example Code does not work #13

Open
ril3y opened this issue Jun 29, 2014 · 3 comments
Open

Example Code does not work #13

ril3y opened this issue Jun 29, 2014 · 3 comments

Comments

@ril3y
Copy link

ril3y commented Jun 29, 2014

Hello,

I have been trying to get your example code for the FXML howto working on the wiki. The first problem I see is this:

Parent root = fxmlloader.load(getClass().getResource("/fxml/Scene.fxml"));

It looks like it returns a "Result" vs a Parent. Is this example non longer how you do this?

@headcr4sh
Copy link
Member

Hi there,

you are of course right:
GuiceFXMLLoader#load(..) returns an instance of GuiceFXMLLoader.Result which offers a method (getRoot()) to access the Parent (or whatever root you have defined in your FXML file).

So... the code should be:

Parent root = fxmlloader.load(getClass().getResource("/fxml/Scene.fxml")).getRoot();

I can't seem to find the wrong information anywhere in the Wiki. Could you point me to the wrongly documented passage?

@ril3y
Copy link
Author

ril3y commented Jul 2, 2014

https://github.com/cathive/fx-guice/wiki/Example-app:-FXML-based-user-interface

Is there a good place to see a working example on using fxguice and fxml?
On Jul 2, 2014 2:47 AM, "Benjamin P. Jung" [email protected] wrote:

Hi there,

you are of course right:
GuiceFXMLLoader#load(..) returns an instance of GuiceFXMLLoader.Result
which offers a method (getRoot()) to access the Parent (or whatever root
you have defined in your FXML file).

So... the code should be:

Parent root = fxmlloader.load(getClass().getResource("/fxml/Scene.fxml")).getRoot();

I can't seem to find the wrong information anywhere in the Wiki. Could you
point me to the wrongly documented passage?

Reply to this email directly or view it on GitHub
#13 (comment).

@headcr4sh
Copy link
Member

Hi,

the source tree of this project contains an "examples" folder.
I think that the "calculator" example app is the most useful example I have written so far, as it utilizes most of the functionality that fx-guice has to offer.

The documentation over at https://github.com/cathive/fx-guice/wiki/Example-app:-FXML-based-user-interface seems correct to me, by the way ... I can see a call to getRoot() at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants