• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JFrame is flickering while resizing.....

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mine application has a JFame application window having JDesktopPane in it for JInternalFrame.
Now the problem i am facing is when i resize my application window in restore mode, by dragging the mouse. I am getting flickering images of the window. It's very irritating. So if any body has any type of solution on this plz reply.


thanks in advance

Manoj
 
Marshal
Posts: 79239
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have had rather similar problems before, but with a different sort of app.
The Java tutorial has a "common problems" page, so I looked there. I tried things to speed up processing, as suggested in the tutorial, including changing all my doubles to floats.
I tried opacifying the content pane, but still had problems.
I tracked it down to a method which was applying an affine transform to the Graphics2D object. Without the transform the method took 1.6 microseconds to run, with, it was much slower, over 50 microseconds, but the same method run a 2nd time was faster, about 8 microseconds.
That delay was obviously what caused my problems.

Eventually I sorted it out by setting up a Timer to repaint() the whole things repeatedly. A cheat's workaround maybe, but it worked.

Have you got anything like that? Go through all your methods with the System.nanoTime() method and see if you can find such a delay.
Put System.out.print() calls into every method, and follow their sequence. Have you got any loops where your control is recirculating?
When you drag your window, does it remain visible? Have you tried that method which turns your window into an outline when you drag it?

That's all I can suggest. Maybe somebody else will have a better idea.
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
if you have this line in your code
JFrame.setDefaultLookAndFeelDecorated(true);

add this line
System.setProperty("sun.awt.noerasebackground", "true");
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic