Index: pjproject/trunk/pjsip-apps/build/swig_java_pjsua2.vcproj
===================================================================
--- pjproject/trunk/pjsip-apps/build/swig_java_pjsua2.vcproj	(revision 5401)
+++ pjproject/trunk/pjsip-apps/build/swig_java_pjsua2.vcproj	(revision 5402)
@@ -358,5 +358,5 @@
 				<Tool
 					Name="VCCustomBuildTool"
-					CommandLine="@echo off&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  - Make sure &apos;swig&apos; and &apos;javac&apos; locations are in your PATH environment vars.&#x0D;&#x0A;@echo  - Make sure Java SDK header file directories&#x0D;&#x0A;@echo    (e.g: C:\Program Files (x86)\Java\jdk1.7.0_79\include and C:\Program Files (x86)\Java\jdk1.7.0_79\include\win32)&#x0D;&#x0A;@echo    are in your MSVC header search path&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;&#x0D;&#x0A;@echo on&#x0D;&#x0A;mkdir $(TargetDir)org\pjsip\pjsua2&#x0D;&#x0A;swig -c++ -java  -package org.pjsip.pjsua2 -I$(SolutionDir)pjsip\include -outdir $(TargetDir)org\pjsip\pjsua2 -o $(TargetDir)pjsua2_wrap.cpp $(InputPath)&#x0D;&#x0A;javac -d $(TargetDir) $(TargetDir)org\pjsip\pjsua2\*.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(InputDir)java\android\src\org\pjsip\pjsua2\app\MyApp.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\test.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample.java&#x0D;&#x0A;&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  After the build completed succesfully, try to run the test app, e.g:&#x0D;&#x0A;@echo  java -cp D:\projects\pjproject\pjsip-apps\src\swig\java\output -Djava.library.path=&quot;D:\projects\pjproject\pjsip-apps\src\swig\java\output&quot; org.pjsip.pjsua2.app.sample&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
+					CommandLine="@echo off&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  - Make sure &apos;swig&apos; and &apos;javac&apos; locations are in your PATH environment vars.&#x0D;&#x0A;@echo  - Make sure Java SDK header file directories&#x0D;&#x0A;@echo    (e.g: C:\Program Files (x86)\Java\jdk1.7.0_79\include and C:\Program Files (x86)\Java\jdk1.7.0_79\include\win32)&#x0D;&#x0A;@echo    are in your MSVC header search path&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;&#x0D;&#x0A;@echo on&#x0D;&#x0A;mkdir $(TargetDir)org\pjsip\pjsua2&#x0D;&#x0A;swig -c++ -java  -package org.pjsip.pjsua2 -I$(SolutionDir)pjsip\include -outdir $(TargetDir)org\pjsip\pjsua2 -o $(TargetDir)pjsua2_wrap.cpp $(InputPath)&#x0D;&#x0A;javac -d $(TargetDir) $(TargetDir)org\pjsip\pjsua2\*.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(InputDir)java\android\src\org\pjsip\pjsua2\app\MyApp.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\test.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample2.java&#x0D;&#x0A;&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  After the build completed succesfully, try to run the test app, e.g:&#x0D;&#x0A;@echo  java -cp D:\projects\pjproject\pjsip-apps\src\swig\java\output -Djava.library.path=&quot;D:\projects\pjproject\pjsip-apps\src\swig\java\output&quot; org.pjsip.pjsua2.app.sample&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
 					Outputs="$(TargetDir)pjsua2_wrap.cpp;$(TargetDir)pjsua2_wrap.h"
 				/>
@@ -367,5 +367,5 @@
 				<Tool
 					Name="VCCustomBuildTool"
