Maximize Frame

0

I'm doing a game in java, but when I run the Frames I get a small window and I maximize it and it maximizes me, but the idea is to get it out the size it is, I edit in the properties of the Frame and I maximize the size and it does not give me. Is there any other way?

The Frames use them with Layout null to put the images and from there it gives the error ... Thanks if anyone knows how to maximize the frame I would appreciate it very much

    
asked by paola 20.07.2017 в 06:03
source

2 answers

2

If you want to give it a fixed size and not be able to maximize or minimize the frame, you must define it in the constructor of your frame:

setResizable(false); // no puedes maximizar/minimizar la ventana    
setBounds(100, 75, 1214, 637); // defines dimensiones(x,y,ancho,alto) del frame

If you want to put your frame so that it occupies the whole screen and can not redefine the size, place this in the constructor:

setSize( (int) pantalla.getWidth(), (int) pantalla.getHeight());
setLocation( (int) pantalla.getWidth() - getWidth(), 0 );
setResizable(false);
    
answered by 20.07.2017 / 16:29
source
2

In order for the frame to be maximized when viewed, you have to define it in the following way:

nombreDelFrame.setExtendedState(JFrame.MAXIMIZED_BOTH);
    
answered by 20.07.2017 в 16:35