Friday, June 19, 2009

java fx at a glance

The JavaFX Script programming language lets you create modern looking applications with sophisticated graphical user interfaces. It was designed from the ground up to make GUI programming easy.

We will be declaring variables like

def a;
def b;
var ag;

calling the function like

add();
div();

function can be written as

function add(){
statement1 ;
statement 2;
}

passing parameter to the function as

function add(arg1: Integer, arg2: Integer){
statement1 ;
}

function with return statements

function add(arg1: Integer, arg2: Integer) : Integer{
statement1 ;
return result;
}

command line arguments

function add(arg: String[]){

def a = java.lang.Integer.parseInt(arg[0]);
def b = java.lang.Integer.parseInt(arg[1]);

}

Object is created by

Address {
street: "1 Main Street";
city: "Santa Clara";
state: "CA";
zip: "95050";
}


assigning to a variable

def myAddress = Address {
street: "1 Main Street";
city: "Santa Clara";
state: "CA";
zip: "95050";
}

nesting object inside another

def customer = Customer {
firstName: "John";
lastName: "Doe";
phoneNum: "(408) 555-1212";
address: Address {
street: "1 Main Street";
city: "Santa Clara";
state: "CA";
zip: "95050";
}

instance function can be invoked by

customer.printName();
customer.printPhoneNum();
customer.printAddress();

No comments: