Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8339187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T04:49:02+00:00 2026-06-09T04:49:02+00:00

I’m struggling to create a dynamic view generation utility for javafx. I’ve a handful

  • 0

I’m struggling to create a dynamic view generation utility for javafx. I’ve a handful of Classes that have ObjectProperty’s or StringProperty’s I’d like to create a ComboBox for each property and bind directly the combo selected value to the Class property by name if possible. Is there some helper or method in any of the javafx.beans.binding that would allow me to specify an Object and a String name and retrieve the property. Or to just retrieve a list of properties. I have a method now that takes the string and matches it to the property by name but it requires I have a case for each property on the object, which on an object with 20+ properties is a lot of duplicate code.

I guess to specify I’m looking for javafx.bean.property as a return type.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T04:49:03+00:00Added an answer on June 9, 2026 at 4:49 am

    You can always use Java Reflection.

    Getting a list of properties

    for (Method method : Node.class.getMethods()) {
        String name = method.getName();
        if (name.endsWith("Property")) {
            Type returnType = method.getReturnType();
            String propName = name.replace("Property", "");
            System.out.println(propName + " : " + returnType);
        }
    }
    

    Here is reflective method for binding and example:

    public class ReflectiveBind extends Application {
        /**
         * Reflection call for code like
         * slider1.valueProperty().bindBidirectional(slider2.valueProperty());
         *
         * @param bindee Node which you want to be changed by binding
         * @param propertyName name of the property, e.g. width
         * @param bindTarget Node which you want to be updated by binding
         */
        private static void bind(Object bindee, String propertyName, Object bindTarget) throws Exception {
            // here we get slider1.valueProperty()
            Method methodForBindee = bindee.getClass().getMethod(propertyName + "Property", (Class[]) null);
            Object bindableObj = methodForBindee.invoke(bindee);
    
            // here we get slider2.valueProperty()
            Method methodForBindTarget = bindTarget.getClass().getMethod(propertyName + "Property", (Class[]) null);
            Object bindTargetObj = methodForBindTarget.invoke(bindTarget);
    
            // here we call bindBidirectional: slider1.valueProperty().bindBidirectional(slider2.valueProperty())
            Method bindMethod = bindableObj.getClass().getMethod("bindBidirectional", Property.class);
            bindMethod.invoke(bindableObj, bindTargetObj);
        }
    
        @Override
        public void start(Stage stage) {
    
            Slider slider1 = new Slider();
            Slider slider2 = new Slider();
    
            VBox root = new VBox(20);
            root.getChildren().addAll(slider1, slider2);
    
            stage.setScene(new Scene(root, 200, 100));
            stage.show();
    
            try {
                //same call as slider1.valueProperty().bindBidirectional(slider2.valueProperty());
                bind(slider1, "value", slider2);
            } catch (Exception ex) {
                ex.printStackTrace();
            }
        }
    
        public static void main(String[] args) { launch(); }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I've got a string that has curly quotes in it. I'd like to replace
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have an MVC Razor view @{ ViewBag.Title = Index; var c = (char)146;
I have a view passing on information from a database: def serve_article(request, id): served_article
I'm trying to create an if statement in PHP that prevents a single post
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.