R
R
reus2017-04-21 22:01:42
Java
reus, 2017-04-21 22:01:42

How to change the size ratio of elements in Swing?

For example, I have a main JPanel that contains two more JPanels (top and bottom).
And I want the top to be, for example, 2/3 of the main one, and the bottom 1/3, so that when the window is resized, the sizes of my panels also change?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Alexandrov, 2017-04-21
@reus

Read about layout managers. If you describe everything in code, then look towards GridBagLayout. If you use visual ui editors, then there will most likely be SpringLayout.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question