# Java is another Animal II: Selecting the Look and Feel

**URL:** <https://ifnotnil.com/t/java-is-another-animal-ii-selecting-the-look-and-feel/1803>\
**Category:** Java\
**Tags:** java, tutorials\
**Created:** [3 June 2021 09:45 UTC](https://ifnotnil.com/t/java-is-another-animal-ii-selecting-the-look-and-feel/1803 "2021-06-03T09:45:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![thorstenstueker](https://ifnotnil.com/letter_avatar_proxy/v4/letter/t/aca169/32.png) [@thorstenstueker](https://ifnotnil.com/u/thorstenstueker)\
**Post date:** [3 June 2021 09:45 UTC](https://ifnotnil.com/t/java-is-another-animal-ii-selecting-the-look-and-feel/1803/1 "2021-06-03T09:45:30Z")

</div>

Writing Java Swing Applications makes it comfortable to have complex and reliable GUI programming. But like always: when you have a GUI you may want to have another look and feel.

One of the most interesting Java Swing functionalities is the possibility to change the Look and Feel. Like I showed in the former tutorial the change of the look and Feel can be done line this:

 ![grafik](https://ifnotnil.com/uploads/default/original/2X/c/c9cf39fa2dd8dfff185962c2fc092d920d8e212e.png)

Setting this Code to your Public Static Void Main before building the GUI itself selects NIMBUS look and Feel. Nimbus is a modern looking look and feel for Swing. There are also another selectable Options like you can see for example on this Oracle Page: [How to Set the Look and Feel (The Java™ Tutorials \> Creating a GUI With Swing \> Modifying the Look and Feel)](https://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html).

But also Third Party Look and Feels are available. Let’s take a look on my favorite one: FlatLaf. While you can download FlatLaf at the JFormdesigner Page here: [FlatLaf - Flat Look and Feel | FormDev](https://www.formdev.com/flatlaf/) you can install it in a really simple wise. So lets do it.

We generate at first a small GUI Project with simple UI Elements on it, like this:  
 ![image](https://ifnotnil.com/uploads/default/original/2X/e/eda4b76cd11fbb855158f22bf4fadee6765c9da2.png)

It’s looking so with the Nimbus Look and Feel. Now we want to get all the FlatLaf look and Feels from the Formdev Site. First get the latest jar file of it, when writeing this tutorial it was FlatLaf 1.2. After downloading the Jar File.

When downloaded you open the Project Settings in IntelliJIdea Project and select Libraries. There you click on the small + and select Java:

 ![image](https://ifnotnil.com/uploads/default/original/2X/a/a0e29b9ec393b68a1188b816e26c8305a06cd8e1.png)  
The System asks you to select the Library, in this case it is the jar File we downloaded:  
 ![image](https://ifnotnil.com/uploads/default/original/2X/5/57a54d014886966fb2c53327c5f0b2f2c3db25e8.png)  
and press okay. The IDE asks now to which Module it shall add it. The Module is named like your Program, in this case untitled6:  
 ![image](https://ifnotnil.com/uploads/default/original/2X/7/7fbb4d9a17536fd381a7a7ba3fbd6c16557e5111.png)  
Press on OK to accept it.  
 ![image](https://ifnotnil.com/uploads/default/original/2X/5/5484f9b2bc5e4eb8580be29d1ab4c95e7a2bd259.png)  
The IDE now added it. Press on OK to store this Settings. The IDE will add it to your list of external Libraries:  
 ![image](https://ifnotnil.com/uploads/default/original/2X/6/60054741e30ddd57b7c6c9bd4e93476c9abd1f02.png)  
Now we can use this Library in our Programs. While FlatLaf is a nice “Animal” you can install a Look and Feel from the FlatLaf Look and Feels with a simple Install order instead of our UI Selector we used until now so first we clean our Publis Static Void Main:  
 ![image](https://ifnotnil.com/uploads/default/original/2X/6/65542dcb362f1a6b5b994ba969b918f5a771eb54.png)  
and set directly to the beginning of the Method:  
 ![image](https://ifnotnil.com/uploads/default/original/2X/7/785089242e4b50da7c465c11e43e7cdcc8424684.png)  
Pressing now the green run Arrow results in:  
 ![image](https://ifnotnil.com/uploads/default/original/2X/6/64af5d20718e742a7e9d10f809e4cce762f3dee0.png)  
Changing FlatLightLaf() to FlatIntelliJLaf() brings this result:  
 ![image](https://ifnotnil.com/uploads/default/original/2X/0/085faec2ac35e31c3843e054f778c1891830d53e.png)  
And FlatDarculaLaf() brings this result:  
 ![image](https://ifnotnil.com/uploads/default/original/2X/3/3a597f2f1c33c726da05a62124d4b12ba280ecec.png)  
To see which Themes are in the Jar you can download the Demo and start it from command Line with java -jar name\_of\_the\_jar.jar. Have fun.

---

<div class="post-metadata">

**Author:** ![RDSWES](https://ifnotnil.com/letter_avatar_proxy/v4/letter/r/c37758/32.png) [@RDSWES](https://ifnotnil.com/u/RDSWES)\
**Post date:** [17 July 2023 01:25 UTC](https://ifnotnil.com/t/java-is-another-animal-ii-selecting-the-look-and-feel/1803/2 "2023-07-17T01:25:10Z")

</div>

Any fix for the Close , Minimize and Maximize buttons being on the wrong side and in the wrong order?

---

<div class="post-metadata">

**Author:** ![thorstenstueker](https://ifnotnil.com/letter_avatar_proxy/v4/letter/t/aca169/32.png) [@thorstenstueker](https://ifnotnil.com/u/thorstenstueker)\
**Post date:** [17 July 2023 07:16 UTC](https://ifnotnil.com/t/java-is-another-animal-ii-selecting-the-look-and-feel/1803/3 "2023-07-17T07:16:25Z")

</div>

It was not on Mac sir

Here is a Screenshot of an App @Jeannot was writing in JavaFX and running on MAC:

 ![grafik](https://ifnotnil.com/uploads/default/original/2X/2/2d985eef44b6e1f903a1713c4972c93bf307f4b5.jpeg)

he showed this Screenshot in another Thread on this Site you may look on it here:

> [@New book on building Mac apps with Swift](https://ifnotnil.com/t/new-book-on-building-mac-apps-with-swift/3365/9):
>
> and if not you can even load your own CSS to Scenebuilder and test/apply different layouts. Not only light and dark, but you could create a monkey or banana theme. No monkey nor bananas were killed in my JavaFX app and looking the same on Windows, macOS, Linux and each platform with its own installer (no need for the end user to install anything from Java). And the app works dynamically for all csv files, no matter if a column contains a date, any kind of numbers, string, formula, etc.). It wi…

as you can see it is not a bug. It is so that I was running on Linux with a Design near to MacOS and of course it was there the other way around.

Have a nice day

As addendum: it is also possible to place the menu bar on top of the screen, you can decide by self how you want to do this.

In Java Swing and also JavaFX the Window by self is controlled by the OS, Java is not controlling that. You can do that when setting the Window on undecorated and styling the window decoration by self but I would not recommend that.

---

<div class="post-metadata">

**Author:** ![Jeannot](https://ifnotnil.com/user_avatar/ifnotnil.com/jeannot/32/3787_2.png) [@Jeannot](https://ifnotnil.com/u/Jeannot)\
**Post date:** [17 July 2023 11:27 UTC](https://ifnotnil.com/t/java-is-another-animal-ii-selecting-the-look-and-feel/1803/4 "2023-07-17T11:27:00Z")

</div>

Exactly, my screenshot is “out-of-the-box”, but you could even tweak it more, in case you have the balls, the knowledge and patients of this guy:

[![](https://ifnotnil.com/uploads/default/original/2X/9/9337f1a2836e0fe5b517947d626ce7a734662a72.jpeg "Devnexus 2022 - May JavaFX be with you always - Gerrit Grunwald") ](https://www.youtube.com/watch?v=xMxOUCC7FX4)

As @thorstenstueker mentioned, you can just say in JavaFX that you don’t want any windows decoration and you can build everything on your own. JavaFX is basically a clean empty canvas and you can draw and animate whatever you want. That’s not worth my time and I don’t have the appetite for it, but it is good knowing that I could do it.

The movie is showing another typical thing in the Java universe, most of the stuff is open source. You don’t need to start from scratch. Take Gerrit’s works an adapt it where you’ll see fit. That’s one of the very nice things of Java, little to no need to re-invent the wheel …
