ºÝºÝߣ

ºÝºÝߣShare a Scribd company logo
Introducere in Daniel Nastase, trainer LEC
Agenda De ce JavaFx ? Bazele limbajului JavaFx (din perspectiva unui developer de Java) Aplicatie construita de la 0 Resurse
Integrare java ¨C backend Portabilitate Suport CSS & Softuri editare grafica vs Java ¨C  PRODUCTIVIATE
Variabile Variabilele nu au tip ! def numeConstanta = 0 var numeVariabila = ¡°text¡± numeVariabila = 90 def numOne : Number = 1.0 def numTwo : Integer = 1
String def nume = ¡®Daniel¡¯;  var s = ¡°Salut {nume}¡±;  def s1 = ¡°acesta este un text¡± def s2 = ¡®acesta este alt text¡¯ Nu mai trebuie comparate folosind metoda equals(String) ! concatenare
Tipul de date duration 5ms; // 5  milsecunde 10s; // 10  secunde 30m; // 30  minute 1h;  // 1  ora
function add(argOne: Integer, argTwo: Integer) : Integer {  result = argOne + argTwo; println("{argOne} + {argTwo} = {result}"); return result;  }   Functii
Sequences  (arrays) def  zile  = ["Mon","Tue","Wed","Thu","Fri"];   def  zileSapt  = [ zile  , ["Sat","Sun"]];   reuniune def  num  = [1..100];   definire interval   def  numMaiMariCa2  = nums[n | n > 2];  conditie var lungime =  sizeof  zile;  aflare lungime   insert "Tue" into  zile ;   adaugare element insert "Thu" before  zile [2];   delete "Sun" from  zile ;   eliminare element delete  zile [0];   delete  zile ;
Sequences  (arrays) def seq1 = [1,2,3,4,5]; def seq2 = [1,2,3,4,5]; println(seq1 == seq2) ;  true def seq1 = [1,2,3,4,5]; def seq2 = [1,3,2,4,5]; println(seq1 == seq2);   false seq[a..b] seq[a..]
Structuri de control if else for  while throw - cath - finally var s = "The answer is {if (answer) "Yes¡° else "No"}"; // s = 'The answer is Yes' ¨C expresii embedded
Replace Triggers  & Bind Replace Triggers var password = ¡° test1 "  on replace  oldValue { println("ALERT!  Parola s-a schimbat !");  println(¡° Val veche : {oldValue}");  println(¡° Val noua : {password}"); }; password = ¡° test2 ";   Bining password = "bar";   var x = 0;  def y = bind x;  x = 1;  println(y); // y este acum 1  x = 47;  println(y); // y este acum 47
¡°Constructorul¡± class  Address {  var street: String;  var city: String;  var state: String;  var zip: String;  }  class  Customer {  var firstName: String;  var lastName: String;  var phoneNum: String;  var address: Address;   } def customer = Customer {  firstName: "John";  lastName: "Doe";  phoneNum: "(408) 555-1212"  address: Address {  street: "1 Main Street";  city: "Santa Clara";  state: "CA"; zip: "95050"; } }
Noi modificatori de acces public private protected defaults public-read?   public-init
Mostenire multipla !!! mixin  class MyNameMixin {  var firstName = "John";  var lastName = "Doe";  function printName(){    println("My name is: {firstName} {lastName}");} } mixin  class MyAddressMixin {  var address = "1 Main Street, Anytown USA";  function printAddress(){  println("My address is: {address}");} } class MyContact extends MyNameMixin, MyAddressMixin { }
Doua metode cu aceasi semnatura ? Initial se verifica daca metoda apelata exista in clasa curenta, iar daca nu exista va fi apelata metoda  primului parinte  din declaratia clasei.   class MyContact extends  MyNameMixin ,  MyAddressMixin { }
Charts
Transformari
javafx.com
learnjavafx.typepad.com
Essential JavaFx
http://java.sun.com/javafx/1.2/docs/api/
google.com  :p

More Related Content

Introducere In Java Jx

  • 1. Introducere in Daniel Nastase, trainer LEC
  • 2. Agenda De ce JavaFx ? Bazele limbajului JavaFx (din perspectiva unui developer de Java) Aplicatie construita de la 0 Resurse
  • 3. Integrare java ¨C backend Portabilitate Suport CSS & Softuri editare grafica vs Java ¨C PRODUCTIVIATE
  • 4. Variabile Variabilele nu au tip ! def numeConstanta = 0 var numeVariabila = ¡°text¡± numeVariabila = 90 def numOne : Number = 1.0 def numTwo : Integer = 1
  • 5. String def nume = ¡®Daniel¡¯; var s = ¡°Salut {nume}¡±; def s1 = ¡°acesta este un text¡± def s2 = ¡®acesta este alt text¡¯ Nu mai trebuie comparate folosind metoda equals(String) ! concatenare
  • 6. Tipul de date duration 5ms; // 5 milsecunde 10s; // 10 secunde 30m; // 30 minute 1h; // 1 ora
  • 7. function add(argOne: Integer, argTwo: Integer) : Integer { result = argOne + argTwo; println("{argOne} + {argTwo} = {result}"); return result; } Functii
  • 8. Sequences (arrays) def zile = ["Mon","Tue","Wed","Thu","Fri"]; def zileSapt = [ zile , ["Sat","Sun"]]; reuniune def num = [1..100]; definire interval def numMaiMariCa2 = nums[n | n > 2]; conditie var lungime = sizeof zile; aflare lungime insert "Tue" into zile ; adaugare element insert "Thu" before zile [2]; delete "Sun" from zile ; eliminare element delete zile [0]; delete zile ;
  • 9. Sequences (arrays) def seq1 = [1,2,3,4,5]; def seq2 = [1,2,3,4,5]; println(seq1 == seq2) ; true def seq1 = [1,2,3,4,5]; def seq2 = [1,3,2,4,5]; println(seq1 == seq2); false seq[a..b] seq[a..]
  • 10. Structuri de control if else for while throw - cath - finally var s = "The answer is {if (answer) "Yes¡° else "No"}"; // s = 'The answer is Yes' ¨C expresii embedded
  • 11. Replace Triggers & Bind Replace Triggers var password = ¡° test1 " on replace oldValue { println("ALERT! Parola s-a schimbat !"); println(¡° Val veche : {oldValue}"); println(¡° Val noua : {password}"); }; password = ¡° test2 "; Bining password = "bar"; var x = 0; def y = bind x; x = 1; println(y); // y este acum 1 x = 47; println(y); // y este acum 47
  • 12. ¡°Constructorul¡± class Address { var street: String; var city: String; var state: String; var zip: String; } class Customer { var firstName: String; var lastName: String; var phoneNum: String; var address: Address; } def customer = Customer { firstName: "John"; lastName: "Doe"; phoneNum: "(408) 555-1212" address: Address { street: "1 Main Street"; city: "Santa Clara"; state: "CA"; zip: "95050"; } }
  • 13. Noi modificatori de acces public private protected defaults public-read? public-init
  • 14. Mostenire multipla !!! mixin class MyNameMixin { var firstName = "John"; var lastName = "Doe"; function printName(){ println("My name is: {firstName} {lastName}");} } mixin class MyAddressMixin { var address = "1 Main Street, Anytown USA"; function printAddress(){ println("My address is: {address}");} } class MyContact extends MyNameMixin, MyAddressMixin { }
  • 15. Doua metode cu aceasi semnatura ? Initial se verifica daca metoda apelata exista in clasa curenta, iar daca nu exista va fi apelata metoda primului parinte din declaratia clasei. class MyContact extends MyNameMixin , MyAddressMixin { }

Editor's Notes

  • #8: Tipul returnat poate fi omis daca este null, nu mai trebuie sa punem void
  • #9: Paranteze patrate in loc de acolade
  • #11: Din ce stiu eu nu exista un alt limbaj de scripting care sa aiba thow ¨C catch implementat
  • #12: Pentru exemplu cu Replace Triggers listenerul se apeleaza de doua ori
  • #13: Va reamintesc ca in aceasta prezentare vom sublinia doar lucrurile care sunt diferite de limbajul Java. De exemplu definirea unei clase se face 90% la fel, mostenirea se face tot folosind extends si asa mai departe. Nu mai exista keyword-ul new