Reputation: 453
I'd like to customize the title of my main JFrame on a Swing application.
There's two things I'd like to do, but can't find any way to achieve it :
use an Image to put behind the title of the main JFrame. Something like this : http://www.hostingpics.net/viewer.php?id=521357Untitled.png
use a GradientPaint (or similar "tweak") to put a gradient color behind the title of the JFrame. Something like this : http://www.hostingpics.net/viewer.php?id=842390Untitled2.png
Is there any way to do that easily in Swing ?
Thanks,
Upvotes: 3
Views: 629
Reputation: 786
Another way (I used in Delphy some years ago...):
Don't display the default title bar, and put your own on one (made with all you want :p), and reimplement all the behaviaviour (drag n drop, maximize, minimize,...).
Upvotes: 1
Reputation: 10143
You cannot modify system native frames/dialogs decorations (including frame/dialog title).
Though there are two ways to modify the whole frame/dialog decoration:
You have to use some specific L&F in your application that has custom frame/dialog decorations and allows to change it - i don't really know if there is such. (you can find many L&Fs that have their own frame/dialog decorations, for example this one)
You have to install your own RootPaneUI that will customize frame decoradion, but be aware that you will have to write all of the frame/dialog decoration features on your own (including window drag and resize, control buttons, title and others) - that requires a good knowledge of UIs, graphics and Swing.
Upvotes: 3