• Post Reply Bookmark Topic Watch Topic
  • New Topic

JFrame painting problem while resizing  RSS feed

 
Philippe Maquet
Bartender
Posts: 1872
  • Mark post as helpful
  • send pies
  • 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.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!