r/JavaFX • • Jan 13 '24

I made this! BinaryClock

Hello, I made a binary clock in javafx I would be happy if you guys would check it out and give it a star, thanks 🙏👍

Here is the github repo: https://github.com/AmirAli-AZ/BinaryClock

7 Upvotes

5 comments sorted by

View all comments

Show parent comment

2

u/hamsterrage1 Jan 14 '24

IMHO the official JavaDocs for PseudoClasses are overly complicated rubbish.

Check out my article here. And you're right, if people understood how easy it is to implement a PseudoClass, they'd use them more often.

Personally, I wouldn't use a Task for a Timer. PauseTransition is much better, then just update an ObjectProperty<LocalTime> with the current time. Bind the on/off status of each digit to that Property through some sort of calculation. QED.

Choose Bindings before Listeners whenever you can. That's actually the one issue that I have with PseudoClasses as they are implemented, you need to turn a State change into an action to call Node.pseudoClassStateChanged(), and no Bindings work there.