In some case we need to position the window in the center of the screen . The same effect can be achieved by hard coding the center points .But in that case the window position change when the screen resolution changes
This code will position the window in center irrespective of different screen resolutions
public JFrame stack_frame = new JFrame(); stack_frame.setLocationRelativeTo(null);