Skip to content

anonymous /GameWindow.java
Created

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Screen Tearing - GameWindow.java
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
public class GameWindow extends JFrame {
private JScrollPane viewer;
private GameCanvas canvas;
public static final Dimension SIZE = new Dimension(800, 600);
public GameWindow() {
super();
canvas = new GameCanvas();
viewer = new JScrollPane(canvas);
viewer.setPreferredSize(SIZE);
viewer.remove(viewer.getHorizontalScrollBar());
viewer.remove(viewer.getVerticalScrollBar());
viewer.setWheelScrollingEnabled(false);
getContentPane().add(viewer);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
pack();
setResizable(false);
setPreferredSize(SIZE);
setVisible(true);
canvas.initBufferStrat();
}
public void render() {
canvas.render();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.