code: public static void createAndShowGUI(boolean exitOnClose) {
          try {
              for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
                  if ("Nimbus".equals(info.getName())) {
                      UIManager.setLookAndFeel(info.getClassName());
                      break;
                  }
              }
          } catch (Exception ex) {
              try {
                  // If Nimbus is not available, try system look and feel.
                  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
              } catch (Exception e) {
                  System.err.println(e);
              }
          }
  
          //Create and set up the window.
          JFrame frame = new JFrame("Smile Demo");
          frame.setSize(new Dimension(1000, 1000));
          frame.setLocationRelativeTo(null);
  
          if (exitOnClose)
              frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          else
              frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  
          //Add content to the window.
          frame.add(new SmileDemo());
  
          //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.