Problem with paint
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Rachna_Jotwani
Posted On:   Tuesday, October 23, 2001 12:51 PM

In my application i have a parent JPanel which is like a drawing space. A user can dynamiccaly add other components to this panel (using the drag and drop option). after each add operation i repaint the parent Jpanel so that all the components are visible the old as well as the new ones. this works perfetly fine. then i added a drawing capability to parent Jpanel. now the user can draw lines between the above components. I create these lines using the drawline function on the panels graphics object. The first time i do it its fine. Now when I add a new component to this figure (with components and lines.) I use repaint function which invokes the paint method to add this new    More>>

In my application i have a parent JPanel which is like a drawing space. A user can dynamiccaly add other components to this panel (using the drag and
drop option). after each add operation i repaint the parent Jpanel so that all the components are visible the old as well as the new ones.
this works perfetly fine.

then i added a drawing capability to parent Jpanel. now the user can draw lines between the above components.
I create these lines using the drawline function on the panels graphics object.

The first time i do it its fine.

Now when I add a new component to this figure (with components and lines.) I use repaint function which invokes the paint method to add this new
component to the drawing space
after which i invoke my draw method which is suppose to drawlines
but that doesn't work.

what I think the problem is the draw function finishes it job before the repainting is over and is over written by the paint

can someone suggest a solution for this

   <<Less
About | Sitemap | Contact