<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    迷途書童

    敏感、勤學(xué)、多思
    隨筆 - 77, 文章 - 4, 評論 - 86, 引用 - 0
    數(shù)據(jù)加載中……

    JavaFX腳本編程語言參考--第一章 概覽

    This chapter provides an overview of the JavaFX™ Script programming language. At a high level, this chapter describes the programming language's main features, saving detailed coverage of specific constructs for subsequent chapters. This book is intended for designers and developers of rich Internet client applications and elements, that run in web pages, as Java™ Web Start software, or as traditional desktop applications. Its content assumes the reader is familiar with either the JavaScript or Java™ programming language, or both. While this document does not define a formal language specification, it can be considered a complete reference for all currently supported language features.

    本章提供了JavaFx腳本編程語言的一個概覽。本章概述了這門編程語言的主要特性,后續(xù)章節(jié)將會詳細介紹這些特性的細節(jié)。本書適用于副Internet客戶端應(yīng)用的設(shè)計者和開發(fā)者。這些應(yīng)用可以作為Java Web Start軟件運行在網(wǎng)頁中或者作為傳統(tǒng)的桌面應(yīng)用。本書假定讀者熟悉了javascript或java編程語言或者兩者都熟悉。但是本書并不是正式的語言規(guī)范,可僅僅做為當前JavaFx支持的語言特性的一個完整的參考。


    The JavaFX Script programming language has the following distinctions:

    JavaFX腳本編程語言有如下的語言特色:

    • Uses a declarative syntax for specifying Graphical User Interface (GUI) components, enabling a developer's code to closely match the actual layout of the GUI.
    • 可使用聲明式的語法編寫圖形界面組件,使得開發(fā)者的代碼非常接近于GUI的實際布局。
    • Uses declarative data binding and incremental evaluation, enabling easy creation and configuration of individual components. Application data and GUI components are automatically synchronized.
    • 使用聲明式的數(shù)據(jù)綁定和incremental evaluation(不知道如何翻譯), 使得創(chuàng)建和配置組件變得簡單。應(yīng)用數(shù)據(jù)和GUI組件將自動同步。
    • Is statically typed, having most of the same code structuring, reuse, and encapsulation features that enable creating and maintaining very large programs in the Java programming language.
    • 它是一門靜態(tài)類型的、絕大部分代碼結(jié)構(gòu)、復(fù)用和封裝特性跟Java編程語言一樣,可用來創(chuàng)建和維護大型應(yīng)用。
    • Works with all major IDEs, including the NetBeans IDE, the reference implementation IDE for software development with the Java programming language.
    • 支持主流IDE,包括NetBeans IDE,NetBeans IDE是使用Java編程語言進行軟件開發(fā)的IDE參考實現(xiàn)。
    • Is capable of supporting GUIs of any size or complexity.
    • 能夠支持容易大小和復(fù)雜度的GUI。
    • Makes it easier to use Swing.
    • 它使Swing編程變得更容易

    The following sections present a quick tour of the JavaFX Script programming language. These sections provide a general introduction to its core syntax and capabilities, comparing and contrasting to the Java programming language where appropriate. Each topic is then covered in greater detail in subsequent chapters.

    接下來的小節(jié)是JavaFX腳本編程語言的一個快速指南,介紹了JavaFx的關(guān)鍵語法和能力,并且比較了它跟java編程語言之間的差異,每個主題將在后續(xù)的章節(jié)中詳細的介紹。

    Scripts

    In the JavaFX Script programming language, a "script" is one or more declarations or expressions. Evaluating the script evaluates the declarations or expressions, in order:

    在JavaFx中,“script”是一個以上的聲明活表達式。執(zhí)行腳本就是順序執(zhí)行腳本中的聲明或表達式:

    var ten : Integer = 10;
    java.lang.System.out.println("Twice {ten} is {2 * ten}.");

    This prints out:

    上面的語句會打印出:

    Twice 10 is 20.

    Unlike an application written in the Java programming language, a script need not contain any class definitions or functions.

    不想用java寫的應(yīng)用,腳本不需要包含class定義或者函數(shù)。

    Classes

    Class definitions share many similarities with the Java programming language, but some differences are notable. State, for example, is information stored in attributes, not fields. Behavior is exposed through functions, not methods. The following example defines a simple Rectangle class that demonstrates the basic syntax of each.

    class Rectangle {

    attribute width: Integer;
    attribute height: Integer;

    function grow(): Void {
    grow(1);
    }

    function grow(amount: Integer): Void {
    width += amount;
    height += amount;
    }

    }

    The JavaFX Script programming language supports multiple inheritance, making it possible to inherit from more than one class.

    Classes are covered in detail in Chapter 2

    Attributes and Functions are covered in detail in Chapter 3

    Objects

    Object literals provide a simple syntax for class instantiation. The following code creates a single instance of the Rectangle class defined previously, initializing its width and heightattributes to 100. (Note that new is not needed.)

    Rectangle {

    width: 100
    height: 100

    }

    To store a reference to this object, use the var keyword:

    var myRect = Rectangle {

    width: 100
    height: 100
    }

    Objects are covered in detail in Chapter 2 .

    Variables and basic data types are covered in detail in Chapter 4

    Expressions and Operators

    Like other programming languages, the JavaFX Script programming language supports expressions and operators.

    Chapter 5 discusses the expressions and operators available in the JavaFX Script programming language.

    Sequences

    sequence holds an ordered list of objects. This is roughly analogous to Java programming language arrays. Both hold multiple values and are accessed by index starting at 0.

    var week = ["Monday","Tuesday","Wednesday","Thursday",
    "Friday","Saturday","Sunday"];
    var mon = week[0];
    var wed = week[2];
    var fri = week[4];

    Sequence slices are also supported:

    var week = ["Monday","Tuesday","Wednesday","Thursday",
    "Friday","Saturday","Sunday"];
    var weekdays = week[0..4]; // first slice
    var weekend = week[5..6]; // second slice

    Chapter 6 covers the basics of declaring sequences, while Chapter 7 focuses on using sequences.

    Data Binding

    Data binding provides a simple syntax for synchronizing the state of multiple objects. When two objects are bound to each other, the second object's value automatically changes whenever the first object is updated. A common use of data binding is to keep GUI components synchronized with their underlying data.

    import javafx.application.Frame;
    import javafx.application.Stage;
    import javafx.scene.text.Text;

    var myString = "Hello World!";

    Frame {
    width: 50
    height: 50
    visible: true
    stage: Stage {
    content: Text {
    content: bind myString
    }
    }
    }

    // If some other part of code changes myString
    // then the GUI's text will automatically change
    // as well.

    Data Binding is covered in detail in Chapter 8 .

    Triggers

    Triggers are blocks of code that run when certain conditions are true. For example, you may want to be alerted if an attribute's value has been set to something that is inappropriate. The following example shows the basic trigger syntax:

    import java.lang.System;

    ReplaceDemo {

    mySensitiveData: "Will anyone notice?"

    }

    class ReplaceDemo {
    attribute mySensitiveData: String
    on replace {
    System.out.println("I noticed a change!");
    };

    // application-specific safeguarding code would go here
    }

    Triggers are covered in detail in Chapter 9 .

    posted on 2008-12-04 00:06 迷途書童 閱讀(1409) 評論(0)  編輯  收藏 所屬分類: 隨感java應(yīng)用

    主站蜘蛛池模板: 三年片免费高清版| 老司机在线免费视频| 亚洲蜜芽在线精品一区| 国产一卡2卡3卡4卡无卡免费视频| 亚洲日本VA午夜在线电影| 毛茸茸bbw亚洲人| 日本三级2019在线观看免费| 免费国产在线精品一区| 亚洲第一成年男人的天堂| 无码国产精品久久一区免费| 一级视频免费观看| 亚洲最大的黄色网| 国产日产亚洲系列| 在线jyzzjyzz免费视频| 免费国产成人α片| 亚洲AV成人片无码网站| 亚洲黄色在线电影| 国产AV无码专区亚洲AWWW| 成人毛片免费网站| 无码成A毛片免费| 乱人伦中文视频在线观看免费| 亚洲欧洲日产专区| 国产日韩亚洲大尺度高清| 大学生a级毛片免费观看| 18女人水真多免费高清毛片| 四虎国产精品成人免费久久 | 美丽的姑娘免费观看在线播放 | 2020久久精品亚洲热综合一本| 亚洲综合图色40p| 免费A级毛片无码久久版| 黄色片在线免费观看| 免费精品99久久国产综合精品| 国产偷国产偷亚洲高清人| 亚洲另类小说图片| 亚洲天天做日日做天天看| 久久精品亚洲乱码伦伦中文| 四虎影视在线永久免费观看| 69成人免费视频无码专区| 亚洲人成免费电影| 欧洲精品99毛片免费高清观看| 中文字幕免费在线视频|