Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java

How to make multiple seperate buttons out of a continuos image in javafx/fxml.

Hello! My problem is like this: I an currently working on a glossary of the human body and i need it to be heavy reliant on visual interface. The idea is to add a map of the body*, from where the users should able to select head, torso, arms or legs. It should be one continuous image that sends to different fxml files when clicked. I would also need to be able to use some :hover css styling to make each zone glow a little when hovered. Please tell me if I am missing any key info.

*Example image: https://annoyedcritic.files.wordpress.com/2015/03/human-body-image-31257066.jpg

1 Answer

one way to achieve this is to create a method to add a CSS style when a particular area is hovered over. this would require you to create multiple different versions of the image. You will need one image each section that is styled how you want it to look when hovered. you can then simply change the image using your pre-defined method that applies a style.