• 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 painting problem while resizing

 
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
How can I do have a JFrame contents updated while it is resizing ?
When I release the mouse button evrything is OK, but while I am moving the mouse, components inside the frame don't move.
Regards,
Philippe.
 
Ranch Hand
Posts: 15304
6
Mac OS X IntelliJ IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not so sure that you can. At least not easily. You might be able to catch the resize events of the JFrame in a mouse listener, and call validate() from those events somehow. Of course you would have to use the SwingUtilites.invokeAndWait or invokeLater() (I can't remember which one) because of the way Threads work in SWING.
Sorry if I didn't make any sense, but I don't like seeing posts going unanswered.
 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Gregg,
Thanks a lot for your explanations. As I am a swing newbie, I first thought that I was forgetting some obvious property. Then I tried validate() from componentResized() but the latter was fired only once, after resizing. In the meantime, I noticed that my copy of SUN One Studio 4 has the same behaviour (but JBuilder not). So it seems to be a regular painting behaviour for java applications.
Anyway I'll try your solution. Unfortunately, it must be simple, as anything in my SCJD assignment .
Best,
Phil.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic