1

How do I set the window size to "windowed fullscreen"?

The best I can do is:

surface.setLocation(0, 0);
surface.setSize(displayWidth, displayHeight);

however it doesn't fit because of the taskbar and setLocation(0, 0) doesn't set the position to exactly the top left corner (it is a little off to the right and bottom)

I am using Windows 10 with Processing 4.0b2. I am also not using the processing application, but using the core jar as a library.

turke1034
  • 68
  • 1
  • 7

1 Answers1

2

There is a fullScreen() function you can use.

In setup() simply replace your size(); call with fullscreen();.

Check out the reference for other uses, for example:

  • fullscreen with the OpenGL P2D renderer (fullScreen(P2D);)
  • fullscreen on the 2nd monitor (fullScreen(2);) only
  • fullscsreen spanning two monitors (fullscreen(SPAN);)
George Profenza
  • 50,687
  • 19
  • 144
  • 218
  • I'm aware of this, but what I'm going for is "windowed fullscreen" where the screen takes up everything except the taskbar and still shows the title bar. – turke1034 Jun 19 '22 at 23:41
  • 1
    I see. I wish I knew a clever way of accessing the title bar dimensions in Processing. If the issue the window appears a bit to the right and bottom, instead of `surface.setLocation(0, 0);` can you get way with a negative offset (e.g. `surface.setLocation(-3,-26);`) ? – George Profenza Jun 20 '22 at 09:40
  • I've fiddle with the numbers and narrowed it down to (-6, -3) but this is still slightly off and I don't know if it will be off or not for other people. – turke1034 Jun 21 '22 at 00:19
  • which renderer do you use in Processing (? default Java AWT(`JAVA2D`, JavaFX (`FX2D`), OpenGL (`P2D`,`P3D`) ? Each has it's specific way of handling windowing. [This example](https://stackoverflow.com/questions/39107750/java-and-processing-3-0-frame-class-deprecated-is-there-an-alternative/55957053#55957053) does the reverse of what you want: gets the position instead of setting it, but it shows how to access the hierarchy of each renderer. Hopefully somewhere up the hierarchy there are methods to measure the title bar height. – George Profenza Jun 21 '22 at 10:42