Win a copy of Event Streams in Action this week in the Java in General forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

accessing Canvas paint() method from another class? (SOLVED)

Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have the following (simplified example code):

This works so far.
Now I'd like to access above paint() method also in another (utility) class, to draw various things on screen, is this possible?

I have it working, I think:

Is this the corect (only) way to do it?
What concerns me a bit is that all public / proteced members members are now also in this class, but I actually don't need it there, I only want to access the paint() method from the other class..

I figured the simplest way is to pass g in the method calls, than I can acces it directly in my utility class.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!