B4J Library JBetterDialogs

Hi Guys, Im pleased, to introduce jBetterDialog v1.0.

The zip include a demo and the library and a text file to translate it in other languages.

It's already translated in 5 languages ( EN, IT, DE, FR, ES ).

Author OpenJFX
Author Marco Jakob
Modified as library for B4J by Giuseppe Salvi


Any comment will be appreciated.
jBetterDialog
Author:
Giuseppe Salvi
Version: 1

  • Methods:
    • Initialize (EventName As String)
      Initialize Object
    • ShowConfirm (message As String, info As String, title As String) As Int
      Show Confirm Dialog
      Yes = -1
      No = -2
      Cancel = -3
      Close Dialog = 0
    • ShowConfirmWithOptions (message As String, info As String, title As String) As Int
      Show Confirm Dialog With Options
      Ok = -1
      No = -2
      Close Dialog = 0
    • ShowError (message As String, info As String, title As String)
      Show Error Dialog
    • ShowError2 (message As String, title As String)
      Show Error Dialog
    • ShowErrorWithException (message As String, info As String, title As String, ex As String)
      Show Error Dialog With Exception
    • ShowErrorWithException2 (message As String, title As String, ex As String)
      Show Error Dialog With Exception
    • ShowInformation (message As String, info As String, title As String)
      Show information dialog
    • ShowInformation2 (message As String, title As String, buttonLabel As String)
      Show Information Dialog
    • ShowInput (message As String, info As String, title As String) As String
      Show Input dialog
    • ShowInputWithChoices (message As String, info As String, title As String, obj() As Object) As Object
      Show Input Dialog With Choices
    • ShowWarning (message As String, info As String, title As String)
      Show Warning Dialog
    • ShowWarning2 (message As String, title As String, buttonLabel As String)
      Show Warning Dialog
    • showLogin As String
      Show Login dialog
    Properties:
    • SetOwner As Form [write only]
      Anchor the Dialogs in the MainForm
 

Attachments

  • jBetterDialogs v1.0.zip
    104.9 KB · Views: 763
  • Dialogs-ScreenShots_02.png
    Dialogs-ScreenShots_02.png
    53.4 KB · Views: 1,769
  • Dialogs-ScreenShots_01.jpg
    Dialogs-ScreenShots_01.jpg
    182.5 KB · Views: 1,529
  • jBetterDialogs v1.1.zip
    105 KB · Views: 843
  • JBetterDialogLibrary_v1.20.zip
    101.1 KB · Views: 1,151
Last edited:

billzhan

Active Member
Licensed User
Longtime User
Hi lonelystar,

Nice work. Any tip on how to choose other languages, rr it's done automatically?

Something go wrong with the demo here,it seems resources are missing. (B4J 1.8)error2_MouseClicked,warning2_MouseClicked,error_e2_MouseClicked,info2_MouseClicked all throw similar error:
B4X:
Program started.
Error occurred on line: 85 (main).
java.lang.IllegalArgumentException: Invalid URL: Invalid URL or resource not found
    at javafx.scene.image.Image.validateUrl(Image.java:990)
    at javafx.scene.image.Image.<init>(Image.java:538)
    at anywheresoftware.b4a.giuseppe.salvi.dialogs.DialogWrapper$DialogsWrapper$Builder.setIconFromResource(DialogWrapper.java:1804)
    at anywheresoftware.b4a.giuseppe.salvi.dialogs.DialogWrapper$DialogsWrapper$Builder.setThrowableIcon(DialogWrapper.java:1819)
    at anywheresoftware.b4a.giuseppe.salvi.dialogs.DialogWrapper$DialogsWrapper.showThrowable(DialogWrapper.java:2017)
    at anywheresoftware.b4a.giuseppe.salvi.dialogs.BetterDialogsWrapper.ShowErrorWithException2(BetterDialogsWrapper.java:85)
    at b4j.example.main._error_e2_mouseclicked(main.java:145)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:558)
    at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:221)
    at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
    at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82)
    at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
    at anywheresoftware.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:59)
    at anywheresoftware.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:1)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
    at javafx.event.Event.fireEvent(Event.java:171)
    at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3100)
    at javafx.scene.Scene$ClickGenerator.access$8600(Scene.java:3038)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3320)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3151)
    at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3106)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2248)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:530)
    at com.sun.glass.ui.View.notifyMouse(View.java:924)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
    at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.IllegalArgumentException: Invalid URL or resource not found
    at javafx.scene.image.Image.validateUrl(Image.java:983)
    ... 50 more


