desktopScrollPane = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);
desktopScrollPane = new LWScrollPane();
  public void run() {    gridbag = new GridBagLayout();    vncContainer.setLayout(gridbag);    GridBagConstraints gbc = new GridBagConstraints();    gbc.gridwidth = GridBagConstraints.REMAINDER;    gbc.anchor = GridBagConstraints.NORTHWEST;    if (showControls) {      buttonPanel = new ButtonPanel(this);      buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));      gridbag.setConstraints(buttonPanel, gbc);      vncContainer.add(buttonPanel);    }    if (inSeparateFrame) {      vncFrame.pack();      vncFrame.show();    } else {      validate();    }    try {      if (inAnApplet) {        url = new URL(getCodeBase(), sessionURL);      } else {        url = new URL(sessionURL);      }      rfb = new RfbProto(url);      vc = new VncCanvas(this);      gbc.weightx = 1.0;      gbc.weighty = 1.0;      // Create a panel which itself is resizeable and can hold      // non-resizeable VncCanvas component at the top left corner.      Panel canvasPanel = new Panel();      canvasPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));      canvasPanel.add(vc);      // Create a ScrollPane which will hold a panel with VncCanvas      // inside.      desktopScrollPane = new ScrollPane(ScrollPane.SCROLLBARS_AS_NEEDED);      gbc.fill = GridBagConstraints.BOTH;      gridbag.setConstraints(canvasPanel, gbc);      desktopScrollPane.add(canvasPanel);      // Now add the scroll bar to the container.      if (inSeparateFrame) {        gridbag.setConstraints(desktopScrollPane, gbc);        vncFrame.add(desktopScrollPane);        vncFrame.setTitle(rfb.desktopName);        vncFrame.pack();        vc.resizeDesktopFrame();      } else {        // Size the scroll pane to display size.        desktopScrollPane.setSize(dispW, dispH);        // Just add the VncCanvas component to the Applet.        gbc.fill = GridBagConstraints.NONE;        gridbag.setConstraints(desktopScrollPane, gbc);        add(desktopScrollPane);        validate();        vc.resizeEmbeddedApplet();      }      while (!isQuitting) {        try {          setPaused(!autoPlay);          rfb.fbs.setSpeed(playbackSpeed);          if (initialTimeOffset > rfb.fbs.getTimeOffset())            setPos(initialTimeOffset); // don't seek backwards here          vc.processNormalProtocol();        } catch (EOFException e) {          if (e.getMessage() != null && e.getMessage().equals("[REWIND]")) {            // A special type of EOFException allowing us to seek backwards.            initialTimeOffset = rfb.fbs.getSeekOffset();            autoPlay = !rfb.fbs.isPaused();          } else {            // Return to the beginning after the playback is finished.            initialTimeOffset = 0;            autoPlay = false;          }          rfb.newSession(url);          vc.updateFramebufferSize();        } catch (NullPointerException e) {          // catching this causes a hang with 1.4.1 JVM's under Win32 IE          throw e;        }      }    } catch (FileNotFoundException e) {      fatalError(e.toString());    } catch (Exception e) {      e.printStackTrace();      fatalError(e.toString());    }  }