JavaFX 8 Quickstart on Eclipse IDE for Ubuntu 14.04 Trusty LTS 32-64bit Linux

January 29th, 2015 by thelinuxevangelist

JavaFX 8 Quick-Start on Eclipse for Ubuntu Linux




The Linux Tutorial Shows You Step-by-Step How-to Getting-Started with JavaFX 8 Hello-World Example on Latest Eclipse Oxygen R IDE for Ubuntu 14.04 Trusty Tahr LTS i386/amd64 Linux Desktop.

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

JavaFX is good to build well-designed programming interfaces enabling developers to combine graphics, animation, and UI controls.

To Getting-Started with JavaFX 8 on Ubuntu an Oracle Java Development Kit 8 Installation is Needed on the System.

JavaFX 8 Quick-Start on Eclipse for Ubuntu 14.04 Trusty LTS - Featured

  1. Open a Command Line Shell Session
    Ctrl+Alt+t
    (Press “Enter” to Execute Commands)

    Getting-Started with JavaFX 8 on Eclipse for Ubuntu Linux - Open Terminal
  2. How-to Install Eclipse for Java Developers on Ubuntu:

    Install Eclipse Java for Ubuntu
  3. Java FX 8 Quick-Start on Eclipse for Ubuntu - efxclipse Plugin Installation
  4. How-to Install Eclipse Java FX Enviroment Plugin:

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

    Ubuntu Java FX 8 Eclipse Quick-Start with Hello-World - Create New Java Project
  6. Name it as HelloWorld

    Ubuntu Java FX 8 Eclipse Quick-Start with Hello-World - Naming

    Then Click on Finish.

  7. Create a New Java Class

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

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

    Java FX 8 Eclipse Quick-Start with Hello-World on Ubuntu Linux - Naming
  9. 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 :)

  10. Save & Run Java FX Hello-World

    Quick-Start with Java FX 8 on Eclipse for Ubuntu Linux - Running Java FX Class
  11. Click on the “Hello World” Button
    to Print “Hellow World” greeting on the Eclipse Console.

Ubuntu Eclipse Java FX 8 Quick-Start with Hello-World - Console Output

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