FXML and CSS in JavaFX

Started by
1 comment, last by frob 5 years, 6 months ago

Would any readers please explain to me the differences between FXML and CSS? I just want to create a basic GUI in JavaFX.

For example does one work better on linux? Is one easier to learn than the other? What are their benefits and drawbacks?

Advertisement

They are independent.

FXML is a markup language used for JavaFX. Since you are trying to build a GUI in JavaFX you'll probably to use it. FXML describes what UI elements like labels and text boxes should appear on the screen, and where they belong. FXML allow you to change the layout without recompiling the code. You can design the application to manually place the elements in code if you prefer. You can define your dialog boxes and window layouts by hand although it is much faster using IDEs that have tools to let you position your UI elements easily using FXML files. 

CSS is a style tool for web pages. It is often abused in corporate environments because marketers and artists refuse to accept that CSS is often overridden by users and script blockers, and can be modified or completely ignored by web browsers and user.  JavaFX allows you to include styles from CSS so that your application can have a visual style that matches your web pages. Mostly it was added to make marketers happy for consistent branding, and they are a thorn in the side of developers forced to use them.

This topic is closed to new replies.

Advertisement