• 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

repaint() but no changes until i minimise then maxamise?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have an application where entering certain numbers changes the data held, I had observers looking at these observables and when they are notified they make changes to what is displayed on screen, one of these is some swing graphics. I do a repaint() in the observer but when I run the app nothing happens until i move the window of the screen and back on again. Is there a way of getting it to actually re draw the window so I can see the changes instantly?

Many thanks in advance.
 
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Assuming that you are using an IDE of some sort, put a System.out.println right before the repaint executes to make sure that your repaint is getting called first. I have a hunch that it may not be.
 
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You donotdescribe problem so sound
but i have some hint try to use them
use revalidite() function instead of
repain
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Agree with C Clites; the System.out.println("Calling thisThatOrTheOtherMethod()"); call is a very useful aid to debugging.

You don't say much about your problem; where exactly is your repaint() call? Is it in the sam place as the call to alter the numbers, viz inside your actionPerformed() method?
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . And what have you got in your paintComponent() method? It ought to start with super.paintComponent(g); as its first statement, otherwise you get the old appearance with the new appearance superimposed.
 
Campbell Ritchie
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . and I never noticed it is your 1st post.

Welcome
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic