I am a Java developer, designer, public speaker and a JAS 39 Gripen instructor fighter pilot. A somewhat unusual combination I guess, but I like challenges. I have created miglayout.com, migcalendar.com and Wing, a flight planning system used in several Air Forces. I find end user usability to be the most important part of a system and have therefore specialized in creating such applications. Mikael has posted 10 posts at DZone. View Full User Profile

Creating the Perfect Media Player in Java - Part 1

  • submit to reddit
The perfect media player main window v2

The perfect media player main window v2

OK, I have redone some of the graphics. Not too much but still things that will matter. The top gray background is now striped. I think it looks more fresh. I am still not 100% confident on the new look of the track’s play progress bar. Blue made it more prevalent which is good though.

Unfortunately Adobe Fireworks does not do subpixel anti-aliasing on the text. This makes it look more blurred that it will in the finished application. Nothing to do, but it hurts my eyes.. ;)

As you can see I have added side bars. This is how extra information that you might or might not want to have visible at all times will look. The example bar is the playlist editor/player. I have opted for a Outlook stackbar look. I think it will work better than the tree structure in iTunes. iTunes mixes playlists, sources and the library in the same sidebar. I think that is a suboptimal setup as it will make it quite cluttered and too multipurpose to be really user friendly. For instance I never know where to drag stuff in iTunes…

The lower tabs (in blue) will pull out another type of sidebar, or rather bottom bar.. It will look like frosted glass and be more informational in nature. One could argue that I should go with white here as well, but that makes the whole GUI a bit too blended IMO.

The reason that the playlist tracks list looks the way it does is that I wanted to move away from very long names. The user must be shown both the track and the artist’s name, but quite commonly you will play several tracks from one artist which makes the artist name redundant for each track. Having the artist above in bold makes the tracklist look more clean and artisty and less computer-use-every-pixely, if you know what I mean.

I don’t really know how the “get it” buttons should look like and I have tested several looks, none of which makes me warm and fuzzy. You will see them change again I for sure.

I have also added arrows to the very custom scrollbar. Note that they should fade in when the mouse is over the scrollbar and then fade out again some five seconds after the pointer leaves it. Arrows will never be really “clean”, but they do serve a usability purpose in large lists.

The player should minimize nicely of course. You do not want that big window open all the time. Currently I am using a model where it will minimize in three steps. Mini, micro and nano. More on that later.

From http://miginfocom.com/blog/

Published at DZone with permission of its author, Mikael Grev.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)


Vincent DABURON replied on Wed, 2008/09/24 - 3:34am

Hello Mikael,

What technology or API do you use to play video ?

- JavaFx ?

- java DirectShow ?

- java Videolan ?

- Quicktime for java ?

- java for ffmpeg ?

other ...




Mikael Grev replied on Wed, 2008/09/24 - 4:47am

Hello Vincent,

I am still in the desig phase using Adobe Fireworks so I have not considered technology for playback yet. I have just checked that there is in fact ways to play what I want. In update 10, which I will need in any case, you can always play what the system can play. What is important is that my mother, and her mother, will be able to play the most common formats in a super simple way. But of course the geeks will have options as well.

As soon as I get to the coding I will start to look into the codec issues and I will blog about it then as well.


Carl Antaki replied on Wed, 2008/09/24 - 9:48am

Michael slick design. I don't think that you can compete with iTunes though with the features (have you tried the genius feature in iTunes 8) they have, the integration with the iPod.

Mikael Grev replied on Wed, 2008/09/24 - 9:56am

Thanks Carl,

Actually I was a bit disappointed when I saw Genie. Not because it was bad but because that was going to be one of the cool features in this media player. My version of Genie will be a bit broader and I hope it will be good. The main advantage towards iTunes will be speed, better usability (IMO) and absolutely no lock-ins.


Carl Antaki replied on Wed, 2008/09/24 - 12:11pm

Good luck Michael. Are you going to set up an open source project? It's going to be hard to beat iTunes.Do you know how much time will it take to include synching capabilities?

With Swing the UI won't be faster than the natively built iTunes. I can still tell that an application is a Java app even though we have Java 6 Update 10, the problem is that widget creation time which include classloading is still not negligible and the memory consumption is higher.

