#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")
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
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
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
Sub bt2_MouseClicked (EventData As MouseEvent)
Dim s As String
s = tx1.Text
fx.Clipboard.SetString(s)
End Sub
Sub bt3_MouseClicked (EventData As MouseEvent)
File.Delete(File.DirApp,FileSelect)
FileSelect = ""
bt3.Enabled = False
listfile
End Sub
Sub bt4_MouseClicked (EventData As MouseEvent)
tx1.Text = ""
FileSelect = ""
bt3.Enabled = False
lw.SelectedIndex = -1
End Sub
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
Sub bt6_MouseClicked (EventData As MouseEvent)
Dim msgbox As Msgboxes
msgbox.Show("Undefined function","Alert")
End Sub
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
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
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