let's say I want to do a program like photoshop or lightroom in java where I work with one image on the left side and I have a menu on the right side with all the options. How could I set the size of the panel where the menu is contained to scale correctly with multiple resolutions?
I was thinking on getting the current system resolution of the system (getScreenResolution()) and then multiply it by some factor like 0.3-0.2 and set that as width but I'm not sure if that works properly with higher resolutions or you would loose too much working space in the menu (I just have a small laptop to try).
I wasn't able to find any question like this, or something easier to work with the dpi in android.
I work with one image on the left side and I have a menu on the right side with all the options.
Just use a proper layout manager and let the layout manager do its job.
For example you can use a BorderLayout
.
Create a panel for your menus and add that panel to the BorderLayout.LINE_END
and the panel will be displayed at its preferred size.
Then create a second panel for the image and add that panel to the BorderLayout.CENTER
. Now this panel will automatically be resized to fill the space as the frame is resized.