Regards,

bz
 

lonleystar

Well-Known Member
Licensed User
Longtime User
Hi BillZhan, about to use other languge, in to the zip is a text file u have to translate it in your language and upload, about the error i really dont understand why u get error. I tested it so many times also whit some old computer and i dint get any error.
P.S
Did u get the error using the Demo? let me know.
 

billzhan

Active Member
Licensed User
Longtime User
Hi Lonleystar,

The attachment is my translation for Simplified Chinese. (username and password added for login dialog). I still don't know how switch to a specific language (by user preference.

I used the demo for the testing. Tested on XP sp3(32bit Simplified Chinese) +jdk 1.7.0_51 and Ubuntu 12.04LTS +jre 1.7.0_51.

Would you please upload your complied jar of the demo?


Thanks,
bz
 

Attachments

  • To Translate Simplified Chinese.txt
    374 bytes · Views: 356

billzhan

Active Member
Licensed User
Longtime User
Hi Lonleystar,

I checked v1.1, it seems the simplified Chinese are not shown correctly,may be caused by the coding of the file I uploaded. Attached is the file with UTF8(without BOM).

v1.1 is tested on Debian 7.3 32bit, language USA Eng +jdk 1.7.0_51. The demo crashed like the previous one when clicking the Subs end with 2.

The demo crashed when ANY Button is clicked on Win2003 32bit,language Chinese,Java 8 SDK. May be caused by compatibility of Java 8.

Your complied jar is tested, and is the same.

Thanks,
bz
 
Last edited:

BPak

Active Member
Licensed User
Longtime User
On the bottom four buttons I get an error.
Have updated to the version 1.1 and this error is still here.
Ran your jar file and it crashes on those four buttons. Windows 7 system

Program started.
InputDialog Result: null
ConfirmDialog Response: CANCEL
InputDialog Result: null
Error occurred on line: 81 (main).
java.lang.IllegalArgumentException: Invalid URL: Invalid URL or resource not found
at javafx.scene.image.Image.validateUrl(Image.java:990)
at javafx.scene.image.Image.<init>(Image.java:538)
at anywheresoftware.b4a.giuseppe.salvi.dialogs.DialogWrapper$DialogsWrapper$Builder.setIconFromResource(DialogWrapper.java:1773)
at anywheresoftware.b4a.giuseppe.salvi.dialogs.DialogWrapper$DialogsWrapper$Builder.setWarningIcon(DialogWrapper.java:1778)
at anywheresoftware.b4a.giuseppe.salvi.dialogs.DialogWrapper$DialogsWrapper.showWarning(DialogWrapper.java:1927)
at anywheresoftware.b4a.giuseppe.salvi.dialogs.BetterDialogsWrapper.ShowWarning2(BetterDialogsWrapper.java:85)
at b4j.example.main._warning2_mouseclicked(main.java:240)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:563)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:221)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:156)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:93)
at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:82)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:84)
at anywheresoftware.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:59)
at anywheresoftware.b4j.objects.NodeWrapper$1.handle(NodeWrapper.java:1)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
at javafx.event.Event.fireEvent(Event.java:171)
at javafx.scene.Scene$ClickGenerator.postProcess(Scene.java:3100)
at javafx.scene.Scene$ClickGenerator.access$8600(Scene.java:3038)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3320)
at javafx.scene.Scene$MouseHandler.process(Scene.java:3151)
at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3106)
at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563)
at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2248)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)
at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292)
at com.sun.glass.ui.View.handleMouseEvent(View.java:530)
at com.sun.glass.ui.View.notifyMouse(View.java:924)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:17)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:67)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.lang.IllegalArgumentException: Invalid URL or resource not found
at javafx.scene.image.Image.validateUrl(Image.java:983)
... 50 more
 

BPak

Active Member
Licensed User
Longtime User
Warning Dialog 2, Error Dialog 2,
Information Dialog 2, Error Dialog with Exception 2 are the buttons that throw the error.

It appears there is a missing resource. Maybe bitmap for those dialogs.??

BPak
 

BPak

Active Member
Licensed User
Longtime User
Hi
I have the standard recommended installation for B4J as per B4PPC instructions.

Do not have JDK 1.8.0 - maybe that is reason?
 

BPak

Active Member
Licensed User
Longtime User
I have the Java 7-45 installed and it is the 32 bit version.
 

BPak

Active Member
Licensed User
Longtime User
The demo jar did not work any different.

Will get jdk-7u55-windows-i586.exe
 
Last edited:
Top