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