dcsimg
Flickering on layered components containing text
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Andrew_Hayes
Posted On:   Wednesday, June 20, 2001 04:17 AM

I'm creating an applet that has to have layered Components. I have an ImageComponent and a TextComponent (2 classes that extend Component). In the applet init() I set up the background using the ImageComponent and in the paint use the setBounds on it. I then have an event that causes a TextComponent to draw over part of the background but this causes flicker due to paint() being repeatedly called(I've overridden the update() method). The flicker isn't there if I add the text component to the applet at the same time as the background is added. Any ideas why this happens?

Re: Flickering on layered components containing text

Posted By:   Finlay_McWalter  
Posted On:   Wednesday, June 20, 2001 09:45 PM

Well, before we get to the specifics of your question, can I ask you to clarify a couple of things:

  1. What "ImageComponent" do you mean - the only one I know of is in Java3D - and that certainly isn't a subclass of java.awt.Component. Are you really using java3d, or are you just trying to draw a regular image?
  2. I'm very surprised that you're using java.awt.TextComponent directly - it's almost universal that one uses one or other of its subclasses (TextArea and TextField). Which are you using, or are you using something else?


It seems very unwise to be calling setBounds on a control in a paint method - you should only be painting stuff in a paint method. Instead you should position both components in the init method, and then leave them in that same position.
About | Sitemap | Contact