Original Post
All I'm doing is drawing some boxes onto a Canvas that can be dragged with the mouse. Since it flickers when i move them I wanted to use double buffering. Here's part of the class. When I try to set the number of buffers to anything higher than 1, I get this error when trying to run the program: java.lang.IllegalStateException: Component must have a valid peer Not entirely sure what it means and I couldn't really find anything about it other than the docs said its thrown if the canvas isn't displayable.
public class DisplayCanvas extends Canvas implements MouseInputListener
{
private BufferStrategy buffer;
private ArrayList objects = new ArrayList();
private DisplayObject selectedObject = null;
public DisplayCanvas()
{
this.createBufferStrategy(1);
buffer = this.getBufferStrategy();
this.addMouseListener(this);
this.addMouseMotionListener(this);
}