Jump to content

View more

Image of the Day

Boxes as reward for our ranking mode. ヾ(☆▽☆)
#indiedev #gamedev #gameart #screenshotsaturday https://t.co/ALF1InmM7K
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

[java] Repaint in Java 2

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
1 reply to this topic

#1 javanerd   Members   

122
Like
Likes
Like

Posted 04 April 2000 - 08:10 AM

I just noticed that in Java 2 the painting doesn't work in a java.awt.Component subclass with the following code:
// Somewhere in the code we get the graphics object
m_componentGraphics.getGraphics();

// Draw the new frontbuffer to the screen
m_componentGraphics.drawImage( m_frontBuffer, 0, 0, null );
 
But for some reason if I make my graphics engine a subclass of java.awt.Canvas everything works again. The above code works just fine in Java 1.1 within a Component subclass. It smells like something has been changed in the AWT's peer system between Java 1.1 and Java 2. Does anyone know what causes this behaviour? Edited by - javanerd on 4/4/00 2:10:40 PM

#2 Jim_Ross   Members   

122
Like
Likes
Like

Posted 05 April 2000 - 02:57 AM

java.awt.Component doesn''t have a drawImage method. If those two lines are your actuall code, then it is simply a matter of doing
Graphics m_componentGraphics = m_component.getGraphics();
The graphics class does not have a getGraphics() methods.

If that is not really your problem, the only thing I can think of is that Canvas'' paint() overrides Component''s paint. There might be a difference there. Also, try java.awt.Component.updateImage() instead of java.awt.Graphics.drawImage(); That might do the trick.




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.