-					CommandLine="@echo off&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  - Make sure &apos;swig&apos; and &apos;javac&apos; locations are in your PATH environment vars.&#x0D;&#x0A;@echo  - Make sure Java SDK header file directories&#x0D;&#x0A;@echo    (e.g: C:\Program Files (x86)\Java\jdk1.7.0_79\include and C:\Program Files (x86)\Java\jdk1.7.0_79\include\win32)&#x0D;&#x0A;@echo    are in your MSVC header search path&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;&#x0D;&#x0A;@echo on&#x0D;&#x0A;mkdir $(TargetDir)org\pjsip\pjsua2&#x0D;&#x0A;swig -c++ -java  -package org.pjsip.pjsua2 -I$(SolutionDir)pjsip\include -outdir $(TargetDir)org\pjsip\pjsua2 -o $(TargetDir)pjsua2_wrap.cpp $(InputPath)&#x0D;&#x0A;javac -d $(TargetDir) $(TargetDir)org\pjsip\pjsua2\*.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(InputDir)java\android\src\org\pjsip\pjsua2\app\MyApp.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\test.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample.java&#x0D;&#x0A;&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  After the build completed succesfully, try to run the test app, e.g:&#x0D;&#x0A;@echo  java -cp D:\projects\pjproject\pjsip-apps\src\swig\java\output -Djava.library.path=&quot;D:\projects\pjproject\pjsip-apps\src\swig\java\output&quot; org.pjsip.pjsua2.app.sample&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
+					CommandLine="@echo off&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  - Make sure &apos;swig&apos; and &apos;javac&apos; locations are in your PATH environment vars.&#x0D;&#x0A;@echo  - Make sure Java SDK header file directories&#x0D;&#x0A;@echo    (e.g: C:\Program Files (x86)\Java\jdk1.7.0_79\include and C:\Program Files (x86)\Java\jdk1.7.0_79\include\win32)&#x0D;&#x0A;@echo    are in your MSVC header search path&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;&#x0D;&#x0A;@echo on&#x0D;&#x0A;mkdir $(TargetDir)org\pjsip\pjsua2&#x0D;&#x0A;swig -c++ -java  -package org.pjsip.pjsua2 -I$(SolutionDir)pjsip\include -outdir $(TargetDir)org\pjsip\pjsua2 -o $(TargetDir)pjsua2_wrap.cpp $(InputPath)&#x0D;&#x0A;javac -d $(TargetDir) $(TargetDir)org\pjsip\pjsua2\*.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(InputDir)java\android\src\org\pjsip\pjsua2\app\MyApp.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\test.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample2.java&#x0D;&#x0A;&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  After the build completed succesfully, try to run the test app, e.g:&#x0D;&#x0A;@echo  java -cp D:\projects\pjproject\pjsip-apps\src\swig\java\output -Djava.library.path=&quot;D:\projects\pjproject\pjsip-apps\src\swig\java\output&quot; org.pjsip.pjsua2.app.sample&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
 					Outputs="%(Filename)_wrap.cxx"
 				/>
@@ -376,5 +376,5 @@
 				<Tool
 					Name="VCCustomBuildTool"
