How-to QuickStart with Java FX 8 Development with Hello-World on Eclipse IDE for Linux Mint

January 29th, 2015 by thelinuxevangelist

Linux Mint Eclipse Java FX 8 QuickStart



The Linux Tutorial Shows You Step-by-Step How-to Getting-Started with Java FX 8 Development on the Eclipse IDE with Hello-World Example for Linux Mint 16-Petra/17-Qiana-LTS/17.1-Rebecca-LTS i386/amd64 Mate/Cinnamon/KDE/Xfce Desktop.

JavaFX is Java’s next-generation graphical user interface (GUI) toolkit that allows developers to rapidly build rich cross-platform applications.

The goal of JavaFX is to be used across many types of devices, such as embedded devices, smartphones, TVs, tablet computers, and desktops.

To Getting-Started with JavaFX 8 on Linux an Oracle JDK 8 Installation is Needed on the System.

Java FX 8 QuickStart on Eclipse for Linux Mint - Featured
  1. How-to Install Eclipse for Java Developers on Linux Mint:

    Install Eclipse Java for Mint
  2. Java FX QuickStart on Eclipse for Linux Mint - efxclipse Plugin Installation
  3. How-to Install Eclipse Java FX Enviroment Plugin:

    Eclipse Java FX Plugin Installation
  4. Create a New Java Project

    Ubuntu Java FX Eclipse QuickStart with Hello-World - Create New Java Project
  5. Name it as HelloWorld

    Ubuntu Java FX Eclipse QuickStart with Hello-World - Naming

    Then Click on Finish.

  6. Create a New Java Class

    Right-Click on src on the Package Explorer >> New >> Class

    Ubuntu Java FX Eclipse QuickStart with Hello-World - Create New Java Class
  7. Name it as helloWorld and Check for main Method Creation

    Java FX Eclipse QuickStart with Hello-World on Linux Mint - Naming
  8. Generate a Java FX Window with Hello-World Button

    Enter this Content on the Created Java Class:

    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.stage.Stage;
    
    public class helloWorld extends Application {
    	
    	public static void main(String[] args) {
    		// TODO Auto-generated method stub
    		Application.launch(args);
    	}
    	
    	@Override
    	public void start(Stage primaryStage) {
    		primaryStage.setTitle("Hello World");
    		Group root = new Group();
    		Scene scene = new Scene(root, 300, 150);
    		Button btn = new Button();
    		btn.setLayoutX(100);
    		btn.setLayoutY(60);
    		btn.setText("Hello World");
    		btn.setOnAction(new EventHandler() {
    			public void handle(ActionEvent event) {
    				System.out.println("Hello World");
    		}
    		});
    	root.getChildren().add(btn);
    	primaryStage.setScene(scene);
    	primaryStage.show(); 
    		
    	}
    
    }
    

    Ctrl+s to Save :)

  9. Save & Run Java FX Hello-World

    QuickStart with Java FX on Linux Mint - Running Java FX Class
  10. Click on the “Hello World” Button
    to Print “Hellow World” greeting on the Eclipse Console.

Ubuntu Java FX QuickStart with Hello-World - Console Output

Share on Tumblr

Tags: , , , , , , , , , , , , , , , , , , , , ,


Comments are disabled