aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes no repaint while resizing when using .setPaint(gradient) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "no repaint while resizing when using .setPaint(gradient)" Watch "no repaint while resizing when using .setPaint(gradient)" New topic
Author

no repaint while resizing when using .setPaint(gradient)

Jean-francois Le Bas
Greenhorn

Joined: Aug 16, 2012
Posts: 10
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

Joined: Oct 16, 2003
Posts: 1085
    
  10

I get an compilation error for the variables startX, endX, greyColor1 etc. Can you tell us what the values for these variables are?


Ranga.
SCJP 1.4, OCMJEA/SCEA 5.0.
Jean-francois Le Bas
Greenhorn

Joined: Aug 16, 2012
Posts: 10
hello Ranganathan

you can try this code:



and in your constructor :
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
why would anyone bother?
http://stackoverflow.com/questions/12037321/no-repaint-while-resizing-when-using-setpaintgradient

definitely the slowest learner of the week award:
http://www.coderanch.com/t/590025/GUI/java/RadioButtons-JLabels-not-showing
Jean-francois Le Bas
Greenhorn

Joined: Aug 16, 2012
Posts: 10
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

Joined: Aug 16, 2012
Posts: 10
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: no repaint while resizing when using .setPaint(gradient)