I am ready too climb the ladder “Learning Embedded Systems”

Arduino UNO

Since its  a lot to do and the learning curve is too very curved(as people say), I am beginning my journey to the embedded world with small and simple steps. I would encourage anyone who wants to join me on the same. I always pondered why I was not able to produce anything during my mini project in embedded electronics while it being a topic close to my heart. I went back to my place and took out the Arduino clone that I bought a few days back and just wrote my first progaram and the anwers to the unknown were unraveled. So I invite you all to this exciting ride along with me. I am also putting up a Youtube channel for the same so as to visually showcase the small works that I do and bring out most of the embedded electronics learning that I have on daily basis. Let the journey begin.

The above mentioned or displayed models are the two models that I would be working on and most of the samples belong to these itself.

Configure Netbeans8 for JavaFX8 applications with Nashorn and JavaScript

Now while I am putting up some samples of JavaFX8 using JavaScript and Nashorn available in JDK8, I would add up a new post in which we would configure a Netbeans8 so as to build a simple JavaFX8 application using JavaScript. So lets get started :-

Prerequisites

  1. You must have JDK8 installed
  2. You must have Netbeans8 installed
  3. Now create a new JavaFX sample application and create a new package called script and add the below mentioned script

Now your Netbeans IDE would look like following:-

Netbeans8 Project Setup
Netbeans8 Project Setup

Now when we look into the Bootstrap.java class. The code actually calls the app.js and helps to run the application. You can have a look at the code below:-

Lets have a look at the code. Here we are injecting the stage which is already available in the start function into the script and then loading and executing the script using eval() function.

Now lets look at the app.js which is a very simple JavaScript file which would be generating the scene and the stage is being reused, as we have injected it from the Bootstrap.java file.

Now you just need to hit the run and check out the application.

TextField
TextField output

So you are up and running with your JavaFX8 app made using JavaScript and Nashorn.

Make JavaFX8 HTMLEditor using JavaScript

HTMLEditor is a rich text editor which comes along with the JavaFX8 and is really rich in feature. This entire editor can easily get integrated and helps us in order to format text or HTML itself. I have just used the editor in order to make a very simple demo and one can easily extend on it whenever required. The sample would appear like the image mentioned below and coding this using JavaScript is pretty easy.

HTMLEditor
HTMLEditor

In order to run the application you can go ahead with the same command i.e

 

Simple TextField Sample using JavaScript

The second sample which we would like to put forward deals with the TextField and is partly inspired by the sample application given in the Oracle Documentation for JavaFX2.2. The sample has two TextField and a Button which when clicked takes the text and prints it below the TextFields. The code for the same is as mentioned below along with the output

TextField
TextField output

You can compile this easily if you have JDK8 installed in your system using

The famous HelloWorld in JavaScript

So as the start of the entire journey says, I would be starting up with very simple application and then build up some complex application using JavaScript, Nashorn and truely leverage the power of JVM. So lets see what Nashorn can do in just  15 lines of code.

HelloWorld
HelloWorld

The only prerequisites is JDK8 must be installed and in order to compile this file you need to type the below mentioned in your Terminal :-

 

A new start to JavaFX using JavaScript & Nashorn

Today while just going through an article at the oracle magazine, my eyes just crossed the JavaScript compiler Nashorn. I was actually thrilled to see the capabilities of Nashorn and wondered what a change it can bring if we can use it effectively and majority of the JavaScript developers would be able to utilize the power of JVM. So from today I am starting up with code samples which would help any individual to code a JavaFX application using JavaScript . Now in order to start, I told this to few people in my circle and few of my friends took serious interest into this. So with without much ado, I would start posting my code samples and cover each and every element I can. May be recreating the entire JavaFX2.2 Documentation using JavaScript .