简体   繁体   中英

JavaFX ... what things make my Controller slow?

I am building a JavaFX -Application. I know that it's using reflection, and that reflection might be not so fast as when i would build my UI in the code.

So,

  1. How can I design my controller to keep the overhead, that is caused by reflection as small as I can?
  2. Does the size of the method with/without @FXML -Annotation matter?
  3. Is there any difference, when I call another method without @FXML in my controller-method? Like:
    @FXML
    public void handleButtonClick(){
       doStuff();
    }
    public void doStuff(){
       //implement the logic
    }
  1. And if I do so, should I implement these methods in the controller class, or in another class?

PS I'm sorry for so many questions at once, but i found those specific things nowhere in the internet :(

  1. Keep any processes not related to the UI out of the main thread.

  2. No

  3. No

  4. If it makes sense from a design perspective.

That is no magic button you can click to make your app perform well. Worrying about these type of things at the start of a project will lead to a project that is difficult to manage. Instead, just dive in and don't be afraid to refactor if you think of a better approach or experience problems.

When you do inevitably run into problems don't be afraid to step into the JavaFX code with the debugger. That is the best way to learn about the internals of a framework.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM