import javax.swing.JFrame; public class WindowLocationSample2 { public WindowLocationSample2() { for (int i = 0; i < 5; i++) { JFrame frame = new JFrame("Sample"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setBounds(100, 100, 100, 100); frame.setLocationByPlatform(true); frame.setVisible(true); } } public static void main(String[] args) { new WindowLocationSample2(); } }