Jump to content
  • Advertisement


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


[java] java fullscreen prob

This topic is 5949 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

Hi, I''m working at fullscreen, i''ve got a class that extends a Canvas, which will be used for showing graphics. I''ve found out that when i put code overriding the paint() method to draw images, the images are drawn. But when i put code to draw images *outside* the paint method, these images are not drawn. I''ve heard the first method is passive rendering, and the second one, active rendering. I''ve also heard that using fullscreen mode i need to use active rendering, because i''ll never know when the paint() method of the canvas is gonna be called. (And of course i want control over the rendering, to draw frames only when it''s needed). How is this done? Should i use another class instead of the canvas? I''ve also put setIgnoreRepaint(true) and used bufferStrategy thanks

Share this post

Link to post
Share on other sites
I would suggest that instead of using canvas you use JPanel instead. Canvas was the 1.1 way of doing what you want to, and while you probably could do it this way if you really wanted to-it doesn''t come highly reccomended.
You are correct about the differences between passive and active rendering, generally speaking, passive rendering is when you need to repaint something due to some input from the user, active rendering is when you (or rather your code) decides something needs to be repainted.
The best thing for you to do is to find a tutorial on the subject-there is one at Sun''s website at:
That will put you on the right track.


Share this post

Link to post
Share on other sites

I''ve found out how to paint correctly:

-Before, i was using a canvas, which was added to the main frame, with a panel (which had a button for exit purposes), then i tried to draw to the canvas while in fullscreen mode, nothing was shown, but...

-Now, i pass the main frame to a subclass, and this subclass uses the frame to draw to the screen, with no components or containers in the middle, and... it works! :D

Although, i would be interested in... "why?", was i doing it the wrong way, when i was using a canvas?(it worked with paint() passive rendering, but not with active rendering) or it is that it must be done drawing to the frame or the window directly?

I would like to know it, thanks

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!