r/java • • Jun 20 '21

MaterialFX, an open source library for JavaFX

I started learning JavaFX about 1 year ago. At the time, the first thing I did was to search for a good library that would make JavaFX controls not suck aesthetically, and so I discovered JFoenix.
It was pretty good actually, but I didn't like it because it relies too much on reflection and that often ended up in exceptions occurring and broken controls, and this was true especially with newer JDK versions.

It was at that moment that I said, "screw it, I'm going to make my own library".
Eight months ago, MaterialFX was born. I always wanted to post my project here but at the same time I always thought "maybe it's better to still wait a bit and make the project evolve some more". Recently I pushed the biggest update so far and I finally decided to post my work here.

MaterialFX is a library that brings restyled, remade and brand-new controls to JavaFX. As the name suggests, the intention is to follow as much as possible the Material Design guidelines or at least to give controls a modern look and feel.
It targets Java 11+, it's much more stable as reflection is not used anywhere, and it's fully compatible with newer SceneBuilder versions. It is licensed under the GPLv3, but soon this will change to a more open license, probably LGPL.

  1. Restyled controls are simply re-skinned, but most of them also include new features.

  2. Remade controls introduce the concept of Legacy. Some JavaFX controls were so badly written/designed that I had to re-create them from scratch. However, I thought that it would be a good idea to also keep JavaFX original controls. So the remade controls have a legacy counterpart that is of course restyled. Some examples of this type are combo boxes, list views.

  3. Brand-new controls are made from scratch, as they do not extend from any JavaFX base control. As of now there are not many, but I plan to add many more in the future.

The library also includes a lot of utlities from StringUtils, AnimationUtils(coming soon), NodeUtils and many others.

The project is hosted here MaterialFX. On the same page, you can download the demo from the Releases section, or you can take a look at the controls in the "Preview GIFs" section of the README.md. You can also take a look at the project roadmap (next features and improvements) in the ROADMAP.md file.

268 Upvotes

33 comments sorted by

2

u/pushupsam Jun 21 '21

Hey Alex,

Looking forward to the relicensing under LGPL.

Instead of using paypal for donations I wonder if you've considered using Github Sponsors?

2

u/ThreeSixty404 Jun 21 '21

Soon, wait just a bit Usually after a big update I take a break from MaterialFX because when I work on it I spend a huge amount of hours on it. The latest update took one month of work to complete. Also this week I have a lot of commitments so I don't think I'll have enough time.

GitHub Sponsors is a new thing to me, I've never heard about it. If people think it is better than PayPal then I have no problem enabling it

2

u/dev_my Jun 21 '21

Awesome work! I like the stepper design

2

u/ThreeSixty404 Jun 21 '21

Thanks! I was inspired by this Bootstrap Wizard

25

u/post_depression Jun 20 '21

I just got off a group discussion with my fellow researchers where we discussed to create a small UI based data mining tool for our university to teach our students. We decided to implement this in Java, with a UI somewhat like Weka but much simpler. I had the task of finding a good UI library. I guess my work is done.

2

u/LouGarret76 Jun 21 '21

Hi great library. It looks nice. Could we have a HelloMaterialFx app?

7

u/ThreeSixty404 Jun 21 '21

If you mean a demo app to test the controls there is one. You can download it from the GitHub releases section. It's a jlink image.

5

u/warmuuh Jun 21 '21

