Hello. I'm trying to learn multi buffering. I want to draw a image and after it's fully drawn display it on the frame. I've tried to code an example but i can't get it to work.

<code>
public class MainClass extends JFrame {

BufferStrategy myStrategy;
Graphics g;

public MainClass() {
super("myFrame");
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setSize(300, 200);
setVisible(true);
createBufferStrategy(1);
myStrategy = getBufferStrategy();
g = myStrategy.getDrawGraphics();
g.drawLine(0, 0, WIDTH, HEIGHT);
myStrategy.show();

}

public static void main(String[] args) {
new MainClass();
}
}
</code>