try this:
public class FullCanvas extends Canvas {
int WIDTH=1024;
int HEIGHT=768;
int BUFFERS =2;
BufferStrategy mystrategy;
…
public FullCanvas() {
JFrame f = new JFrame(“Test”);
JPanel backPanel = (JPanel) f.getContentPane();
setBounds(0, 0, WIDTH, HEIGHT);
backPanel.setPreferredSize(new Dimension(WIDTH, HEIGHT));
backPanel.setLayout(null);
// add components
backPanel.add(this);
f.setBounds(0, 0, WIDTH, HEIGHT);
GraphicsEnvironment gren = GraphicsEnvironment.getLocalGraphicsEnvironment();
GraphicsDevice grd = gren.getDefaultScreenDevice();
f.setUndecorated(true);
f.setIgnoreRepaint(true);
f.setResizable(false);
grd.setFullScreenWindow(f);
DisplayMode dm = new DisplayMode(WIDTH, HEIGHT, 32, DisplayMode.REFRESH_RATE_UNKNOWN);
try {
grd.setDisplayMode(dm);
}
catch (IllegalArgumentException e) {
System.out.println("Error");
}
f.createBufferStrategy(BUFFERS);
try { //
Thread.sleep(1000);
}
catch (InterruptedException ex) {}
mystrategy= getBufferStrategy();
this.createBufferStrategy(BUFFERS);
mystrategy= getBufferStrategy();
this.requestFocus();
this.setIgnoreRepaint(true);
f.setVisible(true);
}
…
loop …
rendering all compontents
…
}
it should works!