TS 69 JavaFX Debugger

Debugger

Author: Alexandr Scherbatiy
Version: 1.2
Last update: 04 August 2010
Introduction:
Comments:


Contents


Project

  1. Debug Project
    1. Create a JavaFX Script project.
    2. Press Debug Main Project button
    3. Press Finish Debugger Session button.
    • EXPECTED RESULT: Debugger should start.
    • EXPECTED RESULT: Debugger should stop.


Breakpoints

Set Breakpoints

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
         
var a = 10;
var b = 20.5;
var c = a + b;
  • Set breakpoints (click on the Glyph Gutter in the editor) for a, b and c variables
  • Debug the project (press <Ctrl+F5>).
  • Continue debug the project (press <F5>) for each variable.
    • EXPECTED RESULT: Debugger should stop on each breakpoint.
    • EXPECTED RESULT: Debugger should stop after end of the project.


Conditional Breakpoint

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
         
var a = 10;
var b = 20.5;
var c = a + b;
  • Set breakpoints (click on the Glyph Gutter in the editor) for the c variable
  • Right-click on the breakpoint and select Breakpoint->Properties
  • Select 'Condition' on the _Breakpoint Properties_ dialog
  • Type 'c < 50'
  • Press OK
  • Debug the project (press <Ctrl+F5>).
    • EXPECTED RESULT: Debugger should stop on the breakpoint.
  • Right-click on the breakpoint and select Breakpoint->Properties
  • Select 'Condition' on the _Breakpoint Properties_ dialog
  • Type 'c > 50'
  • Press OK
  • Debug the project (press <Ctrl+F5>).
    • EXPECTED RESULT: Debugger should not stop on the breakpoint.

Add new line before a breakpoint

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
         
var a = 10;
  • Set breakpoints (click on the Glyph Gutter in the editor) to a variable
  • Debug the project (press <Ctrl+F5>).
  • Finish debuger
  • Add a new line before the a variable
// new line 
var a = 10;
  • Debug the project (press <Ctrl+F5>).
    • EXPECTED RESULT: Debugger should stop on the breakpoint.

Step Into

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
function a (){
    println("a");
}

function b(){
    a();
}

b();   
  • Set a breakpoint for the b() call on the last line
  • Debug the project (press <Ctrl+F5>).
  • Press Step Into button (press <F7>) on the toollbar.
    • EXPECTED RESULT: The green line should point to the b function body.


Step Out

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
function a (){
    println("a");
}

function b(){
    a();
}

b();   
  • Set a breakpoint for the b() call on the last line
  • Debug the project (press <Ctrl+F5>).
  • Press Step Into button (press <F7>) on the toollbar.
  • Press Step Out button (press <Ctrl+F7>) on the toollbar.
    • EXPECTED RESULT: The green line should point to the b() call on the last line not the a function body.



Watches

Watches Window

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
var a = 10;
var b = 20.5;
var c = a + b;
print(c);
  • Set breakpoints for print(c); line
  • Debug the project (press <Ctrl+F5>).
  • Go to Watches window.
  • Right-click and select New Watch...
  • Type a + 10 for the watch expression.
  • Right-click and select New Watch...
  • Type c * 2 for the watch expression.
    • EXPECTED RESULT: There should be 20 value for the a + 10 expression.
    • EXPECTED RESULT: There should be 61.0 value for the c * 2 expression.



Variables Window

Variables types

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
         
var i = 3;
var num = 3.0;

var b = true;

var c = "2".charAt(0);


var byte:Byte = 1;
var short:Short = 2;
var long:Long = 3;
var float:Float = 5.0;
var double:Double = 10.0;


var date = 3h;

var void = function():Void{};

var str = "Hello!";

class A{}

var a = A{};

var f = function(a:Number, b:String):Boolean { true };
var seqf = function(a:A[], b:String[]):Boolean[] { [] };



var seq = ["1","2","3" ];
println("");
       
  • Set a breakpoint for last line
  • Debug the project (press <Ctrl+F5>).
  • Go to Variables window.
    • EXPECTED RESULT: Each variable should be shown in the Variables window
    • EXPECTED RESULT: Each variable should have the type and the default value
    • For example: There should be i


Show variable value as toString()

Breakpoints Window

Breakpoints Window

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
         
var a = 10;
var b = 20.5;

var c = a + b;
  		
  • Set breakpoints for a, b and c variables
  • Debug the project (press <Ctrl+F5>).
  • Go to Breakpoints window
    • EXPECTED RESULT: The Breakpoints window should show the set berakpoints


Call Stack Window

Call Stack

  • Create a JavaFX Script project.
  • Copy the code to the Main file:
         
var a = 10;
var b = 20.5;

var c = a + b; 		
  • Set breakpoints for a, b and c variables
  • Debug the project (press <Ctrl+F5>).
  • Go to the Call Stack window
    • EXPECTED RESULT: The current program call stack should be shown.


Loaded Classes Window

Loaded Classes

  • Create a JavaFX Script project.
  • Copy the code to the MyClass JavaFX file:
         
public class MyClass {

}

public function run() {
    println("run...");
    
    
    var myClass = MyClass{};
    
    println(myClass);
} 		
  • Set breakpoints for println(myClass); line
  • Debug the project (press <Ctrl+F5>).
  • Open Loaded Classes window (Window-Debugging->Loaded Classes)
    • EXPECTED RESULT: The 'Loaded Classes window should be shown.
Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo