void updateCgviewSize() {
    cgview.setWidth(getWidth());
    cgview.setHeight(getHeight());
    cgview.setBackboneRadius(Math.min(getWidth(), getHeight()) * 0.35);

    System.out.println("repainting plasmidpanel line 161 " + (count++));
    repaint();
  }
  /**
   * Overridden paint component method. Update the size, then repaint the plasmid
   *
   * @param g graphics object
   */
  public void paintComponent(Graphics g) {

    // super.paintComponent(g);
    System.out.println("paint component called");
    // if((previousWidth == -1 && previousHeight == -1) || (homePanel.getWidth() != previousWidth)
    // || (homePanel.getHeight() != previousHeight)) {
    super.paintComponent(g);
    System.out.println("calling paint component because " + previousWidth + " " + previousHeight);
    setSize(homePanel.getWidth(), homePanel.getHeight());
    cgview.setWidth(getWidth());
    cgview.setHeight(getHeight());
    cgview.setBackboneRadius(Math.min(getWidth(), getHeight()) * 0.28);
    cgview.setTitleFont(new Font("Georgia", Font.PLAIN, 16));
    // updateCgviewSize();
    cgview.draw((Graphics2D) g);
    previousWidth = homePanel.getWidth();
    previousHeight = homePanel.getHeight();
    // }
  }