We're a community of 1.1M IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,080,620 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

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.

2
Contributors
2
Replies
1 Hour
Discussion Span
1 Year Ago
Last Updated
3
Views
Question
Answered
StephNicolaou
Posting Whiz in Training
204 posts since Nov 2007
Reputation Points: 77
Solved Threads: 18
Skill Endorsements: 0

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
... trying to help
Moderator
8,683 posts since Apr 2008
Reputation Points: 2,636
Solved Threads: 1,479
Skill Endorsements: 33
Question Answered as of 1 Year Ago by JamesCherrill

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
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
View similar articles that have also been tagged:
 
© 2013 DaniWeb® LLC
Page generated in 0.1026 seconds using 2.71MB