B4J Code Snippet Full Screen Form

For my project I've needed to fullscreen form on Raspian (bellsoft-jdk11.0.11)
I founded a solution here.
Then converted to B4J
B4X:
    MainForm.Resizable=False  
    Dim jform As JavaObject = MainForm
    Dim jStage As JavaObject=jform.GetFieldJO("stage")
    jStage.RunMethod("setMaximized", Array(True))
    jStage.RunMethod("setFullScreen", Array(True))
    jStage.RunMethod("setFullScreenExitKeyCombination", Array(jform.InitializeStatic("javafx.scene.input.KeyCombination").GetField("NO_MATCH")))
    MainForm.AlwaysOnTop=True

Thats all :)
 
Last edited:
Although this is an old thread but I want to indicate a minor mistake in above code under line # 6. Instead of:
Code:
Array(jo.InitializeStatic
it should be:
Code:
Array(jform.InitializeStatic

Thanks to Androh for the code. It works :)
 
Although this is an old thread but I want to indicate a minor mistake in above code under line # 6. Instead of:
Code:
Array(jo.InitializeStatic
it should be:
Code:
Array(jform.InitializeStatic

Thanks to Androh for the code. It works :)
Thank you :)
 
  • Like
Reactions: u75
If you want to display full-screen with the window at the top, without the title bar and taskbar, use the following code
[CODE lang="b4x" title="B4X"] MainForm = Form1

MainForm.SetFormStyle("TRANSPARENT")
Dim jform As JavaObject = MainForm
Dim jStage As JavaObject=jform.GetFieldJO("stage")
jStage.RunMethod("setMaximized", Array(True))
jStage.RunMethod("setAlwaysOnTop", Array(True))
MainForm.Resizable=False

MainForm.Show[/CODE]
The code is left here because I think if anyone needs it can be seen in a post.

and Related information:https://openjfx.io/javadoc/21/javafx.graphics/javafx/stage/Stage.html
 
Back
Top