This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I'd like to develop a GUI for my app with custom selection and arrangement of common window controls (move, resize, iconify, maximize, close, title bar, etc.) as well as several ordinary Swing components. If you've seen the latest Windows Media Player, that's (very roughly) the kind of look / feel I'm going for. Is it better to [A] extend JFrame (changing behaviors by overriding some methods), [B] build up behaviors I want by building on top of JWindow, or [C] do something else? Extremely reliable behavior and performance are critical, in case that drives the design. Any recommendations? Thanks in advance!
Maneesh - Thanks! JavaFX looks really cool, and definitely includes some of what I'm after. However, I'm worried about a warning at the bottom of the referenced page:
Note: the com.sun.awt.AWTUtilities class is not part of an officially supported API and appears as an implementation detail. The API is only meant for limited use outside of the core platform. It may change drastically between update releases, and it may even be removed or be moved in some other packages or classes. The class should be used via Java Reflection. Supported and public API will appear in the next major JDK release.
My application needs to be extremely reliable, and this capability seems "not quite ready for prime time".
My bad. Like I said, I havent used this myself.
Some googling gave me this info Looks like the com.sun... classes are planned to be migrated to standard classes in JDK7. That might be one option you want to consider.
If you google, you should get samples which achieve skinning using the Robot screen capture functionality. It might have some overheads though. You might want to evaluate it.
Maneesh - Thanks again. The prospects of using native code and snagging screenshots (the first and second links above) seem inconsistent with the goal of commercial-grade reliability but the last one on alpha mask transparency seems promising (if I understand it so correctly so far). I will look further into what the author recommends.
However, I still need a basic recommendation on starting the design - is it best to [A] extend JFrame, [B] build on top of JWindow, or [C] something else?
I would say JWindow Using a JFrame will involve the title bar and buttons and the hassle to get rid of them (depending on your requirement)
On the flip side, using JWindow will mean the hassle of
1) Getting it to show up on the "taskbar" (by default it doesn't show)
2) Building functionality to minimize maximize close (three default buttons for JFrame the JWindow has nothing by default)
3) Building functionality to enable the user to move (user cannot move JWindow by default)
On the con side, I see the ability to have any kind of shaped window.
I had toyed with this concept long time back using the Robot class and a JFrame so my information is a bit dated. Others might have better options.