B4J Tutorial Getting Started Examples

Erel

Administrator
Staff member
Licensed User
This package includes several simple examples to help developers get start with B4J.

The following examples are included:
  • Hello World - One line example that prints Hello World.
  • Guess My Number - The computer chooses a number. You need to guess the number.
  • Three Pages - Example of an app with several forms. There are two main forms (login and the user form) and a font picker that is implemented as a class.
    The app structure is similar to the structure of B4i apps.
  • Text Files - Save and load the program state.
  • Bouncing Smiley - Uses Canvas and Timer to create a bouncing ball.
  • Dynamic Controls - Creates a grid of 100 buttons.
  • Anchors - A multi-pane layout with anchors and designer script.
  • Sorting Algorithms - Implementation of the following sorting algorithms: bubble sort, quick sort, binary tree, merge sort and selection sort.
You can download these examples here: www.b4x.com/b4j/files/Examples.zip
 
Last edited:

KingKing

Member
Licensed User
SOLVED!!
I change my java path to 64bit JDK. it solve this problem. Initially i was pointing to 32bit JDK when running the source.

Thanks a lot. Please ignore my post.


Hi,

I using B4J V4.00 now.
I run the Bouncing Smileys source from the above example and hit a few error as below.
Can somebody please help me. I not very good with Java. I have tick jCore(v3.71),jFX(V4.0) and jControlsFX(V1.30) library when running the source.


java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at sun.launcher.LauncherHelper$FXHelper.main(LauncherHelper.java:767)
Caused by: java.lang.NullPointerException
at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:358)
at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:303)
... 5 more
java.lang.ExceptionInInitializerError
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:344)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$148(LauncherImpl.java:327)
at com.sun.javafx.application.LauncherImpl$$Lambda$43/15096457.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$166(PlatformImpl.java:323)
at com.sun.javafx.application.PlatformImpl$$Lambda$45/11567059.run(Unknown Source)
at com.sun.javafx.application.PlatformImpl.lambda$null$164(PlatformImpl.java:292)
at com.sun.javafx.application.PlatformImpl$$Lambda$47/19306968.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$165(PlatformImpl.java:291)
at com.sun.javafx.application.PlatformImpl$$Lambda$46/30452001.run(Unknown Source)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$141(WinApplication.java:102)
at com.sun.glass.ui.win.WinApplication$$Lambda$37/2075313.run(Unknown Source)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: javafx/scene/control/Dialog
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:114)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:90)
at b4j.example.main.<clinit>(main.java:17)
... 16 more
Caused by: java.lang.NoClassDefFoundError: javafx/scene/control/Dialog
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:260)
at anywheresoftware.b4a.shell.Shell.getCorrectClassName(Shell.java:499)
at anywheresoftware.b4a.shell.Shell.createObject(Shell.java:486)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:243)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
... 18 more
Caused by: java.lang.ClassNotFoundException: javafx.scene.control.Dialog
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
... 29 more
 
Last edited:
Top