2
I’m having a problem, I’m creating a Jframe and I want it to open maximized. I’m using the following code:
frame.setExtendedState(Frame.MAXIMIZED_BOTH);
frame.setLocationRelativeTo(null);
The size of Jframe is maximized, but the maximize button is still available, so if I click it, it increases the screen a little bit more.
I want to open it really maximized with the size restore button available. Does anyone know what’s wrong with the code? Or how to do it? Thanks.
The frame object is of a Jframe class?
– Ingrid Farabulini
I took the test and it worked normally. You are doing this before or after setar setVisible?
– user28595
It’s a Jframe yes. And I’m doing after the setVisible. I could not find a plausible explanation for not working, because in another class I use the same code and maximize right.
– João Neto
Try not to set the setExtendedState directly after setvisible.
– user28595
That’s how I’m doing it. Right after.
– João Neto
Opa, I tried right after the setLocation and it worked!
– João Neto