import javax.swing.*; import java.awt.*; import java.awt.event.*; public class JFrameTest extends JFrame{ public JFrameTest(Boolean focusable) { if (focusable){ setTitle("Focusable"); }else{ setTitle("Non-Focusable"); } getContentPane().add(new JTextArea()); setSize(200,100); setFocusableWindowState(focusable); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setVisible(true); } public static void main(String args[]) { JFrameTest test1 = new JFrameTest(true); test1.setLocation(0,0); JFrameTest test2 = new JFrameTest(true); test2.setLocation(200,0); JFrameTest test3 = new JFrameTest(false); test3.setLocation(400,0); } }