Bug? FileChooser InitialFileName Exception

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi,

using below FileChooser fc.InitialFileName gives exception in runnable
B4X:
' Select a new file
Sub buttonOpen_Action
    Dim fc As FileChooser
    fc.Initialize
    fc.InitialDirectory = File.DirApp
    fc.InitialFileName = "ronoteritems.txt"        '<-- exception
    fileNotes = fc.ShowOpen(MainForm)
    Log(fileNotes)
End Sub

Thank You
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Works for me. You need to post the stack trace from the logs pane so we can see what the actual exception is. Take a screenshot or right click on the Logs pane to copy to the clipboard.
Pls find the stack trace. Thank You

Exception in runnable
java.lang.RuntimeException: java.lang.NoSuchMethodError: javafx.stage.FileChooser.setInitialFileName(Ljava/lang/String;)V
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:101)
at anywheresoftware.b4a.BA$2.run(BA.java:147)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NoSuchMethodError: javafx.stage.FileChooser.setInitialFileName(Ljava/lang/String;)V
at anywheresoftware.b4j.objects.FileChooserWrapper.setInitialFileName(FileChooserWrapper.java:50)
at b4j.example.main._buttonopen_action(main.java:181)
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:86)
... 9 more
 

agraham

Expert
Licensed User
Longtime User
I can't reproduce that error, it works fine for me although I note that InitialFileName is only displayed in a Save dialog and not an Open dialog.

The error is a MissingMethod error. Make sure you have Java 7 update 6 or later on your system, although if it were an earlier version I wouldn't have thought it would have successfully compiled that code in the first place.
 

rwblinn

Well-Known Member
Licensed User
Longtime User
Upgrading to a newer version of Java should solve this error.


The code is already compiled so the compiler doesn't "touch" it.
Upgraded to JDK1.7.0_45 (from _25) and same for JRE.
The file chooser dialog pops up now, but the filename inputfield remains empty, although
B4X:
fc.InitialFileName = "ronoteritems.txt"
 
Top