Canvas is not a valid type [message #1411858] |
Sun, 24 August 2014 13:07  |
Eclipse Guest Messages: 93 Registered: February 2013 Location: Vienna |
Member |
|
|
Hi
I can run efxclipse applications and I already tried out several different containers and controls within the fxml file. I create the UI content via InjectingFXMLLoader.create(...). Unfortunately, when adding a simple Canvas to the fxml file, I get the error "javafx.fxml.LoadException: Canvas is not a valid type.".
Is the JavaFx Canvas not yet supported by efxclipse or did I miss something important?
Any ideas?
I am running the standard "all-in-one" eclipse SDK download from the efxclipse homepage (Luna 4.4, Build id: I20140606-1215).
[Updated on: Mon, 25 August 2014 02:30]
|
|
|
|
Re: Canvas is not a valid type [message #1412186 is a reply to message #1412145] |
Mon, 25 August 2014 10:00   |
Eclipse Guest Messages: 93 Registered: February 2013 Location: Vienna |
Member |
|
|
Ok, then this was a misunderstanding from my side but still the JavaFx Canvas is not recognized.
- I downloaded the newest "eclipse SDK 4.4 1.0.0 SNAPSHOT", created a new workspace and a sample
"e4 Media Application": works fine
- I added an additional Part in the Application.e4xmi, created an additional fxml file and assigned a new part class to it
which loads the fxml file via "InjectingFXMLLoader.create(...)": works fine
this is the content of the working fxml:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<BorderPane xmlns:fx="[url]http://javafx.com/fxml/1[/url]" xmlns="[url]http://javafx.com/javafx/8[/url]">
<center>
<Pane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<Button layoutX="74.0" layoutY="14.0" mnemonicParsing="false" text="Button" />
</children>
</Pane>
</center>
</BorderPane>
- then I added a Canvas to the fxml file and on startup a LoadException is thrown("Canvas is not a valid type")
this is the content of the non-working fxml:
<?xml version="1.0" encoding="UTF-8"?>
<?import java.lang.*?>
<?import javafx.scene.canvas.*?>
<?import javafx.scene.layout.*?>
<BorderPane xmlns="[url]http://javafx.com/javafx/8[/url]" xmlns:fx="[url]http://javafx.com/fxml/1[/url]">
<center>
<Pane prefHeight="200.0" prefWidth="200.0" BorderPane.alignment="CENTER">
<children>
<Canvas height="200.0" width="200.0" />
</children>
</Pane>
</center>
</BorderPane>
...and this is the code for loading the fxml
public class MyPart {
@Inject
private MPart part;
private Node focusNode;
@PostConstruct
void init(BorderPane p) {
InjectingFXMLLoader<Object> fxmlLoader = InjectingFXMLLoader.create(part.getContext(), getClass(), "MyPart.fxml");
Node node = null;
try {
node = (Node) fxmlLoader.load();
if(node != null) {
p.setCenter(node);
focusNode = node;
}
} catch (IOException exception) {
exception.printStackTrace();
}
}
}
Any ideas what could be wrong?
best regards
Michael
[Updated on: Mon, 25 August 2014 10:11]
|
|
|
|
Re: Canvas is not a valid type [message #1412201 is a reply to message #1412190] |
Mon, 25 August 2014 10:37  |
Eclipse Guest Messages: 93 Registered: February 2013 Location: Vienna |
Member |
|
|
apparently, the dependency to "javafx.scene.canvas" was the only one missing
from the "javafx.scene" package 
...added it and it works fine now.
have to look a little bit closer in future
thanks for your help
[Updated on: Mon, 25 August 2014 10:41]
|
|
|
Powered by
FUDForum. Page generated in 0.30221 seconds