• Advertisement

Archived

This topic is now archived and is closed to further replies.

[java] problems with fullscreen mode

This topic is 5498 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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 Code:
..... 
 
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.."); 
    } 
..... 
[/CODE] 
 
    

Share this post


Link to post
Share on other sites
Advertisement
it was a stupid, stupid fault.

bounds.width and bounds.height were both 0

Share this post


Link to post
Share on other sites

  • Advertisement