Is it possible to run GWT, placed in a specific place on the screen and window size?

It's a little annoying that the GWT browser hosted on a Mac always appears in the same place and in the same size (that is, in a small and in the wrong place!). In particular, if you have two 24-inch monitors, it can not be less annoying to always move the browser window and change its size at startup. I know that I can leave it open and restart, but I'm used to cmd + shift + F11 and then cmd-Q to complete the loop, as in other programs. Another reason is that in GWT hosting mode, a memory leak and after a couple (about 20) reboots, I still have to leave.

Does anyone know a way to tell the placement mode application the initial size of the browser frame and possibly its location? If not, I will eventually send the function request to GWT.

+3
source share
2 answers

One thing you can try is to have a separate module class to test the placement mode, which is a subclass of your real module. In the hosted mode version of the module, you may have some JSNI that resizes the window:

public class MyModule implements EntryPoint {
    //...
 }

public class HostedModeMyModule extends MyModule {
    private native void resizeWindow() /*-{
        $wnd.resizeTo(800, 600);
    }-*/;

    public void onModuleLoad() {
        resizeWindow();
        super.onModuleLoad();
    }
 }

You must have two gwt.xml files, of course, one for testing and one for compilation.

This is not the most elegant approach, but all I can think of.

+1
source

, , . (, ) .

0

Source: https://habr.com/ru/post/1712997/


All Articles