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 8786415
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:37:15+00:00 2026-06-13T21:37:15+00:00

I want to use Netbeans Java FX with Scene builder for a measurement application.

  • 0

I want to use Netbeans Java FX with Scene builder for a measurement application. I have designed a scene with controls. I can handle the events from the UI-controls within the ‘…Controller.java’.

The ‘controller’ is the standard piece of code that is referenced in the XML file and gets initialized by the system with:

public void initialize(URL url, ResourceBundle rb) { ..

My problem: how do I access my central, persisting, ‘model’ objects from within the controller? Or, to be more exact, from the event handlers created within the controller initialize function.

The ‘model’ object would be created within the application object.

The solution must be trivial, but I have not found a way to

  • either access the Application from the controller
  • or access the controller from within the Application.
    What am I missing?

(the next question would be how to access the tree of panes within the object hierarchy created by screen builder, e.g. for graphics manipulation on output. Since the objects are not created by own code I can not store references to some of them. Ok, they could perhaps be found and referenced by tree-walking, but there must be a better way!)

Thanks for all insights!

  • 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-13T21:37:17+00:00Added an answer on June 13, 2026 at 9:37 pm

    I have used the 2nd approach (access the controller from within the Application) for awhile ago similar to following. In Application class:

    //..
    private FooController fooController;
    private Pane fooPage;
    private Model myModel;
    
    @Override
    public void start(Stage stage) {
        //..
        myModel = new Model();
        getFooController().updateModel(myModel);
        //..
        Button button = new Button("Update model with new one");
        button.setOnAction(new EventHandler<ActionEvent>() {
                @Override
                public void handle(ActionEvent event) {
                    Model myNewModel = new Model();
                    getFooController().updateModel(myNewModel);
                }
        }
        // create scene, add fooPage to it and show.
    }
    
    private FooController getFooController() {
        if (fooController == null) {
           FXMLLoader fxmlLoader = new FXMLLoader();
           fooPage = fxmlLoader.load(getClass().getResource("foo.fxml").openStream());
           fooController = (FooController) fxmlLoader.getController();
        }
        return fooController;
    }
    

    Actually the first and second parts of your question is answered JavaFX 2.0 + FXML. Updating scene values from a different Task to the similar question of yours.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Java project in Netbeans and I want to use some classes
i m new with netbeans platform , i want to use java class's method
I want to use the jetty httpclient (in netbeans) but have the least number
i want use some data from a website with web service. i have a
I am using Java 1.6.0_29, with Ubuntu and Netbeans 7. I want to use
I have developed a WebApp with Java-NetBeans. Now I have a library (List&Label from
I am developing a small application in Java using Netbeans. I use a JFrame
I'm creating a Java Web Applet in NetBeans and I want my final application
I'm trying to use Netbeans to make a web application using facelets. I want
I want use BYTE_ORDER macro in my Xcode project but i can't because i

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.