Skip to main content



      Home
Home » Eclipse Projects » e(fx)clipse » Problem loading FXML files
Problem loading FXML files [message #1424135] Mon, 15 September 2014 10:10 Go to next message
Eclipse UserFriend
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 13:08 Go to previous messageGo to next message
Eclipse UserFriend
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 05:20 Go to previous message
Eclipse UserFriend
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: Sun Aug 31 19:03:24 EDT 2025

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

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

Back to the top