fxml include other fxml files and user defined property












1














Hy,



I have following question.



Is it possible to create a main fxml file and place/include a other fxml file which should have a user defined property.



For example I have : main.fxml and a fan_object.fxml
Then include 3 fan_object.fxml onto the main.fxml. And now i want to define for each fan_object.fxml instance a other address or tooltip text and so on?



is this possible?










share|improve this question




















  • 1




    Welcome to SO. What is your goal ? have afxml menu and switch content inside ?
    – charles Lgn
    Nov 23 at 9:48


















1














Hy,



I have following question.



Is it possible to create a main fxml file and place/include a other fxml file which should have a user defined property.



For example I have : main.fxml and a fan_object.fxml
Then include 3 fan_object.fxml onto the main.fxml. And now i want to define for each fan_object.fxml instance a other address or tooltip text and so on?



is this possible?










share|improve this question




















  • 1




    Welcome to SO. What is your goal ? have afxml menu and switch content inside ?
    – charles Lgn
    Nov 23 at 9:48
















1












1








1







Hy,



I have following question.



Is it possible to create a main fxml file and place/include a other fxml file which should have a user defined property.



For example I have : main.fxml and a fan_object.fxml
Then include 3 fan_object.fxml onto the main.fxml. And now i want to define for each fan_object.fxml instance a other address or tooltip text and so on?



is this possible?










share|improve this question















Hy,



I have following question.



Is it possible to create a main fxml file and place/include a other fxml file which should have a user defined property.



For example I have : main.fxml and a fan_object.fxml
Then include 3 fan_object.fxml onto the main.fxml. And now i want to define for each fan_object.fxml instance a other address or tooltip text and so on?



is this possible?







javafx scenebuilder






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 at 13:55









Calips

62621129




62621129










asked Nov 23 at 9:38









Michael Schmit

61




61








  • 1




    Welcome to SO. What is your goal ? have afxml menu and switch content inside ?
    – charles Lgn
    Nov 23 at 9:48
















  • 1




    Welcome to SO. What is your goal ? have afxml menu and switch content inside ?
    – charles Lgn
    Nov 23 at 9:48










1




1




Welcome to SO. What is your goal ? have afxml menu and switch content inside ?
– charles Lgn
Nov 23 at 9:48






Welcome to SO. What is your goal ? have afxml menu and switch content inside ?
– charles Lgn
Nov 23 at 9:48














1 Answer
1






active

oldest

votes


















3














Check in the documentation : fx:include



What you can do is the following :



If this is your main.fxml



<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox xmlns:fx="http://javafx.com/fxml">
<children>
<fx:include fx:id="fan1" source="fan_object.fxml"/>
<fx:include fx:id="fan2" source="fan_object.fxml"/>
<fx:include fx:id="fan3" source="fan_object.fxml"/>
</children>
</VBox>


In your MainController.java class :



@FXML
private FanController fan1Controller;
@FXML
private FanController fan2Controller;
@FXML
private FanController fan3Controller;


Now in your FanController.java class :



public void setToolTip (String tooltipText){
//You put the tooltip of the object you have in this controller
//for instance
myButton.setTooltip(new Tooltip(tooltipText));
}


Now all you have to do is call :



fan1Controller.setToolTip("Tip : !");


Hope this deals with your question.






share|improve this answer



















  • 1




    @charlesLgn You are right, but since there is no code presented, I thought this is more of "you need more documentation" thing, if you see what I mean. I will edit it gradually though. vague answer for vague question.
    – Calips
    Nov 23 at 10:15








  • 1




    Thanks for your example. I take a long time to get my code work. The problem was i set the fx:id to fan1 and than i wrote @FXML private Fancontroller fan1;. But it should be @FXML private Fancontroller fan1Controller. From my point of view this is not intuitive. Thank you for your support
    – Michael Schmit
    Nov 24 at 17:12










  • @MichaelSchmit No problem :D If you think my answer is good enough, please validate it with a tick :)
    – Calips
    Nov 25 at 14:23











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444046%2ffxml-include-other-fxml-files-and-user-defined-property%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














