1. Color

    Defining Colors

    There are several ways to create Color objects in JavaFX. Each of these examples show a different method of defining the color red.

    // RGB value as a range from 0.0 to 1.0
    var color1 = Color{ red:1.0 };  // undefined colors default to 0.0
    var color2 = Color.color(1.0, 0 ,0);
     
    // RGB value as a range from 0 to 255
    var color3 = Color.rgb(255, 0, 0);
    var color4 = Color.web("FF0000");  // Using hex notation (may include a '0x' or '#' prefix)
     
    // HSB hue in degrees [0-360], saturation and brightness in range [0.0-1.0]

  2. Lighting demo

    This interactive demo is designed to simplify the process of choosing lighting variable values in JavaFX. It shows the effect of changing each value and will let you tweak them to get exactly the lighting effect you are looking for. For more information on lighting effects see: Lighting.

  3. Lighting

    Lighting effects in JavaFX create bright areas and shadows on objects producing a more realistic, 3D effect.

  4. Sequence

    JavaFX introduces a new data type called a sequence. A sequence is an unordered list of objects, similar to an array.


    Declaring Sequences

    A sequence is declared as comma delimited list, or range surrounded by square brackets [ ].

    var num1 = [1, 2, 3, 4, 5];
    var num2 = ["one", "two", "three", "four", "five"];

    var num1 = [1..5]   //Inclusive range  [1, 2, 3, 4, 5]
    var num2 = [1..<5]  //Exclusive range  [1, 2, 3, 4]

  5. Scene

    The Scene object is the slate on which all graphical components are drawn or rendered.

  6. Stage

    The Stage object it the highest level container in JavaFX. It can be thought of as being the window in which everything else is contained.

    Some if the most commonly used Stage variable include:

    title The text displayed in the application window's title.
    resizable This determines whether the window is resizable by the user. (Default: true)
    width The width of the window. (See: Setting window size)

Syndicate content