Results 1 to 1 of 1
Thread: BufferStrategy
- 03-13-2010, 02:59 PM #1
Member
- Join Date
- Mar 2010
- Posts
- 2
- Rep Power
- 0
BufferStrategy
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>
Similar Threads
-
BufferStrategy and white rows of pixels
By TobyLobster in forum Java 2DReplies: 2Last Post: 12-29-2008, 01:49 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks