Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

no repaint while resizing when using .setPaint(gradient)

 
Jean-francois Le Bas
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello

as soon a i use gradients in my code, the repaint isn't done while resizing

i get something like that while resizing (black rectangles where it has been resized, see below). And when i stop resizing, everything is drawn again, but only then.

if i don't use g2d.setPaint(gradient); i have a quick redraw





i tried to repaint on resize, i tried to repaint when mouse is dragged but nothing.

thanks for help
 
Ranganathan Kaliyur Mannar
Bartender
Posts: 1101
10
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I get an compilation error for the variables startX, endX, greyColor1 etc. Can you tell us what the values for these variables are?
 
Jean-francois Le Bas
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello Ranganathan

you can try this code:



and in your constructor :
 
Michael Dunn
Ranch Hand
Posts: 4632
 
Jean-francois Le Bas
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i made a quick video to show you guys what it's doing

you can download it here : mov.rar

btw i still didn't get it working so if anyone has an answer, he is welcome.
 
Jean-francois Le Bas
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Okay so to sum up :
i tried the three main methods of drawing in Java which are BufferStrategy, double Swing buffered image and simple swing with no image buffer.
And i found that the faster one is the last one (surprisingly).

Now I found that resizing the window to a small size makes the problem disappear. Don't laugh that's my problem and that's a total mystery.
here is a video of it : C41142775162.rar

what happens when i resize to a small size? i dunno. But if you know any help would be greatly appreciated.

thanks

Jeff
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic