!7 p { JDesktopPane desktop = jDesktopPane(); final JTextField tfInput = jCenteredTextField(); showFrame(northAndCenter(tfInput, desktop)); SwitchDispatcher dispatcher = installInternalFrameSwitcher_v3(desktop); dispatcher.shouldSwitch = func -> bool { isFocusedComponent(tfInput) }; dispatcher.instaSwitch = true; addInternalFrame(desktop, "Test", jTextArea()); addInternalFrame(desktop, "Test 2", jTextArea()); addInternalFrame(desktop, "Test 3", jTextArea()); }