Why does this code don’t work properly.
The screen always flips between een with screen with a green rectangle and my windows desktop with a green rectangle
tankx
.....
Rectangle bounds = mainFrame.getBounds();
try { System.out.println("1..");
gd.setFullScreenWindow(mainFrame);
System.out.println("2..");
mainFrame.createBufferStrategy(2);
BufferStrategy bufferStrategy = mainFrame.getBufferStrategy();
for(int i=0;i<10;i++)
{ Graphics g = bufferStrategy.getDrawGraphics();
g.setColor(Color.black);
g.fillRect(0,0,bounds.width, bounds.height);
g.setColor(Color.green);
g.fillRect(i,i,i+30, i+30);
bufferStrategy.show();
g.dispose();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {}
}
System.out.println("4..");
}
finally { gd.setFullScreenWindow(null);
System.out.println("3..");
}
.....