This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes JavaFX and the fly likes create custom component in javaFX Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JavaFX
Bookmark "create custom component in javaFX" Watch "create custom component in javaFX" New topic
Author

create custom component in javaFX

Liviu Dorneanu
Greenhorn

Joined: May 29, 2012
Posts: 2
Hi there!

I'm new at JavaFX, i'm just starting to learn it and I runned into a problem.
I need to create a custom component in JavaFX (using fxml).
Long story short: I have a application for witch I will have a "part" that will be common for most of the "scenes" ("pages"). This part should contain a menu, a logo, some labels, 2-3 buttons, etc., and I should be able to populate some of the labels based on some data. This is why I thought that I better create a custom component and use it on all my pages (scenes). The problem is that I did not found information about creating custom components (I don't need a custom control, a button, label or something like this..., I need a custom component) over the internet.
Could you please tell me if this is possible? I mean is these a way to create custom components using JavaFX?
Could this component act as a controller (set properties, get values ... )?
Can you help me with some documentation?

Thank you in advance!
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4530
    
    5

Please BeForthrightWhenCrossPostingToOtherSites
http://forums.codeguru.com/showthread.php?p=2069190


luck, db
There are no new questions, but there may be new answers.
Liviu Dorneanu
Greenhorn

Joined: May 29, 2012
Posts: 2
Yep ... sorry about that ... I did not know the "Be Forthright When Cross Posting To Other Sites" rule ... I have posted this question a few days ago on only one forum, and because I did not got an answer ... I thought it would be better to post on a few more.

I still don't have an answer!

Thank you!
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4530
    
    5

You don't really need a custom component (and component is an old AWT concept anyways; FX doesn't have components). All you need is a method that returns any suitable Parent subclass populated with the requisite Nodes.

Could this component act as a controller (set properties, get values ... )?

The real question is not could it, but should it? And only you have sufficient knowledge of the design to answer that.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: create custom component in javaFX