Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » e(fx)clipse » Problem loading FXML files
Problem loading FXML files [message #1424135] Mon, 15 September 2014 14:10 Go to next message
Thomas Elskens is currently offline Thomas ElskensFriend
Messages: 159
Registered: September 2014
Location: Brussels - Belgium
Senior Member
Hello,

I'm experiencing some trouble loading FXML-files in my efx4 application.

According to the recipe (https://wiki.eclipse.org/Efxclipse/Runtime/Recipes#.40FXMLLoader) I should use the following code snippet :

Quote:

public class MyLoginView {
@PostConstruct
void init(BorderPane p, @FXMLLoader FXMLLoaderFactory factory) {
GridPane p = factory.loadRequestorRelative("myLoginView.fxml").build();
// ...
}


However, this code gives me errors :
* first of all, type mismatch and duplicate local variable -> solved by leaving out "GridPane".
* ".build()" gives the error "The method build is indefined for the type FXMLBuilder<Object>"
* when changing "build()" to "load()", the application finally starts up but the widget is empty.

Any cues as how this code can be made to work ?
Is there any other example on how to load FXML files in a efx4 application ?

Just in case : I've not forgotten to link the class MyLoginView to the application model.

Thanks in advance,

Thomas Elskens
Re: Problem loading FXML files [message #1424221 is a reply to message #1424135] Mon, 15 September 2014 17:08 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6651
Registered: July 2009
Senior Member
The snippet is wrong.

It should be:

> public class MyLoginView {
> @PostConstruct
> void init(BorderPane p, @FXMLLoader FXMLLoaderFactory factory) {
> GridPane gridPane = factory.loadRequestorRelative("myLoginView.fxml").load();
> p.setCenter(gridPane);
> // ...
> }
> }

Tom

On 15.09.14 17:48, Thomas Elskens wrote:
> Hello,
>
> I'm experiencing some trouble loading FXML-files in my efx4 application.
> According to the recipe
> (https://wiki.eclipse.org/Efxclipse/Runtime/Recipes#.40FXMLLoader) I
> should use the following code snippet :
>
> Quote:
>> public class MyLoginView {
>> @PostConstruct
>> void init(BorderPane p, @FXMLLoader FXMLLoaderFactory factory) {
>> GridPane p =
>> factory.loadRequestorRelative("myLoginView.fxml").build();
>> // ...
>> }
>
>
> However, this code gives me errors :
> * first of all, type mismatch and duplicate local variable -> solved by
> leaving out "GridPane". * ".build()" gives the error "The method build
> is indefined for the type FXMLBuilder<Object>"
> * when changing "build()" to "load()", the application finally starts
> up but the widget is empty.
> Any cues as how this code can be made to work ? Is there any other
> example on how to load FXML files in a efx4 application ?
> Just in case : I've not forgotten to link the class MyLoginView to the
> application model.
> Thanks in advance,
>
> Thomas Elskens
Re: Problem loading FXML files [message #1424684 is a reply to message #1424221] Tue, 16 September 2014 09:20 Go to previous message
Thomas Elskens is currently offline Thomas ElskensFriend
Messages: 159
Registered: September 2014
Location: Brussels - Belgium
Senior Member
Now it works just fine. Danke schön for your quick answer !
Previous Topic:How to run unit tests in an e4 + e(fx)clipse project?
Next Topic:Part Toolbar and Part Menu
Goto Forum:
  


Current Time: Mon May 06 17:34:17 GMT 2024

Powered by FUDForum. Page generated in 0.04395 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top