Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Canvas class

 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I use the Canvas class within a loop to create a circle of different sizes and then store each Canvas object generated within a GridLayout. Can I use the same Canvas object within the loop and just assign to different rows and columns as I go or do I need to create an array, etc..,?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What happened when you tried it out?
 
Rob Hunter
Ranch Hand
Posts: 832
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wouter,
Found the problem. I was passing in an array and assigning it to a private variable in the class but since I wasn't making a copy of the array (circle info) it was making all the circles the same size as the last one done. I changed the code to copy the array passed in instead of a direct assignment to and it works fine now. Thanks for the response.

Rob
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic