File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Swing / AWT / SWT and the fly likes MiniMusicPlayer HFJ Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "MiniMusicPlayer HFJ" Watch "MiniMusicPlayer HFJ" New topic

MiniMusicPlayer HFJ

Brian Pianczk
Ranch Hand

Joined: Jan 26, 2009
Posts: 45
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?


Copied version

Bartek Myszkowski
Ranch Hand

Joined: Feb 03, 2009
Posts: 44
class MiniMusicPlayer, line 66 - You override method paintCompenent instead of paintComponent
after correcting method name works fine for me
Brian Pianczk
Ranch Hand

Joined: Jan 26, 2009
Posts: 45
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!
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
for future reference, had you done this

public void paintCompenent (Graphics g) {

the compiler wopuld have spat this out
"method does not override or implement a method from a supertype"
I agree. Here's the link:
subject: MiniMusicPlayer HFJ
jQuery in Action, 3rd edition