Hello,

I would like to develop a sprite editor. Therefore I have programmed a software like paint. As you can see on the picture, on the right, there is a canvas with a grid on it. I use a GridBagLayout to manage every widgets inside my window. The canvas is represented by a JLabel which is inside a JLayeredPane. I have set the size of the JPanel with setPreferredSize. It works well with my screen resolution because there is enough space to display the canvas. However on smaller screen, it doesn't show up.
Any idea on how to adapt the canvas based on the GridBagLayout's cell size or Screen Resolution or Window Size ?

Thanks for your help,
Thierry :)

Despritecito.PNG

DespritecitoFail.PNG

This is marked ‘solved’, so can you take a moment to share your solution for the benefit of others?
Thanks

JC