• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 344
  • Last Modified:

Flickering Applet :-How to avoid filickering and painting of graphics with background

I am placing a JTextarea on a Japplet having layout null. Based on the mousemovement iam setting Bounds for JTextarea and displaying.  Whenever iam displaying JTextArea the JApplet container is getting painted with background color of container and iam able to observe flickering on out graphics. How to avoid filickering and painting of graphics with background color which is damaging my foreground graphics.
0
bava_anand
Asked:
bava_anand
  • 6
  • 5
  • 2
  • +2
1 Solution
 
filipecorreiaCommented:
I don't have mutch time to answer so I've got only two words for you:
double buferring.


Try poniting in that direction...




Filipe Correia
0
 
ShanojCommented:
Try mediatracker
0
 
prabhuramCommented:
Hi,

   1. why dont you make everything in a canvas or in a frame??
   
    2.why dont you invoke the paint message in the discrete intervals??
        It'll avoid the flickering of the applet.
           ( i am not sure that its possible to  make the threads in the applet procedure. if is possible, then create the thread that'll invoke the paint
message in the discrete intervals )


Try it.
I hope that it'll work fine.
0
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
bava_anandAuthor Commented:
We used double buffering, i.e we created image and placed on our graphics, still when we are viewing the tooltips we are observing flickeing and painting with the background color.


We also implemented paint method frequently using timer object yet we are able to see flickering when tooltips are displayed.

Shanoj i don't have any idea about mediatracker can u guide reg. that
0
 
ShanojCommented:
U can use the MediaTracker class and add the image to it using addImage method. This will make the mediatracker object to track your graphics image.
0
 
filipecorreiaCommented:
Implemented paint method frequently using a timer isn't a good solution.
You should only use the paint method when you make some change to the foreground image because it may become very slow.

Witch tooltips do you mean? do you have tooltips for the image or are there tooltips for a component near the image?



  Filipe Correia
0
 
bava_anandAuthor Commented:
Filipe Correia,
as u said we are using timer and calling paintmethod frequently .

We are using tooltip and setting its component to my Japplet container and we are moving the tooltip as the mouse moves, when this action is going on we are observing flickering on the background graphics which we have drawn using doublebuffering.

0
 
bava_anandAuthor Commented:
Adjusted points to 250
0
 
bava_anandAuthor Commented:
Filipe Correia,
as u said we are using timer and calling paintmethod frequently .

We are using tooltip and setting its component to my Japplet container and we are moving the tooltip as the mouse moves, when this action is going on we are observing flickering on the background graphics which we have drawn using doublebuffering.

0
 
Sasha_MapaCommented:
Is this thread still alive? Anyway, double buffering should solve your problem. There is no way that you can see when using double buffering. If you would like an example please reject the currently proposed answer.
0
 
Sasha_MapaCommented:
It was supposed to be: "There is no way that you can see flickering when using double buffering correctly".
0
 
Sasha_MapaCommented:
Hmm, strange choice you made there, bava_anand, as MediaTracker has absolutely nothing to do with your problem <sigh>
0
 
bava_anandAuthor Commented:
What a blunder i have done,
iam really  sorry Sasha_Mapa, i have seen your answer and accepted your answer but iam wondering  how it is accepted the other person answer(Shanoj). I really accept my mistake. I have tried double buffering it is working perfectly, i don't have any idea of Media tracker.

Once again sorry for the mistake, i accept DOUBLE BUFFERING is the correct one.
0
 
Sasha_MapaCommented:
You can post a question on the Community support topic area asking them to revert the situation to the previous and distribute the points in any way you want (just please don't accept my comment with a C grade... If you wish I could give you a real answer with an example on double buffering).
To get to the Community Support topic area, go to the bottom of this page and click on the Community Support link.
0
 
bava_anandAuthor Commented:
How can i revert the situation to the previous and distribute the points in any way i want? I can only able to post the question in the community support link. Please clarify Sasha_Mapa.
0
 
Sasha_MapaCommented:
You post ANOTHER question on Community Support asking the folks responsible for this site to look at the situation of this question and specifying how you want to distribute/redistribute the points. One of them (usually a guy named darinw) will handle the situation. The Community Support topic area is being constantly monitored by him.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

  • 6
  • 5
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now