• 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

Head First Java-Chapter 12-A very Graphic story-animation using inner classes

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I tried doing a simple animation code in java:-

1. using inner class.
2. without using inner class.


1. code using inner class:-




2. Code without using inner classes:-



MyDrawPanel2 class:-


The oval is moving in the top left to bottom right direction in both cases except:-

1. In the case of inner class it starts at x,y=70,70 and ends exactly where i want it to end.
2.In the latter case it starts at an offset i.e. somewhere in the middle of the (300,300) window.

I have attached the snapshots of the full screen window. Why is there a bluish offset in the second case?


This is the first time I am posting a doubt so please bear with me if I have included it in the wrong place.



without_inner_class.jpg
[Thumbnail for without_inner_class.jpg]
without using inner class.
using_inner_class.jpg
[Thumbnail for using_inner_class.jpg]
using inner classes
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic