code: private void initCanvas() {
          GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
          if (ge.isHeadless()) {
              setPreferredSize(new Dimension(1600,1200));
  
          }
  
          setLayout(new BorderLayout());
          
          canvas = new MathCanvas();
          add(canvas, BorderLayout.CENTER);
  
          initContextMenauAndToolBar();
          
          // set a new dismiss delay to a really big value, default is 4 sec.
          //ToolTipManager.sharedInstance().setDismissDelay(Integer.MAX_VALUE);
      }
docs: Initialize the canvas.