Hi,
How do I maximize the sketch window? (not fullscreen)
Thanks!
first step would be to enable the window max
void setup() {
surface.setResizable(true);
//fullScreen();
}
after that can try like
boolean Run_Once = true;
void setup() {
surface.setResizable(true);
//fullScreen();
}
void draw() {
if (Run_Once) {
javax.swing.JFrame jframe = (javax.swing.JFrame)((processing.awt.PSurfaceAWT.SmoothCanvas)getSurface().getNative()).getFrame();
Run_Once = false;
jframe.setLocation(0, 0);
jframe.setExtendedState(jframe.getExtendedState() | jframe.MAXIMIZED_BOTH);
}
}
If I use
jframe.setExtendedState(jframe.getExtendedState() | jframe.MAXIMIZED_BOTH);
The window will actually be a bit taller than the normal maximized height and I don’t know how to fix that.
This screenshot is taken from the very top right corner of the screen. As you can see, it is taller than my screen.
Wow, it’s been 6 months! I’m still not able to solve this issue!
Also, in the original post I forgot to mention that the window isn’t even maximized. You can tell from the screenshot that the middle icon is still a rectangle instead of 2.
Any help will be appreciated!
Try going with screen.width and screen.height as the variables for size(). It works on IOS and apparently was once a valid way for processing, but it‘s long ago, so i don‘t know if it‘s still good.
I don’t think this method exists
Indeed, Google led me on the wrong track .
Hello,
Try this:
void settings()
{
size(displayWidth, displayHeight);
}
void setup()
{
}
void draw()
{
background(0);
}
Or::
import java.awt.*;
void settings()
{
Toolkit toolkit=Toolkit.getDefaultToolkit();
int width = toolkit.getScreenSize().width;
int height =toolkit.getScreenSize().height;
println(width, height);
size(width, height);
}
void setup()
{
}
void draw()
{
background(0);
}
References:
https://processing.org/reference/size_.html
https://processing.org/reference/settings_.html
This isn’t exactly what I was looking for. Your code does set the size of the window to be the size of a maximized window, but the window itself isn’t maximized. It still is in a windowed state. You can easily see this by looking at the icons on the top right. When it is actually maximized, the middle icon should show 2 rectangles like so:
I hope you understand what I mean by now. Thanks for the reply though.
@glv yes, i though they were different but on the IOS version it still worked, so i just assumed it to be the same, since i don‘t really use displayWidth with the IDE.
As for @notcatfish2017 , there is no other way to set a window to be maximized available. At least not as far as i know, since that already is the way to maximize a window. (That with .Maximize_Both). Try maximizing it manually, maybe that is just the way this window maximizes… happens to me sometimes, so…
Or you can try to set the position of the sketch to not be 0,0 , but instead 5, 5. Maybe that works out.
I guess the only way to maximize a window is to do so manually.
I don’t know but maybe you can send keycode to the window like Alt-Space and x