Check in the documentation : fx:include



What you can do is the following :



If this is your main.fxml



<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox xmlns:fx="http://javafx.com/fxml">
<children>
<fx:include fx:id="fan1" source="fan_object.fxml"/>
<fx:include fx:id="fan2" source="fan_object.fxml"/>
<fx:include fx:id="fan3" source="fan_object.fxml"/>
</children>
</VBox>


In your MainController.java class :



@FXML
private FanController fan1Controller;
@FXML
private FanController fan2Controller;
@FXML
private FanController fan3Controller;


Now in your FanController.java class :



public void setToolTip (String tooltipText){
//You put the tooltip of the object you have in this controller
//for instance
myButton.setTooltip(new Tooltip(tooltipText));
}


Now all you have to do is call :



fan1Controller.setToolTip("Tip : !");


Hope this deals with your question.






share|improve this answer



















  • 1




    @charlesLgn You are right, but since there is no code presented, I thought this is more of "you need more documentation" thing, if you see what I mean. I will edit it gradually though. vague answer for vague question.
    – Calips
    Nov 23 at 10:15








  • 1




    Thanks for your example. I take a long time to get my code work. The problem was i set the fx:id to fan1 and than i wrote @FXML private Fancontroller fan1;. But it should be @FXML private Fancontroller fan1Controller. From my point of view this is not intuitive. Thank you for your support
    – Michael Schmit
    Nov 24 at 17:12










  • @MichaelSchmit No problem :D If you think my answer is good enough, please validate it with a tick :)
    – Calips
    Nov 25 at 14:23
















3














Check in the documentation : fx:include



What you can do is the following :



If this is your main.fxml



<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox xmlns:fx="http://javafx.com/fxml">
<children>
<fx:include fx:id="fan1" source="fan_object.fxml"/>
<fx:include fx:id="fan2" source="fan_object.fxml"/>
<fx:include fx:id="fan3" source="fan_object.fxml"/>
</children>
</VBox>


In your MainController.java class :



@FXML
private FanController fan1Controller;
@FXML
private FanController fan2Controller;
@FXML
private FanController fan3Controller;


Now in your FanController.java class :



public void setToolTip (String tooltipText){
//You put the tooltip of the object you have in this controller
//for instance
myButton.setTooltip(new Tooltip(tooltipText));
}


Now all you have to do is call :



fan1Controller.setToolTip("Tip : !");


Hope this deals with your question.






share|improve this answer



















  • 1




    @charlesLgn You are right, but since there is no code presented, I thought this is more of "you need more documentation" thing, if you see what I mean. I will edit it gradually though. vague answer for vague question.
    – Calips
    Nov 23 at 10:15








  • 1




    Thanks for your example. I take a long time to get my code work. The problem was i set the fx:id to fan1 and than i wrote @FXML private Fancontroller fan1;. But it should be @FXML private Fancontroller fan1Controller. From my point of view this is not intuitive. Thank you for your support
    – Michael Schmit
    Nov 24 at 17:12










  • @MichaelSchmit No problem :D If you think my answer is good enough, please validate it with a tick :)
    – Calips
    Nov 25 at 14:23














3












3








3






Check in the documentation : fx:include



What you can do is the following :



If this is your main.fxml



<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox xmlns:fx="http://javafx.com/fxml">
<children>
<fx:include fx:id="fan1" source="fan_object.fxml"/>
<fx:include fx:id="fan2" source="fan_object.fxml"/>
<fx:include fx:id="fan3" source="fan_object.fxml"/>
</children>
</VBox>


In your MainController.java class :



@FXML
private FanController fan1Controller;
@FXML
private FanController fan2Controller;
@FXML
private FanController fan3Controller;


Now in your FanController.java class :



public void setToolTip (String tooltipText){
//You put the tooltip of the object you have in this controller
//for instance
myButton.setTooltip(new Tooltip(tooltipText));
}


