S
S
Stavr Strelov2020-03-06 09:06:06
JavaScript
Stavr Strelov, 2020-03-06 09:06:06

Error displaying GIF animation in Java game! How to fix?

I am writing a Java game where I combine graphical objects (pictures, gif-animations, etc.) and GUI objects (frames, buttons, labels, etc.). I display graphical objects using the DrawPanel class, which inherits the JPanel class and overrides its paintComponent(Graphics g) method: I display this graphical panel on the screen and write the code for arranging pictures and animations in that method. But, as soon as any GIF animation starts to play, then all GUI objects - buttons, inscriptions, begin to "wink", and the more animations are played, the more they pulsate! How to fix? Tell! Thanks in advance :)
PS: If you need more information, write about it!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Sokolov, 2019-07-23
@nickname_null

Write not with a dot, but something like this: See accessing object properties .

G
GavriKos, 2020-03-06
@IAmNoob

The most correct thing for the game is not to use gif-animation at all. Animate for example a sprite sheet. And use engines where all such basic problems have already been solved.
Well, writing in pure Java and Draw is generally tin and evil. At least do double buffering - draw to a picture in memory, and then stretch this picture to full screen in one pass. It will already be better.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question