[java] java fullscreen prob

Started by
1 comment, last by daemion 21 years, 8 months ago
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
Advertisement
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:
http://java.sun.com/docs/books/tutorial/extra/fullscreen/index.html
That will put you on the right track.

JJ.
--
www.javage.net
Hi

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

This topic is closed to new replies.

Advertisement