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:

u75

New Member
Although this is an old thread but I want to indicate a minor mistake in above code under line # 6. Instead of:
B4X:
Array(jo.InitializeStatic
it should be:
B4X:
Array(jform.InitializeStatic

Thanks to Androh for the code. It works
 

androh

Member
Licensed User
Longtime User
Thank you
 
Reactions: u75

byz

Active Member
Licensed User
If you want to display full-screen with the window at the top, without the title bar and taskbar, use the following code
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
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
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…