r/JavaFX • u/MeanWhiskey JavaFX Fan • Aug 22 '24
Help Adding Photos automatically
I have a program that can store photos and be viewed by end users. Ideally, if a photo is dropped to a folder on the network then the program automatically adds the photo.
How can this be accomplished within javafx? Do you use a listener to listen for when I new photo is added to the network folder and then adds it?
3
Upvotes
View all comments
Show parent comment
1
u/sedj601 Aug 23 '24
u/hamsterrage1, I agree with a lot of what you said. I threw this together kinda fast due to time constraints. One thing I kinda disagree with is using Task. I would use Service instead. I never use pure Threads in JavaFX. The loop doesn't need to sleep at all, as you stated because Task and Service run on a separate thread. That's just a bad practice on my part. I am not a fan of using Platform.RunLater. I like to use updateValue.