Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+16 votes

I am currently trying to add a hover feature for our filters tab. Currently, our filters tab is only accessed after the user clicks on the filters button. However, I would like to make the filters tab show after the user simply hovers over the filters button. After some research, I think it might have something to do with CSS but I am not 100% certain about that. Anything would help right now!

asked in CSC305 Fall 2023 by (1 point)

Does the user get the most details when they hoover over the image?

2 Answers

+8 votes

First, you'll need to set up your JavaFX scene with a button and a panel (or any container) for your filters.

Button filtersButton = new Button("Filters");
filtersButton.setId("filters-button"); // Set an ID for CSS targeting

VBox filtersContent = new VBox();
filtersContent.setVisible(false); // Initially hidden

// Add filters to filtersContent VBox here, make filtersContent visible when filtersButton is hovered over
filtersButton.setOnMouseEntered(e -> filtersContent.setVisible(true));
filtersButton.setOnMouseExited(e -> filtersContent.setVisible(false));

Then CSS

filters-button {

/* Button styling */


filters-content {

/* Filters styling */
/* You can add transitions for smooth appearance */
-fx-transition: all 0.3s ease;


Additionally you have to link the javafx to the css

answered by (2.1k points)

Thank you, I will try this!

+8 votes

You maybe able to use Tooltip. Our team implemented hover feature simply with Tooltip.
This the documenation, you can check out: https://docs.oracle.com/javase/8/javafx/api/javafx/scene/control/Tooltip.html

answered by (241 points)