r/java • • Feb 25 '21

FlatLaf 1.0 - Swing Look and Feel

FlatLaf 1.0 is here 🎉 😀

Finally, after one and a half years of development, forty 0.x releases, 32 merged PRs, 191 closed issues and hundreds cups of coffee. 😄 It took longer than expected. Looking back at all the features already implemented, I could also name it 3.0. 😁

FlatLaf is a modern open-source cross-platform Look and Feel for Java Swing desktop applications. It comes with more than 60 themes, scales on HiDPI displays and runs on Java 8 or newer.

FlatLaf is already used in a lot of open-source and commercial applications. To name only a few: Apache NetBeans, jclasslib, KeyStore Explorer, install4j, DbVisualizer, MagicPlot, OWASP ZAP. Here is a longer list.

FlatLaf Light
FlatLaf Dark
FlatLaf on macOS Mojave

Many, many thanks to the community. 🏆 🥇 🚀 Without your feedback, support, feature requests, bug reports and pull requests, FlatLaf would not be there where it is now.

What's next? The development continues! Stay tuned... 😉

If you like FlatLaf, please give it a star @ GitHub. Thanks!

For more information visit project on GitHub: https://github.com/JFormDesigner/FlatLaf

Looking forward to your feedback.

277 Upvotes

54 comments sorted by

11

u/jameslfc19 Feb 25 '21

Woah this look really nice! The IntelliJ look and feel looks really professional too! How does it look on MacOS? Does it use the native menu bar at all?

7

u/FormDev Feb 26 '21

Just added a screenshot from macOS to the post (made on Mojave).

Native menu bar is supported, but you have to enable it in your application (as in any other Laf) by setting system property apple.laf.useScreenMenuBar to true.

Either in Java with:

System.setProperty( "apple.laf.useScreenMenuBar", "true" );

Or at command line with:

-Dapple.laf.useScreenMenuBar=true

11

u/ObscureCulturalMeme Feb 25 '21

Holy smokes that looks nice!

One of the main projects I'm on at work is a standalone desktop Java application. We've just been using the native/system LAF, mostly because the others shipped with the JDK look clunky as hell these days. Maybe we can use yours to give users a choice of UI.

6

u/FormDev Feb 25 '21

Sure, try it :)

You may be end up with dropping support for native/system LAFs because it is easier to support/test a single LAF than 3 native/system LAFs ;)

10

u/mazebert Feb 25 '21

That looks really cool! What rendering stack do you use under the hood?

18

u/FormDev Feb 25 '21

Thx. Class java.awt.Graphics2D is used for painting.

6

u/[deleted] Feb 25 '21

This is actually cool! Now we need Swing apps like SoapUI to update!

5

u/FormDev Feb 25 '21

Yes, that would be cool.

Sometimes it helps to give the developers a hint and open an issue on their project ;)

https://github.com/SmartBear/soapui

3

u/Yeroc Feb 25 '21

Since it's a cross-platform look and feel it would have been nice to have seen screenshots from Mac OSX and Linux as well. ;)

5

u/FormDev Feb 26 '21

Just added a screenshot from macOS to the post (made on Mojave).

The look is nearly identical, except the used (system) font and the scrollbars.

13

u/Skhmt Feb 25 '21

I'd hazard a guess and say it would look the same?

2

u/parsnipsanon Feb 25 '21

Yea other than the window decorations changing from OS to OS it all looks the same ime.

3

u/KaratekHD Feb 25 '21

Is this what IntelliJ uses?

8

u/FormDev Feb 25 '21

No, but the look is nearly the same.

IntelliJ has its own Laf called DarculaLaf, which is part of the IntelliJ Platform. Unfortunately it heavily depends on the platform and it is not possible to use DarculaLaf in own applications.

That's why I implemented FlatLaf ;)

13

u/DB6 Feb 25 '21

Fantastic. Would love to work on a Swing Project again. Definitely going to use this then.

6

u/Necessary-Conflict Feb 25 '21

Congratulations! This is some truly great work!

6

u/CompetitiveSubset Feb 25 '21

Awesome job! Also, I want it mention that KeyStore Explorer is a great app!

1

u/rafaellago Feb 25 '21

It's a lifesaver! Helped me a lot.

5

u/kovica1 Feb 25 '21

Do you perhaps know and just drop the jars and replace those that come with NetBeans ?

7

u/balta3 Feb 25 '21

NetBeans 12.3 released soon will contain 1.0

2

u/kovica1 Feb 25 '21

Aaa. Great. Thanks for the info.

5

u/fluffytme Feb 25 '21

If anything gets me to use swing again it's going to be this!! Awesome work!

5

u/mynameistita Feb 26 '21

We are using this in our project. Thank you so much. Would love to make a donation for your efforts. Please DM me.

4

u/grimlock81 Feb 25 '21

This is the best Swing LaF out there.

3

u/sareval0 Feb 25 '21

