Sachin Perera
Sachin Perera

Reputation: 93

What is the best way to design the GUI in javafx 2.0?

In javafx 2.0 it is possible to create the layout by using FXML approach or by using normal java code. What is the best way with respect to a well designed set of UIs. In my application there is about 100 sub UIs.

Thanks

Upvotes: 9

Views: 9186

Answers (5)

Dean Chiu
Dean Chiu

Reputation: 1365

Scene builder should be a good starting point to create unique UIs of your application. Considering you have 100s of UIs, I assume that some of their "appearances" should be identical with slightly different functions. You can load the FXML dynamically and assign controller at run time. Which means 1 FXML file can be used with multiple controllers. Which can save you some time while keeping the code dynamic for easier maintenance.

    FXMLLoader loader = new FXMLLoader(getClass().getResource("DBedit.fxml"));
    loader.setController(new DBeditEntityUser());

So, to make use of the same FXML with a different controller.

    FXMLLoader loader = new FXMLLoader(getClass().getResource("DBedit.fxml"));
    loader.setController(new DBeditEntityUserLevel());

Hope this helps.

Upvotes: 1

Eric Martinez
Eric Martinez

Reputation: 414

FXForm2 is a library providing automatic JavaFX 2.0 form generation.

however FXForm2 is not full WYSIWYG GUI design tool.

http://dooapp.github.io/FXForm2/

Upvotes: 1

Sergey Grinev
Sergey Grinev

Reputation: 34478

FXML looks more logical for that purpose. By using FXML

  • you split business logic from view
  • you get option to edit design without recompiling project.
  • you get design as structured xml tree which is much easier to edit comparing to potentially randomly ordered java code
  • with SceneBuider tool you get an option to use visual editor for your fxml files

Upvotes: 7

Glstunna
Glstunna

Reputation: 2069

Get JavaFX Scenebuilder here.

Upvotes: 3

Nasser
Nasser

Reputation: 13131

fyi,

road map for Java fx http://javafx.com/roadmap/ shows that the scene builder will be released around middle of the year. From the above web page:

"JavaFX Scene Builder is a WYSIWYG GUI design tool for the JavaFX platform. It enables designing user interface screens by simply dragging and positioning GUI components from a palette onto a scene.

The tool generates files in FXML format2 that can be used within a project in any IDE such as NetBeans or Eclipse. The JavaFX Scene Builder can be used to create GUI for desktop applications and applets that run in a browser."

Upvotes: 0

Related Questions