• 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

Do certain events make calls to repaint redundant?

 
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all.


In an application where a scroll bar changes the size of a shape on the JPanel on which it is drawn, I would have thought that the AdjustValueChanged method would have required a call to repaint(); in order to reflect the change to the shape drawn on the panel but it seems to do this automatically. Why is this?

Thanks,

Colm
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
> changes the size of a shape on the JPanel

We have no idea what you code is like to implement that change, so its hard to guess.

If you are doing custom painting to draw the shape in the Graphics method, then you should need to invoke repaint on the panel to reflect the change.

If you are changing a "shape icon" on a JLabel, then the label should repaint itself automatically.

If you need further help then you need to create a SSCCE (Short, Self Contained, Compilable and Executable, Example Program), that demonstrates the incorrect behaviour.

Don't forget to use the Code Formatting Tags so the posted code retains its original formatting. That is done by selecting the code and then clicking on the "Code" button above the question input area.
 
Colm Dickson
Ranch Hand
Posts: 93
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi again...


Sorry...,my mistake...I had my classes all separated into frames and panels and missed a call to repaint() hidden in my method!!!

SO..it had a call to repaint() all along..

Thanks.
 
Rob Camick
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Colm Dickson wrote:Hi again...


Sorry...,my mistake...I had my classes all separated into frames and panels and missed a call to repaint() hidden in my method!!!

SO..it had a call to repaint() all along..

Thanks.



Which is why a SSCCE should always be posted with the question.
 
reply
    Bookmark Topic Watch Topic
  • New Topic