-					CommandLine="@echo off&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  - Make sure &apos;swig&apos; and &apos;javac&apos; locations are in your PATH environment vars.&#x0D;&#x0A;@echo  - Make sure Java SDK header file directories&#x0D;&#x0A;@echo    (e.g: C:\Program Files (x86)\Java\jdk1.7.0_79\include and C:\Program Files (x86)\Java\jdk1.7.0_79\include\win32)&#x0D;&#x0A;@echo    are in your MSVC header search path&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;&#x0D;&#x0A;@echo on&#x0D;&#x0A;mkdir $(TargetDir)org\pjsip\pjsua2&#x0D;&#x0A;swig -c++ -java  -package org.pjsip.pjsua2 -I$(SolutionDir)pjsip\include -outdir $(TargetDir)org\pjsip\pjsua2 -o $(TargetDir)pjsua2_wrap.cpp $(InputPath)&#x0D;&#x0A;javac -d $(TargetDir) $(TargetDir)org\pjsip\pjsua2\*.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(InputDir)java\android\src\org\pjsip\pjsua2\app\MyApp.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\test.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample.java&#x0D;&#x0A;&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  After the build completed succesfully, try to run the test app, e.g:&#x0D;&#x0A;@echo  java -cp D:\projects\pjproject\pjsip-apps\src\swig\java\output -Djava.library.path=&quot;D:\projects\pjproject\pjsip-apps\src\swig\java\output&quot; org.pjsip.pjsua2.app.sample&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
+					CommandLine="@echo off&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  - Make sure &apos;swig&apos; and &apos;javac&apos; locations are in your PATH environment vars.&#x0D;&#x0A;@echo  - Make sure Java SDK header file directories&#x0D;&#x0A;@echo    (e.g: C:\Program Files (x86)\Java\jdk1.7.0_79\include and C:\Program Files (x86)\Java\jdk1.7.0_79\include\win32)&#x0D;&#x0A;@echo    are in your MSVC header search path&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;&#x0D;&#x0A;@echo on&#x0D;&#x0A;mkdir $(TargetDir)org\pjsip\pjsua2&#x0D;&#x0A;swig -c++ -java  -package org.pjsip.pjsua2 -I$(SolutionDir)pjsip\include -outdir $(TargetDir)org\pjsip\pjsua2 -o $(TargetDir)pjsua2_wrap.cpp $(InputPath)&#x0D;&#x0A;javac -d $(TargetDir) $(TargetDir)org\pjsip\pjsua2\*.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(InputDir)java\android\src\org\pjsip\pjsua2\app\MyApp.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\test.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample2.java&#x0D;&#x0A;&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  After the build completed succesfully, try to run the test app, e.g:&#x0D;&#x0A;@echo  java -cp D:\projects\pjproject\pjsip-apps\src\swig\java\output -Djava.library.path=&quot;D:\projects\pjproject\pjsip-apps\src\swig\java\output&quot; org.pjsip.pjsua2.app.sample&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
 					Outputs="$(TargetDir)pjsua2_wrap.cpp;$(TargetDir)pjsua2_wrap.h"
 				/>
@@ -385,5 +385,5 @@
 				<Tool
 					Name="VCCustomBuildTool"
-					CommandLine="@echo off&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  - Make sure &apos;swig&apos; and &apos;javac&apos; locations are in your PATH environment vars.&#x0D;&#x0A;@echo  - Make sure Java SDK header file directories&#x0D;&#x0A;@echo    (e.g: C:\Program Files (x86)\Java\jdk1.7.0_79\include and C:\Program Files (x86)\Java\jdk1.7.0_79\include\win32)&#x0D;&#x0A;@echo    are in your MSVC header search path&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;&#x0D;&#x0A;@echo on&#x0D;&#x0A;mkdir $(TargetDir)org\pjsip\pjsua2&#x0D;&#x0A;swig -c++ -java  -package org.pjsip.pjsua2 -I$(SolutionDir)pjsip\include -outdir $(TargetDir)org\pjsip\pjsua2 -o $(TargetDir)pjsua2_wrap.cpp $(InputPath)&#x0D;&#x0A;javac -d $(TargetDir) $(TargetDir)org\pjsip\pjsua2\*.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(InputDir)java\android\src\org\pjsip\pjsua2\app\MyApp.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\test.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample.java&#x0D;&#x0A;&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  After the build completed succesfully, try to run the test app, e.g:&#x0D;&#x0A;@echo  java -cp D:\projects\pjproject\pjsip-apps\src\swig\java\output -Djava.library.path=&quot;D:\projects\pjproject\pjsip-apps\src\swig\java\output&quot; org.pjsip.pjsua2.app.sample&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
+					CommandLine="@echo off&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  - Make sure &apos;swig&apos; and &apos;javac&apos; locations are in your PATH environment vars.&#x0D;&#x0A;@echo  - Make sure Java SDK header file directories&#x0D;&#x0A;@echo    (e.g: C:\Program Files (x86)\Java\jdk1.7.0_79\include and C:\Program Files (x86)\Java\jdk1.7.0_79\include\win32)&#x0D;&#x0A;@echo    are in your MSVC header search path&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;&#x0D;&#x0A;@echo on&#x0D;&#x0A;mkdir $(TargetDir)org\pjsip\pjsua2&#x0D;&#x0A;swig -c++ -java  -package org.pjsip.pjsua2 -I$(SolutionDir)pjsip\include -outdir $(TargetDir)org\pjsip\pjsua2 -o $(TargetDir)pjsua2_wrap.cpp $(InputPath)&#x0D;&#x0A;javac -d $(TargetDir) $(TargetDir)org\pjsip\pjsua2\*.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(InputDir)java\android\src\org\pjsip\pjsua2\app\MyApp.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\test.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample.java&#x0D;&#x0A;javac -d $(TargetDir) -classpath &quot;$(InputDir)java\output&quot; $(TargetDir)..\sample2.java&#x0D;&#x0A;&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo  After the build completed succesfully, try to run the test app, e.g:&#x0D;&#x0A;@echo  java -cp D:\projects\pjproject\pjsip-apps\src\swig\java\output -Djava.library.path=&quot;D:\projects\pjproject\pjsip-apps\src\swig\java\output&quot; org.pjsip.pjsua2.app.sample&#x0D;&#x0A;@echo **************************************************************&#x0D;&#x0A;@echo off&#x0D;&#x0A;"
 					Outputs="$(TargetDir)pjsua2_wrap.cpp;$(TargetDir)pjsua2_wrap.h"
 				/>
