Java Swing vs JavaFX – Simple GUI

This week I started to look at javaFX so I am completely new to the idea of building Java GUI without swing and I must admit I am impressed with what I’ve seen so far.

Java FX has many advantages and many nice new features in this case for example I will show a simple java GUI and how easy it is to shape, size & position your exit button in JavaFX.

Code Snip

final Button btn = new Button();
btn.setPrefSize(300, 50);
btn.setLayoutX(0);
btn.setLayoutY(150);
btn.setAlignment(Pos.CENTER);
btn.setText(“Exit”);
blockquote>
There is one big advantage on java Swing specially for me at the moment is that there are many more examples and help and knowledge available on Swing than there is on javaFX.

Full Java Swing – Simple GUI – simplegui-example-12
Full JavaFX – Simple GUI – simplefxgui-example-12

The book I amd reading and found very helpfull, interresting and easy is the JavaFX 8 (Introduction by Example)

Leave a Reply