I have to display dot shaped status viewer, these dots will be displayed in a JPanel.
I am searching a way to make it possible that the number of row and columns are computed to make the best use of the space available in the panel.
The number of dots is not defined, but once the panel is displayed the number of dots will not be changed (the number of dots is set in the constructor of the panel).
The bounding box of the dot will be square. And the size of a dot might not exceed a specified size (like 20 pixels) but might shrink if needed.
I don't know if the explanation is good enough. Sorry.
Example for a near square panel size :
If stretched horizontally :
If stretched (to the max) vertically :
Ideally, the dots could shrink :