Index: pjproject/trunk/pjsip-apps/src/swig/java/Makefile
===================================================================
--- pjproject/trunk/pjsip-apps/src/swig/java/Makefile	(revision 5401)
+++ pjproject/trunk/pjsip-apps/src/swig/java/Makefile	(revision 5402)
@@ -193,4 +193,6 @@
 $(MY_PACKAGE_PATH)/sample.class: sample.java
 	$(MY_JAVAC) -d $(OUT_DIR) -classpath "$(OUT_DIR)" sample.java
+	@# Build javafx sample app
+	@# $(MY_JAVAC) -d $(OUT_DIR) -classpath "$(OUT_DIR)" sample2.java
 
 test:
@@ -204,4 +206,7 @@
 	$(MY_JAVA) -cp "$(OUT_DIR)" -Djava.library.path="$(OUT_DIR)" \
 		org.pjsip.pjsua2.app.sample	
+	@# This is for sample2 app
+	@# $(MY_JAVA) -cp "$(OUT_DIR)" -Djava.library.path="$(OUT_DIR)" \
+	@#	org.pjsip.pjsua2.app.sample2	        
 
 install:
Index: pjproject/trunk/pjsip-apps/src/swig/java/sample2.java
===================================================================
--- pjproject/trunk/pjsip-apps/src/swig/java/sample2.java	(revision 5402)
+++ pjproject/trunk/pjsip-apps/src/swig/java/sample2.java	(revision 5402)
@@ -0,0 +1,167 @@
+/* $Id$ */
+/* 
+ * Copyright (C) 2013 Teluu Inc. (http://www.teluu.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA 
+ */
+ 
+package org.pjsip.pjsua2.app;
+
+import java.io.IOException;
+import org.pjsip.pjsua2.*;
+import org.pjsip.pjsua2.app.*;
+import javafx.application.Application;
+import javafx.event.ActionEvent;
+import javafx.event.EventHandler;
+import javafx.scene.Scene;
+import javafx.scene.layout.StackPane;
+import javafx.stage.Stage;
+import com.sun.javafx.tk.TKStage;
+import java.lang.reflect.Method;
+
+class MyObserver implements MyAppObserver {
+	private static MyCall currentCall = null;
+	
+	@Override
+	public void notifyRegState(pjsip_status_code code, String reason, int expiration) {}
+	
+	@Override
+	public void notifyIncomingCall(MyCall call) {
+		/* Auto answer. */
+		CallOpParam call_param = new CallOpParam();
+		call_param.setStatusCode(pjsip_status_code.PJSIP_SC_OK);
+		try {
+			currentCall = call;
+			currentCall.answer(call_param);
+		} catch (Exception e) {
+			System.out.println(e);
+			return;
+		}	
+	}
+	
+	@Override
+	public void notifyCallMediaState(MyCall call) {
+	}
+
+	public void notifyCallState(MyCall call) {
+		if (currentCall == null || call.getId() != currentCall.getId())
+			return;
+
+		CallInfo ci;
+		try {
+			ci = call.getInfo();
+		} catch (Exception e) {
+			ci = null;
+		}
+		if (ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_DISCONNECTED) {
+			currentCall = null;                        
+		} else if (ci.getState() == pjsip_inv_state.PJSIP_INV_STATE_CONFIRMED) {
+			if (ci.getSetting().getVideoCount() != 0) {
+				System.out.println("Changing video window using " + sample2.hwnd);
+				// Change window
+				VideoWindowHandle vidWH = new VideoWindowHandle();	
+				vidWH.getHandle().setWindow(sample2.hwnd);	    	    
+				try {
+					currentCall.vidWin.setWindow(vidWH);			
+				} catch (Exception e) {
+					System.out.println(e);
+				}		 		
+			}
+		}		
+	}
+
+	@Override
+	public void notifyBuddyState(MyBuddy buddy) {}	
+}
+
+class MyThread extends Thread {
+	private static MyApp app = new MyApp();
+	private static MyAppObserver observer = new MyObserver();
+	private static MyAccount account = null;
+	private static AccountConfig accCfg = null;		     
+	
+	public void run() {
+		try {					
+			app.init(observer, ".", true);
+		} catch (Exception e) {
+			System.out.println(e);
+			app.deinit();
+			System.exit(-1);
+		}                 
+
+		if (app.accList.size() == 0) {
+			accCfg = new AccountConfig();
+			accCfg.setIdUri("sip:localhost");
+			accCfg.getVideoConfig().setAutoTransmitOutgoing(true);
+			accCfg.getVideoConfig().setAutoShowIncoming(true);                        
+			account = app.addAcc(accCfg);                        
+		} else {
+			account = app.accList.get(0);
+			accCfg = account.cfg;
+		}
+
+		try {
+			account.modify(accCfg);
+		} catch (Exception e) {}
+
+		while (!Thread.currentThread().isInterrupted()) {
+			MyApp.ep.libHandleEvents(10);
+			try {
+				Thread.currentThread().sleep(50);
+			} catch (InterruptedException ie) {
+				break;
+			}
+		}    
+                app.deinit();
+	}		
+}
+
+public class sample2 extends Application {
+	public static long hwnd;
+	private static Thread myThread = new MyThread();
+
+	private static long getWindowPointer(Stage stage) {
+		try {
+			TKStage tkStage = stage.impl_getPeer();
+			Method getPlatformWindow = tkStage.getClass().getDeclaredMethod("getPlatformWindow" );
+			getPlatformWindow.setAccessible(true);
+			Object platformWindow = getPlatformWindow.invoke(tkStage);
+			Method getNativeHandle = platformWindow.getClass().getMethod( "getNativeHandle" );
+			getNativeHandle.setAccessible(true);
+			return (long)getNativeHandle.invoke(platformWindow);
+                } catch (Throwable e) {
+			System.err.println("Error getting Window Pointer");
+			return 0;
+                }
+	}
+        
+	@Override
+	public void start(Stage primaryStage) {
+		primaryStage.setTitle("Pjsua2 javafx sample");
+		StackPane root = new StackPane();                
+		primaryStage.setScene(new Scene(root, 300, 250));
+		primaryStage.show();
+		hwnd = getWindowPointer(primaryStage);
+		myThread.start();
+	}          
+	@Override
+	public void stop() throws Exception {
+		myThread.interrupt();
+		myThread.join();
+	}                
+	public static void main(String argv[]) {
+		launch(argv);
+	}        
+}
