Custom Components

104 views
Skip to first unread message

Hoby

unread,
Jul 13, 2014, 6:18:20 AM7/13/14
to dataf...@googlegroups.com
Hi,

Is it possible to use fx:root tag in fxml. I use fx:root tag to create custom components.

Thanks
Hoby

Hendrik Ebbers

unread,
Jul 14, 2014, 3:09:15 PM7/14/14
to dataf...@googlegroups.com
Hi,
can you explain this with a small example? I don't exactly know what you mean.

Hoby

unread,
Jul 14, 2014, 4:46:46 PM7/14/14
to dataf...@googlegroups.com
Here is an example to create and use a custom component 

test.fxml

<fx:root type="javafx.scene.layout.StackPane">
<children>
        <Label  text="Name" />
<TextField fx:id="nameTextField" />
        </children>
</fx:root>

The Java Presenter

public class TestPane extends StackPane implements Initializable {
@FXML TextField nameTextField;
public Test() {
FxmlLoader.load(this.getClass().getResource("test.fxml"));
}
(...)
}

And I can use the new component TestPane 

test-use.fxml
<fx:root type="javafx.scene.layout.StackPane">
(...)
      <TestPane fx:id="myTestPane" />
(...)
</fx:root>


Hendrik Ebbers

unread,
Jul 16, 2014, 4:14:33 PM7/16/14
to dataf...@googlegroups.com
Hi,
you want to define a page in a flow as a custom component? Or do you want to add a custom control that is defined by an additional vxml with fx:root tag in a datafx managed view?

Hoby

unread,
Jul 18, 2014, 5:56:57 PM7/18/14
to dataf...@googlegroups.com
Hi,
Thanks for your response.
I wanted to add a custom control that is defined by an additional vxml with fx:root tag in a datafx managed view but I did it otherwise. I used <fx:include> tag. Now I have an other problem with nested controllers.
How can I access include controller in main controller as shown here

Hendrik Ebbers

unread,
Jul 23, 2014, 3:32:49 AM7/23/14
to dataf...@googlegroups.com
Hi,

I never tried this :)
I will check this and look what we can do to support nested controllers.
Message has been deleted

Codeur monsieur

unread,
Aug 23, 2016, 2:40:22 PM8/23/16
to DataFX
Hi,

I have the same problem with nested controllers,
Have you find a solution ?
Reply all
Reply to author
Forward
0 new messages