aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Recommendations: Custom App Window Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Recommendations: Custom App Window" Watch "Recommendations: Custom App Window" New topic
Author

Recommendations: Custom App Window

Bill Compton
Ranch Hand

Joined: Aug 26, 2000
Posts: 186
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 Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

This might help. Looks similar to what you might be looking for.
Note: I haven't used it myself.

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Bill Compton
Ranch Hand

Joined: Aug 26, 2000
Posts: 186
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".
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

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.

Here you go
http://onjava.com/pub/a/onjava/excerpt/swinghks_hack41/index.html
http://rabbit-hole.blogspot.com/2007/02/non-rectangular-windows.html
http://rabbit-hole.blogspot.com/2007/04/alpha-mask-transparency.html
Bill Compton
Ranch Hand

Joined: Aug 26, 2000
Posts: 186
The discussion on this JavaRanch forum also discusses the future of JavaFX.
Bill Compton
Ranch Hand

Joined: Aug 26, 2000
Posts: 186
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?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10523
    
    9

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Recommendations: Custom App Window