code: public static void createAndShowGUI(DevicesAppState devicesAppState) {
          //Create and set up the window.
          JFrame frame = new JFrame("CardLayoutDemo");
          frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
          frame.addWindowListener(new WindowAdapter() {
              @Override
              public void windowClosing(java.awt.event.WindowEvent windowEvent) {
                  windowEvent.getWindow().setVisible(false);
                  windowEvent.getWindow().removeAll();
              }
          });
          //Create and set up the content pane.
          EventLauncherPanel demo = new EventLauncherPanel(devicesAppState);
          demo.addComponentToPane(frame.getContentPane());
  
          //Display the window.
          frame.pack();
          frame.setVisible(true);
      }
docs: Create the GUI and show it. For thread safety, this method should be
  invoked from the event dispatch thread.