Mikael Grev replied on Wed, 2008/09/24 - 12:20pm


Nope, not a OSS project per se, but it will be free once completed.

Syncing will all be done by plugins. I will just provide the threading and queueing and a plugins just have to do the last device specific part if needed. Syncing will be in phase two though.

Swing can be made fast, but you need to know how. Using decorators insted of many components is one trick. On our Macs iTunes is actually not that fast to start up and a lot of times it freezes when there are background activities. I guess they don't have the best threading model in the background...

At least I aim at faster. Let's see how it goes... :)

Carl Antaki replied on Wed, 2008/09/24 - 1:38pm in response to: Mikael Grev


I've created many Swing apps and I've worked on Swing apps perfromance. There's still some time associated with the control creation ex. when you load a dialog the first time notice the time it takes. Pre-creating all controls so that is one option which isn't my favourite. I still prefer applications written in native languages because of the speed of their toolkit. What do you mean by decorators instead of many components can you elaborate on that? I don't see how this could help.

I know that users don't care about the speed of the toolkit but about perceived performance but I have yet to see seen a single Java app that's faster that native ones, ex. that can display large images as fast as acdsee for example, I've tried myself and couldn't get anything close with a pure Java solution.




Mikael Grev replied on Wed, 2008/09/24 - 1:40pm in response to: Carl Antaki


Decorators can be seen as custom light weight components that which purpose is to encapsulate Java2D painting. Go to http://www.migcalendar.com/demos.php and check out the topmost demo. I think it is pretty fast, at least when dragging the activities.

Using a decent LayoutManager is also key. MiGLayout.com will make you use much less panels in panels, which is good for performance.

Carl Antaki replied on Wed, 2008/09/24 - 1:51pm in response to: Mikael Grev

Migcalendar is very cool but there aren't many components and the UI is not very complex. I already use JGoodies, haven't used MigLayout yet but it seems comparable. I think that the performance bottlnecks are in classloading and the fact that Java has to create the controls.

Mikael Grev replied on Wed, 2008/09/24 - 1:52pm in response to: Carl Antaki

> there aren't many components

Yes, that is the secret. Not many components but lots and lots of decorators... Classloading is at least only a startup problem.

Carl Antaki replied on Wed, 2008/09/24 - 2:06pm

In your case you're in control in what you're doing but in a business app you have no control you have to have x numbers of JTextFields, JTable, JXTreeTables, JTrees, etc. Classloading happens after the startup also. Try the -verbose VM argument and see it for yourself.

Michael Bien replied on Thu, 2008/09/25 - 3:47am

i don't see a reason why classloading should be a problem in his case. I mean its (in a nutshell) a one windowed application with almost all custom components displayed at startup.

 Don't overengeneer and everything should be fine regarding classloading (its a media player no appserver ;-)).


It is currently a bit difficult to create fluent annimations with JavaFX, i am already looking forward to read which technoligy you finally desided to use for components like the cover flow widget. (JOGL would be an option too but swing-gl interop. is a bit buggy on old hardware and certain drivers->intel)

 btw: its a shame that it wont be OSS :P

Spiritus Umbrarum replied on Sat, 2013/05/11 - 4:36pm

 Good Day.

I Tried to Make A Fully Featured Java Multimedia Player... I Am Not Really A Programmer, So I Gave Up When I Could Not Add Codecs For All Media Formats.

I Just Saw And Tried Your Media Player And I Liked It.  I Want To Ask You To Participate In My Project Or Help Me To Do It While You Finish Yours Or Join Both Projects And Release Them Separately With Each One's Style Of GUI, Name, Etc. (It Is Almost The Same You Are Doing But With Different GUI Structure). 

My Project Is Named "Ars De Yaxche En Xibalba Regnum". I Thought It Basing On MusicBee, Nightingale, MediaMonkey, Etc... And It Is Basically The Same But With All Existing Functions, Codecs, Etc. And Some New Ones I Thought Joined In This Player / Manager.

It Shalt Be Open Source (Add-Ons).

Please Answer Me If you Are Interested Or Not. I really Want To Do This Project And You Seem To Be the Right Person To Help Me.


Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.