Thanks. I went for jfoenix but hit a dead end now (no support for jdk12+ and I think there will never be support for that. Gonna look into throwing out jfoenix and replace it with your lib...(and add a proper facade so this won't happen to me again :) )

4

u/samtoxie Jun 20 '21

This is awesome! Thanks for showing :)

1

u/[deleted] Jun 20 '21

You can style JavaFX with CSS. So I wonder if that might be more standard. https://docs.oracle.com/javafx/2/api/javafx/scene/doc-files/cssref.html

15

u/ThreeSixty404 Jun 20 '21

Of course, every control in my library has its own new stylesheet. However, there are features that cannot be added with CSS. Take the buttons as an example. They are basically restyled with CSS but they also have a ripple effect on click and that feature cannot be implemented with CSS so the source code must be modified.
That's also why I said that MaterialFX is not just a theme. A theme can be realized using only CSS but my library extends JavaFX controls and adds new features

2

u/[deleted] Jun 20 '21

Thanks for the info, I'm sure your library is great. Its just that I am conservative in selecting a library for my UI. For some less central function then a library seems less intimidating.

2

u/ThreeSixty404 Jun 20 '21

Thanks πŸ˜„ Yeah I perfectly understand what you mean. I always think twice before adding a dependency to my projects. If I don't want to I end up creating my own classes, if I don't have any choice whatever haha

1

u/user_12334565 Jun 29 '21

we can make use of css frameworks that is available online as an open source software like bootstrap and make it in use in your jsp projects ,you can include css and html in jsp ,but i have not used javaFX in my projects,probably i think it is a java extension for enhanced user interfaces.

4

u/awayfrom234 Jun 20 '21

This sounds promising! Good job!

2

u/jvjupiter Jun 21 '21

I wonder if you are considering to create a library of Bootstrap components/theme.

3

u/larsgerrits310 Jun 20 '21

I've been looking for a replacement for JFoenix, and this is exactly it!

3

u/djelad Jun 20 '21

Looks nice!

3

u/fuzail7 Jun 20 '21

I had been using Jfoenix and this looks really interesting. Kudos to you.

2

u/handshape Jun 20 '21

Eagerly looking forward to the relicensing; these look tidy...

1

u/muhwyndhp Jun 21 '21

Awesome work!

Though sadly with GPLv3 makes this not viable for me because I need the ability to work with private entity.

Looking forward for LGPL relicensing tho!

-7

u/wildjokers Jun 20 '21

It is licensed under the GPLv3

This makes the library effectively worthless.

Some JavaFX controls were so badly written/designed that I had to re-create them from scratch

How so? Examples?

Instead of creating a new library maybe the JavaFX project itself could benefit from your contributions.

14

u/ThreeSixty404 Jun 20 '21 edited Jun 20 '21

Like I said, the project will be re-licensed under LGPL soon

Completely remade controls are: list views, table view, tree views(poor performance for now need to implement with virtualization), combo boxes, date picker, dialogs and even context menus

Each has its own reason, but for example take the list views. They are an absolute nightmare to manage and customize. The CSS to style the cells is completely broken. I still remember when I tried to style them with my stylesheet, and it would not work no matter what. Yes, maybe I could have investigated the issues further but at that point I was so frustrated that I decided to design my own list view control, and they are also based on Flowless (which I'm trying to replace now, in fact I'm trying to make my own virtualization library, but it's not an easy task, so it will definitely require some time). I can assure you that managing and styling my controls in most cases is way easier than the JavaFX counterpart. Many methods are public or protected, all of them even private ones are documented, the code is clean and should be self-explanatory, have you ever looked at the JavaFX source code? It's a complete mess, really.

Instead of creating a new library maybe the JavaFX project itself could benefit from your contributions.

There are several reasons because I'm that not interested in contributing to JavaFX.

TLDR: the whole process is slow

I reported several bugs, and even requested new features and an API change (for which I provided the needed code of course). How many of them have been completed by reviewers? 0.

The JBS system? I hate it. The mailing list system? I hate that too, stupid and ugly system in my opinion. I always say that using GitHub issues would have been much better, but for some obscure reason people defend the JBS system and I personally don't care, keep using it, I won't

One time I even requested to change the tree views to include new features like the lines that go from one node to children nodes and the expand/collapse animations, features that many UI frameworks have. They responded that they are not interested in changing them. I was surprised.

So, in the end the system made me lose interest in contributing, after all MaterialFX was born as a personal project that I needed for my own apps. I decided shortly after to release it to the public because I thought it might be useful to others.

2

u/muhwyndhp Jun 21 '21

While I understand the point behind your comment I can't fathom the fact that you're unnecessarily rude, condescending and unappreciative.

0

u/wildjokers Jun 22 '21

I am quite frankly scratching my head why my comment has apparently been taken as rude.

The GPLv3 is in fact incompatible with corporate development. In most companies GPLv3 licensed code cannot be used.

OP made a claim that many JavaFX components are badly designed. I simply asked for examples since I was genuinely curious.

Recommending that someone contributes to JavaFX hardly seems rude. OP didn't mention in their first comment that they had already tried.

1

u/muhwyndhp Jun 22 '21 edited Jun 22 '21

It is either English is not your first language or that you don't understand the word "worthless" is as rude as you can get describing someone else hard work.

Either way, your approach is rude and just like everyone else replying to you, you are not supposed to say things like that.

Not to mention you can make better way to say something challenging someone else opinion.

Saying stuff like like "Can you elaborate? What makes this part of JavaFX is badly designed" is another way to explains your point neutrally.

Adding to that, your tone is basically a form of dismissal to the OP's works and the tone as a whole is basically saying "You should do B because A that you're working on is worthless".

2

u/4iffir Jun 21 '21

This makes the library effectively worthless.

For you

6

u/[deleted] Jun 20 '21

[removed] β€” view removed comment

2

u/baubleglue Jun 20 '21

Materialfx is compared to JFoenix library which has MIT license. Probably for some projects doesn't make it an easy replacement.

2

u/[deleted] Jun 21 '21

[removed] β€” view removed comment

1

u/baubleglue Jun 21 '21

That is true.

1

u/wildjokers Jun 21 '21

complain that you can’t use it for free

Can you quote me where I complained it wasn't free? A GPLv3 license is incompatible with writing software for a company, that is an undeniable fact. OP needs to provide a way for companies to use it if they want it to be used. If that is a paid contract, so be it.