I have a JPanel that is used to draw the menu for my game and a JFrame that it is added to, I have to add the menu to the middle of the frame so that it will look just as good on a higher resolution as on a lower. I have tried frame.add(menu, BorderLayout.CENTER)
and menu.setLocation(windowW / 2, windowH / 2)
but none of these options work. What is the easiest way to accomplish this on?
Position a JComponent at the center of a JFrame
use GridBaglayout without override GridBagConstraints, or BoxLayout then JComponent will be placed into center and isn't resizable with container