public void refreshView() 
    {
        //Get an image, and the graphics of that image.
        bufImage = gc.createCompatibleImage(screenCanvas.getWidth(), screenCanvas.getHeight());
        g2d = bufImage.createGraphics();
        viewRefresher.refreshView(g2d);
        
                //Display the time. Commented out, but you can see how long it takes to
                //render a frame by uncommenting the following line:
                
                //g2d.drawString(""+time, 10, 10);
                
                //Draw the image to the buffer.
                graphics = buffer.getDrawGraphics();
                graphics.drawImage(bufImage, 0, 0, null);

                //I don't know what this is for, but it's important. I
                //got it from sample code online, and still need to figure out
                //what this code's purpose is.
                if(!buffer.contentsLost())
                {
                    buffer.show();
                }
    }