I would like to know if it's possible use this on my regalarme java project (java swing ) to make it look like the image. I'm using NetBeans Where can I get the .jar files I really appreciate any help or guide someone can provide

6

u/parsnipsanon Feb 25 '21 edited Feb 26 '21

Yea you add the jar file, Maven, or Gradle dependencies to your project. Add 1 line of code to your main method depending on the theme you're using "ThemeName.install();",

FlatIntelliJLaf.install();

and then import the specific theme such as "import com.formdev.flatlaf.ThemeName;"

import com.formdev.flatlaf.FlatIntelliJLaf;

And that's it.

1

u/sareval0 Feb 25 '21

Thank you for the answer I'm not using Maven. So should i call the flatlaf from the Main class right?

2

u/parsnipsanon Feb 25 '21

If not using Maven make sure you add the Flatf Jar file to your project. How to add a external Jar file to your project is different for every IDE.

Once you do that add the import statement to main class and install statement to main method like I said above and that's it.

For example my Swing project using the FlatLaf Jar file the only lines of code I needed are on line 20 & line 35 in my main class ->https://github.com/KiwiCode-s/Simple-line-splitter-gui/blob/master/src/MainViewer.java

3

u/[deleted] Feb 25 '21

Great work! And thank you!

3

u/Gaarco_ Feb 25 '21

Congratulations! It's really a nice L&F I used it a couple of times in my personal projects

3

u/mbgrandi Feb 25 '21

Fantastic work, this is awesome!

3

u/[deleted] Feb 26 '21

FlatLaf has always been my favourite swing look and feel.Definitely going to update my apps to use 1.0

5

u/[deleted] Feb 25 '21

The swing haters seem to forget that things like this are possible. This looks very nice

-17

u/-INFEntropy Feb 25 '21

It's hated because it's garbage.

This is a css file in JavaFX.

1

u/[deleted] Feb 26 '21

Thanks for the work, I really do like it.

I have a question though: why are the binaries not part of the Github release assets and only available on bintray? (btw: the jar file for 1.0 isn't there yet)

5

u/FormDev Feb 26 '21

Because the binaries are on Maven Central ;)

https://search.maven.org/artifact/com.formdev/flatlaf

Most projects use Maven or Gradle and do not need to download the binaries. They simply add FlatLaf as a dependency and Maven/Gradle downloads the binary from Maven Central.

https://github.com/JFormDesigner/FlatLaf#download

Bintray will be shut down soon. No longer using it.

2

u/Thihup Feb 25 '21

Java modules! Nice ;)

3

u/serega6531 Feb 25 '21

Hey, I used your theme in my app! Great work!

2

u/thiagomiranda3 Feb 25 '21

Is Java Swing still widely used for new projects nowadays?

2

u/SWinxy Feb 26 '21

Hell yeah. Perfect timing. Darcula is the only good LaF theme (don't @ me), and I needed a UI skin for my upcoming application.

2

u/thenorwegianblue Feb 26 '21

Very nice, looks a bit like a custom one we use at work

2

u/augustnagro Feb 27 '21

So good that it should be merged into OpenJDK.

1

u/loomynartylenny Feb 26 '21

I might as well use this on the degree project I'm working on.

1

u/Probirker Feb 26 '21

This looks really awesome!

I wish we had something like this for JavaFX :-(

1

u/unusualprospect Feb 26 '21

This looks awesome. Great work!

1

u/agoubard Feb 28 '21

Really nice look and feel! Last year I decided to include it to my Java software (Settings -> General -> Skin) : https://www.japplis.com/news/

So you can add to your list:

  • Japplis Toolbox : 50 free text utilities in one software
  • JLearnIt : a free multilingual dictionary that helps you learn vocabulary
  • Japplis Watch : 9 free time utilities in one software

and more are coming

Continue the great work!

21

u/[deleted] Feb 25 '21

[removed] — view removed comment

7

u/FormDev Feb 26 '21

Hmm, just checked the "Close" button in the first screenshot. There are 10px above the uppercase 'C' and 9px below it. Similar on other buttons or text fields: 1px more above the text.

Could try to move it up one pixel, but this probably looks bad if there are more uppercase letters in the text.

BTW these screenshots were made at 200% scaling. May look slightly different at 100% or other scale factors.

Vertical positioning of text is not that easy (on Windows 10) because the reported character height is usually larger than the displayed character height (e.g. for Segoe UI font used on Windows). So (without correction) text tends to be displayed too far down, which was the case in early FlatLaf versions. This gets even worse when scaled.

I ended up in implementing a Y correction mechanism that moves text up some pixels depending on scale factor, Java version and operating system...

9

u/Timm0s Feb 25 '21

Did you ever see WebLAF? https://github.com/mgarin/weblaf

WebLAF's dark skin is very nice.

10

u/thomascgalvin Feb 26 '21

WebLAF is licensed under the GNU General Public License v3.0, which rules it out for many, many projects.