Kevin King
Kevin King

Reputation: 75

Resizing a JFrame and all the contents inside

I am making a game, and I am wondering if there is any way that you can resize the frame so that everything inside will also resize with it too?

Upvotes: 2

Views: 1272

Answers (2)

Saher Ahwal
Saher Ahwal

Reputation: 9237

You need to choose the right LayoutManager for you. You can have layouts within layouts by putting JPanels within JPanels.

If you find the Java Swing library annoying to work with like that, then I suggest using Netbeans IDE where you can design visually how your GUI will look like.

Upvotes: 2

Guillaume Polet
Guillaume Polet

Reputation: 47608

That is the job of the LayoutManager. Choose your LayoutManager carfully so that it arranges your components properly. For example, if you use a BorderLayout, the center component will be stretched to take all the space not occupied by NORTH-SOUTH or WEST-EAST.

Upvotes: 5

Related Questions