I’m currently programming a Java App where I want to only allow some window sizes for the window. As Example I want that the user can resize the window (JFrame) to 200/300, 350/400 and 400,450. Now if the user resizes the window, it should be only accepted if the window matches the possible sizes.
It would be cool if the user could see in realtime if the window size is accepted or not. (eg: window size would stick at the possible sizes while resizing)
an easy fix can be to disable manual resizing, and give a menu or something similar that gives the user a choice on the size of the window he wants, pretty much just like screen resolution in games..
Another solution which may be a little more complicated, is that you make an event on mouse release after the window has been resized, you check the new size and you ’round’ it to the closest of your prefered sizes.