954,554 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Buffer method? For dissapearing paint lines

Hey guys,

I've drawn a grid, and I have a label contatining a picture. Whenever I change the location of this label, the grid dissapears until I resize/move the frame.

Any suggestions on best method to buffer these grid lines?

They aren't going to be moving graphics or anything like that so I'm hoping for the most easiest method.

pseudocode
> draw x line
> draw y line
>set bounds of label to x,y

Any ideas appeciated.

StephNicolaou
Posting Whiz in Training
204 posts since Nov 2007
Reputation Points: 77
Solved Threads: 18
 

I assume you are drawing the grid in an overridden paintComponent?
After moving the label you should just call repaint() to let Swing know that the container's paintComponent needs to be called a.s.a.p.

JamesCherrill
Posting Genius
Moderator
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 

Cheers, just needed the repaint() within the paintComponent method!

StephNicolaou
Posting Whiz in Training
204 posts since Nov 2007
Reputation Points: 77
Solved Threads: 18
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: