logo
24.2
search
No matching documents found.
list
search
No matching documents found.
logo

Application is not fullscreen after start

Expected Behavior

Application starts fullscreen.

Actual Behavior

Application starts in a window and user must click maximize to go fullscreen.

Solution

Swing

To start your app in Fullscreen use:

frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setUndecorated(true);  
This will take the height and width from the div

Netbeans

Netbeans app, create 2 classes to remove the windows decoration:

public class Clazz extends ModuleInstall {

    public void restore() {
        WindowManager.getDefault().getMainWindow().setExtendedState(Frame.MAXIMIZED_BOTH);
        WindowManager.getDefault().getMainWindow().setUndecorated(true); 
    }

}
@OnShowing
public class Fullscreen implements Runnable {

    public void run() {
        WindowManager.getDefault().getMainWindow().setSize(Integer.parseInt(System.getProperty(webswing.screenWidth)),Integer.parseInt(System.getProperty(webswing.screenHeight))); 
        WindowManager.getDefault().getMainWindow().setExtendedState(Frame.MAXIMIZED_BOTH);
    }

}

JavaFX

public class JavaFXApp extends Application {
    public void start(Stage stage) throws Exception {
        stage.setMinHeight(400);
        stage.setMinWidth(600);
        stage.setMaximized(true);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}