aspose file tools*
The moose likes Applets and the fly likes Applet gives Flickering Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "Applet gives Flickering" Watch "Applet gives Flickering" New topic

Applet gives Flickering

Aayush Patel

Joined: Apr 26, 2001
Posts: 21
i had written in programme using when i run through normail applet then it will gives me flickering...i had used Applet and Panel instead of JPanel and JApplet...If i m using Swing then it will run fine...but gives me problem in applet...and i have to run that programme in i must have to use AWT instead of Swing..So please help me in this regards...
java puneri

Joined: Jun 04, 2001
Posts: 14
If you are using AWT instead of SWING then you have to use
double buffering which avoids flickering.
little bit more:-
1.Draw whatever you wanto on offline Image object.
2.When you are done show that Image object on the applet canvas
PuneGuy !
Aayush Patel

Joined: Apr 26, 2001
Posts: 21
sorry i m not getting your answer..can u explained me in detail ...if u so then its good for me...
java puneri

Joined: Jun 04, 2001
Posts: 14
Following code is for achiving double buffering !
code starts
Image buffer;
Graphics g1;
public void update(Graphics g){

public void paint(Graphics g){
//Draw the flickering code
// Draw completed buffer to g
public void drawExample(){
g1 = buffer3.getGraphics(); /// Offline Image drawing
. /// Carry on drawing all here
.// draw entire stuff that u are drawing in paint method
// u r done here drawing all stuff
Code ends !!!

I tried to explain what I had understood from your post.
If still have problem then feel free to ask !
or better you explain your problem in detail !
sharad goswami
Ranch Hand

Joined: Jan 18, 2001
Posts: 51

overrride update.draw an offline image that is buffer and then copy it.using drawImage method of graphics.

Stop The World I Want To Get Off.
Charlie Boss
Ranch Hand

Joined: May 22, 2001
Posts: 44
i'm having the same flickering problem with my swing applet.. i'm not drawing any shapes ("g.drawLine(), g.drawRect()")etc but i'd like to know how to draw my JComponents (JPanels, JButtons)etc.. thanks

Java Rawks
Shaunak Desai

Joined: Jun 14, 2001
Posts: 7
Hi there,

I am also having flickering problems. I have used swing applets. When I scroll these applets in browser, they flicker like hell. I am still trying to figure out the reason behind this.
Aayush Patel

Joined: Apr 26, 2001
Posts: 21
hi shaunak,
in applet whenever we drawn component it will draw directly on screen..while in swing it will create one canvas (screen)automatically and drawn component on that in awt we are facing flickering problem..and we had solved it through double check it out double buffering
I agree. Here's the link:
subject: Applet gives Flickering
Similar Threads
security exception
odbc question
How to avoid flickering
Swing Application Flickering?
JApplet - Flickering