B4J Question [Solved] Title form

ivanomonti

Expert
Licensed User
Longtime User
ENGLISH

In the new version of B4J where I have been missing for a long time I can not set the title of the form

it was once MainForm.title="my title"

Today I can't find a way to set the title... some suggestions!!

ITALIANO

Nella nuova versione di B4J dove io manco da molto tempo non riesco a settare il titolo del form

una volta era MainForm.title="my title"

Oggi non trovo il modo per impostare il titolo... qualche suggerimento!!


1677000385214.png
 

JohnJ

Member
Licensed User
Longtime User
ENGLISH

In the new version of B4J where I have been missing for a long time I can not set the title of the form

it was once MainForm.title="my title"

Today I can't find a way to set the title... some suggestions!!

ITALIANO

Nella nuova versione di B4J dove io manco da molto tempo non riesco a settare il titolo del form

una volta era MainForm.title="my title"

Oggi non trovo il modo per impostare il titolo... qualche suggerimento!!


View attachment 139607
In version 9.80 it is like this, don't believe that has changed.




Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
MainForm.Title = "Title"
 
Upvote 0

Roberto Tsolakis

Member
Licensed User
Longtime User
B4X:
Sub AppStart (Form1 As Form, Args() As String)

' Impostazioni FORM / MODULI
    F_Main = Form1
    F_Main.Title = "File Grouper by Roberto Tsolakis"
    F_Main.RootPane.LoadLayout("D_Main")
    F_Main.Show
    
    F_Percorso.Title = "Percorso di lavoro"               <== ERROR
    F_Percorso.SetTitle(Me,"Percorso di lavoro")
    F_Percorso.Initialize("F_Percorso", 800dip, 600dip)
    F_Percorso.RootPane.LoadLayout("D_Percorso")
   
End Sub


ERROR:

WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
Waiting for debugger to connect...
Program started.
Error occurred on line: 27 (Main)
java.lang.NullPointerException
at anywheresoftware.b4j.objects.Form.setTitle(Form.java:202)
at b4j.example.main._appstart(main.java:86)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.start(main.java:38)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:832)


Why ?
 
Upvote 0

behnam_tr

Active Member
Licensed User
Longtime User
B4X:
Sub AppStart (Form1 As Form, Args() As String)

' Impostazioni FORM / MODULI
    F_Main = Form1
    F_Main.Title = "File Grouper by Roberto Tsolakis"
    F_Main.RootPane.LoadLayout("D_Main")
    F_Main.Show
   
    F_Percorso.Title = "Percorso di lavoro"               <== ERROR
    F_Percorso.SetTitle(Me,"Percorso di lavoro")
    F_Percorso.Initialize("F_Percorso", 800dip, 600dip)
    F_Percorso.RootPane.LoadLayout("D_Percorso")
  
End Sub


ERROR:

WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
Waiting for debugger to connect...
Program started.
Error occurred on line: 27 (Main)
java.lang.NullPointerException
at anywheresoftware.b4j.objects.Form.setTitle(Form.java:202)
at b4j.example.main._appstart(main.java:86)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.start(main.java:38)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:832)


Why ?
set title After Initialize a Form
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Why doesn't the title change on the form?
B4A is definitely better at managing forms!
Not true.
Tip: use B4XPages and the code will be identical.

You tried to set the title of an uninitialized form so it threw an exception.

Set the title in D_Percorso layout.

1713073628834.png
 
Upvote 0

Roberto Tsolakis

Member
Licensed User
Longtime User
Thanks Erel,
I was also looking at the application you made called "ThreePagesExample".
I knew I could modify from layout, but I wanted to understand where I was going wrong in not being able to modify the name of the layout programmatically.
sorry for my english
 
Upvote 0
Top