i had written in programme using swing..now 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 Browser...so i must have to use AWT instead of Swing..So please help me in this regards...
java puneri
Greenhorn
Joined: Jun 04, 2001
Posts: 14
posted
0
Hi 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 Cheers PuneGuy !
Aayush Patel
Greenhorn
Joined: Apr 26, 2001
Posts: 21
posted
0
hi, sorry i m not getting your answer..can u explained me in detail ...if u so then its good for me...
java puneri
Greenhorn
Joined: Jun 04, 2001
Posts: 14
posted
0
hi Following code is for achiving double buffering ! ---------------------------------------------------------------- code starts Image buffer; Graphics g1; public void update(Graphics g){ paint(g); }
public void paint(Graphics g){ //Draw the flickering code drawExample(); // Draw completed buffer to g g.drawImage(buffer,0,0,this); } public void drawExample(){ buffer = createImage(APPLETWIDTH,APPLETHEIGHT); g1 = buffer3.getGraphics(); /// Offline Image drawing g.setColor(whateverulike); g.drawLine(); g.drawRect(); . /// Carry on drawing all here .// draw entire stuff that u are drawing in paint method . // u r done here drawing all stuff return; } 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 ! Cheers PuneGuy
sharad goswami
Ranch Hand
Joined: Jan 18, 2001
Posts: 51
posted
0
hi!!!
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
posted
0
hi, 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
Greenhorn
Joined: Jun 14, 2001
Posts: 7
posted
0
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
Greenhorn
Joined: Apr 26, 2001
Posts: 21
posted
0
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 screen..so in awt we are facing flickering problem..and we had solved it through double buffering...so check it out double buffering