• 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

MiniMusicPlayer HFJ

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
OK I have two sets of code here both, to me, look to be the same except for style differences. One I wrote from doing the section in the book MiniMusicPlayer. The other was a direct copy and paste MiniMusicPlayer3.
Mine doesn't work, it plays the track, but doesn't display the random rectangles. The copied and pasted code works.
I can't recognize the difference in the two codes,(myDrawPanel is named different in the two, but referenced the same way) I am curious if anyone else can see something I am not seeing?


Mine


Copied version

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
class MiniMusicPlayer, line 66 - You override method paintCompenent instead of paintComponent
after correcting method name works fine for me
 
Brian Pianczk
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you! I looked over this code again and again. Even line by line and did not notice. Even when I pinpointed it to that bit of code.

Thanks again!
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
for future reference, had you done this

@Override//<---------
public void paintCompenent (Graphics g) {

the compiler wopuld have spat this out
"method does not override or implement a method from a supertype"
 
it's a teeny, tiny, wafer thin ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic