B4J Question Error layout

ivanomonti

Expert
Licensed User
Longtime User
B4X:
Erro: java.io.FileNotFoundException: Layout1.fxml

Path: project > Files > Layout1.fxml

debug mode perfect ???

Error in realise ???
 

ivanomonti

Expert
Licensed User
Longtime User
B4X:
Program started.
main._appstart (java line: 61)
java.io.FileNotFoundException: Layout1.fxml
    at anywheresoftware.b4a.objects.streams.File.OpenInput(File.java:180)
    at anywheresoftware.b4j.objects.PaneWrapper.LoadLayout(PaneWrapper.java:136)
    at b4j.example.main._appstart(main.java:61)
    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.BA.raiseEvent(BA.java:84)
    at b4j.example.main.start(main.java:35)
    at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:319)
    at com.sun.javafx.application.PlatformImpl$5.run(PlatformImpl.java:216)
    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.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:76)
    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)
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Are there any warnings in the warnings list above the logs?

For example:
SS-2015-01-12_15.45.35.png
 
Upvote 0

ivanomonti

Expert
Licensed User
Longtime User
I synced the files and tuttoora okay but I still do not know how these errors solve.

the buttons were defined on java fx, and then created with this code, because it gives me error initialize some object ???


B4X:
Sub Process_Globals

    Private fx As JFX
    Private MainForm As Form
    Private FileSelect As String
 
    Private bt1, bt2, bt3, bt4, bt5, bt6 As Button
    Private lb1 As Label
    Private lw As ListView
    Private tx1 As TextArea
    Private et1,et2 As TextField
    Private sl1 As Slider

End Sub

2015-01-12_161046.png


mistero o errore - mystery or error

2015-01-12_161702.png
 
Upvote 0

ivanomonti

Expert
Licensed User
Longtime User
Full code


B4X:
#Region  Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 400
#End Region

Sub Process_Globals

    Private fx As JFX
    Private MainForm As Form
    Private FileSelect As String
   
    Private bt1, bt2, bt3, bt4, bt5, bt6 As Button
    Private lb1 As Label
    Private lw As ListView
    Private tx1 As TextArea
    Private et1,et2 As TextField
    Private sl1 As Slider

End Sub

Sub AppStart (Form1 As Form, Args() As String)
    '
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Title = "Poche parole possono bastare"
    MainForm.Icon = fx.LoadImage(File.DirAssets, "icon.png")
    MainForm.Show
    '
    bt1.Enabled = True
    bt3.Enabled = False
    '
    listfile
    '
End Sub

' read list filex txt
Sub listfile
    lw.Items.Clear
    Dim ls As List = File.ListFiles(File.DirApp)
    For i = 0 To ls.Size-1
        Dim s As String = ls.Get(i)
        Dim value As Matcher = Regex.Matcher(".txt",s)
        Do While value.Find
            If value.Match = ".txt" Then
            lw.Items.Add(s.ToLowerCase)
            End If
        Loop
    Next
End Sub

' save text
Sub bt1_MouseClicked (EventData As MouseEvent)
    Dim msgbox As Msgboxes
    Dim s,ss As String
    s = et2.Text
    ss = tx1.Text
    If s.Length > 0 Then
        Dim title As String = s & ".txt"
        If File.Exists(File.DirApp,title) Then
            Dim dialogresult As Int = msgbox.Show2("Titolo già esistente","Save","Update","Cancel","Exit")
            Select dialogresult
            Case -1
                File.WriteString(File.DirApp,title.ToLowerCase,ss.ToLowerCase)
                listfile
            Case -2
                Return:
            Case -3
                Return:
            End Select
        Else
            File.WriteString(File.DirApp,title,s.ToLowerCase)
            listfile
        End If
    Else
        msgbox.Show("Testo troppo corto per poterlo salvare","Save")
    End If
End Sub

' copy text
Sub bt2_MouseClicked (EventData As MouseEvent)
    Dim s As String
    s = tx1.Text
    fx.Clipboard.SetString(s)
End Sub

' delete files
Sub bt3_MouseClicked (EventData As MouseEvent)
    File.Delete(File.DirApp,FileSelect)
    FileSelect = ""
    bt3.Enabled = False
    listfile
End Sub

' new text
Sub bt4_MouseClicked (EventData As MouseEvent)
    tx1.Text = ""
    FileSelect = ""
    bt3.Enabled = False
    lw.SelectedIndex = -1
End Sub

' info text
Sub bt5_MouseClicked (EventData As MouseEvent)
    tx1.Text = "Simple Edit by ivanomonti" & Chr(10) & "Version 1.0 written Java" & Chr(10) & "For Mac Osx and Windows or Linux" & Chr(10) & "For info developer Italy 3929824007"
    FileSelect = ""
    bt3.Enabled = False
    lw.SelectedIndex = -1
End Sub

' info text
Sub bt6_MouseClicked (EventData As MouseEvent)
    Dim msgbox As Msgboxes
    msgbox.Show("Undefined function","Alert")
End Sub

' count max word
Sub et1_TextChanged (Old As String, New As String)
    '
    Dim value() As String
    value = Regex.Split(Chr(32),tx1.Text)
    lb1.Text = value.Length
    If value.Length > et1.Text Then
        lb1.TextColor = fx.Colors.Red
        tx1.Style = "-fx-text-fill: #FF0000;"
    Else
        lb1.TextColor = fx.Colors.Black
        tx1.Style = "-fx-text-fill: #000000;"
    End If
   
End Sub

' label count
Sub tx1_TextChanged (Old As String, New As String)
    Try
    '
        tx1.Style = "-fx-font-size: " & sl1.value &";"
    '
        Dim value() As String
        value = Regex.Split(Chr(32),tx1.Text)
       
        lb1.Text = value.Length
    '
        If value.Length > et1.Text Then
            lb1.TextColor = fx.Colors.Red
            tx1.Style = "-fx-text-fill: #FF0000;"
        Else
            lb1.TextColor = fx.Colors.Black
            tx1.Style = "-fx-text-fill: #000000;"
        End If
       
        If value.Length > 3 Then
            Dim s As String = value(0) & "-" & value(1) & "-" & value(2)
            et2.Text = s
        End If
       
    Catch
        lb1.TextColor = fx.Colors.Black
        tx1.Style = "-fx-text-fill: #000000;"
    End Try
   
End Sub

' select file txt
Sub lw_SelectedIndexChanged(Index As Int)
    Try
        Dim s As String
        s = File.ReadString(File.DirApp,lw.Items.Get(Index))
        tx1.Text = s
        '
        FileSelect = lw.Items.Get(Index)
        bt3.Enabled = True
    Catch
        Return
    End Try
End Sub

Sub sl1_ValueChange(Value As Double)
    tx1.Style = "-fx-font-size: " & Value &";"
End Sub

if you need the complete project tell me where I have to send
 
Upvote 0

ivanomonti

Expert
Licensed User
Longtime User
saved with the layout name from javafx, but the problem remains
 

Attachments

  • EditorClone.zip
    6.9 KB · Views: 191
Upvote 0
Top