JavaFx: Hello World

In this tutorial we will print the customary "Hello World" to console and the the GUI using JavaFX.



  • First we have to create a new Module (new application)
  • select Maven app






Type in group ID "edu.clc.cit137"
Type in artifact ID "javafx-hello"







Create a NEW Java Class (or File) named "HelloWorld.java"





Analyze the simple GUI in the image below.

Please type all Java code, click on the image to enlarge full screen.



In the second part of the code we have an EVENT handler for the BUTTON.
And layout of the widgets using HBox and VBox.



Finally, notice that package says "helloworld", however we are not in that package. Control click (command 1) on RED underline until options show up, select "Move to package..."



Run the app






As an Amazon Associate I earn from qualifying purchases.

No comments:

Post a Comment

Post Scriptum

The views in this article are mine and do not reflect those of my employer.
I am preparing to cancel the subscription to the e-mail newsletter that sends my articles.
Follow me on:
X.com (Twitter)
LinkedIn
Google Scholar

Popular Recent Posts

Most Popular Articles

apt quotation..