• 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
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

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"
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic