Using println to debug JavaFX

Most of the developers that started programming in the 20th century, before IDEs were broadly used, are familiar with debugging using println statements. While I highly recommend that one uses NetBeans or Eclipse to develop JavaFX RIA applications, I believe certain people will still want to employ old techniques to debug their code.

Here is an example on how to use println in a JavaFX application to print environment variables.

There are a couple of tricks that you may have to be aware of. 

  • You can't use println while you initialize your code (between lines 18 & 34)
  • println will send the output to the console
  • If you want to print onto your UI artifact, you could employ the javafx.scene.text.Text  object
  • Printing environment variables may yield different results depending on your configuration. For instance, using the default - desktop app configuration will give you a different result than when you deploy the app to a mobile emulator
Comments:

Post a Comment:
Comments are closed for this entry.
About

octav

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today