Now all you have to do is call :



fan1Controller.setToolTip("Tip : !");


Hope this deals with your question.






share|improve this answer














Check in the documentation : fx:include



What you can do is the following :



If this is your main.fxml



<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<VBox xmlns:fx="http://javafx.com/fxml">
<children>
<fx:include fx:id="fan1" source="fan_object.fxml"/>
<fx:include fx:id="fan2" source="fan_object.fxml"/>
<fx:include fx:id="fan3" source="fan_object.fxml"/>
</children>
</VBox>


In your MainController.java class :



@FXML
private FanController fan1Controller;
@FXML
private FanController fan2Controller;
@FXML
private FanController fan3Controller;


Now in your FanController.java class :



public void setToolTip (String tooltipText){
//You put the tooltip of the object you have in this controller
//for instance
myButton.setTooltip(new Tooltip(tooltipText));
}


Now all you have to do is call :



fan1Controller.setToolTip("Tip : !");


Hope this deals with your question.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 23 at 10:51

























answered Nov 23 at 10:02









Calips

62621129




62621129








  • 1




    @charlesLgn You are right, but since there is no code presented, I thought this is more of "you need more documentation" thing, if you see what I mean. I will edit it gradually though. vague answer for vague question.
    – Calips
    Nov 23 at 10:15








  • 1




    Thanks for your example. I take a long time to get my code work. The problem was i set the fx:id to fan1 and than i wrote @FXML private Fancontroller fan1;. But it should be @FXML private Fancontroller fan1Controller. From my point of view this is not intuitive. Thank you for your support
    – Michael Schmit
    Nov 24 at 17:12










  • @MichaelSchmit No problem :D If you think my answer is good enough, please validate it with a tick :)
    – Calips
    Nov 25 at 14:23














  • 1




    @charlesLgn You are right, but since there is no code presented, I thought this is more of "you need more documentation" thing, if you see what I mean. I will edit it gradually though. vague answer for vague question.
    – Calips
    Nov 23 at 10:15








  • 1




    Thanks for your example. I take a long time to get my code work. The problem was i set the fx:id to fan1 and than i wrote @FXML private Fancontroller fan1;. But it should be @FXML private Fancontroller fan1Controller. From my point of view this is not intuitive. Thank you for your support
    – Michael Schmit
    Nov 24 at 17:12










  • @MichaelSchmit No problem :D If you think my answer is good enough, please validate it with a tick :)
    – Calips
    Nov 25 at 14:23








1




1




@charlesLgn You are right, but since there is no code presented, I thought this is more of "you need more documentation" thing, if you see what I mean. I will edit it gradually though. vague answer for vague question.
– Calips
Nov 23 at 10:15






@charlesLgn You are right, but since there is no code presented, I thought this is more of "you need more documentation" thing, if you see what I mean. I will edit it gradually though. vague answer for vague question.
– Calips
Nov 23 at 10:15






1




1




Thanks for your example. I take a long time to get my code work. The problem was i set the fx:id to fan1 and than i wrote @FXML private Fancontroller fan1;. But it should be @FXML private Fancontroller fan1Controller. From my point of view this is not intuitive. Thank you for your support
– Michael Schmit
Nov 24 at 17:12




Thanks for your example. I take a long time to get my code work. The problem was i set the fx:id to fan1 and than i wrote @FXML private Fancontroller fan1;. But it should be @FXML private Fancontroller fan1Controller. From my point of view this is not intuitive. Thank you for your support
– Michael Schmit
Nov 24 at 17:12












@MichaelSchmit No problem :D If you think my answer is good enough, please validate it with a tick :)
– Calips
Nov 25 at 14:23




@MichaelSchmit No problem :D If you think my answer is good enough, please validate it with a tick :)
– Calips
Nov 25 at 14:23


















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53444046%2ffxml-include-other-fxml-files-and-user-defined-property%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Contact image not getting when fetch all contact list from iPhone by CNContact

count number of partitions of a set with n elements into k subsets

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks