How to change the default JFrame Window color?



I am building an app for Windows using Java Swing/AWT interfaces in IntelliJ Idea. I am using a default JFrame to display my application GUI. However, I would like to change the default frame outline (window) colour to either transparent or custom colour.

Here is what I am trying to achieve:

This is the window I have: This is what I have

These two are the ones I am trying to achieve (transparency or custom colours):

I would like to achieve either this

Or this

Or this

Is there a way to achieve this?

Answer

You can use custom title bar by creating a new panel and set undecorated on your frame to hide default title bar add your title to the new panel and buttons (exit, minimize…)

Frame.setUndecorated(true);


Source: stackoverflow