private TilePane selectedTilePane; private TilePane currentTilePane; private ImageView selectedImageView; void onMouseClicked(MouseEvent event) { this.resetTileBackgroundColor(); this.selectedImageView = (ImageView) event.getSource(); this.selectedTilePane = (TilePane) this.selectedImageView.getParent(); this.selectedTilePane.setStyle("-fx-background-color:gray"); } void onMouseEntered(MouseEvent event) { this.currentTilePane = (TilePane) event.getSource(); if (!this.currentTilePane.equals(this.selectedTilePane)) { this.currentTilePane.setStyle("-fx-background-color:lightgray"); } } void onMouseExited(MouseEvent event) { this.currentTilePane = (TilePane) event.getSource(); if (!this.currentTilePane.equals(this.selectedTilePane)) { this.currentTilePane.setStyle("-fx-background-color:whitesmoke"); } } private void resetTileBackgroundColor() { tilePane<XXXXX>.setStyle("-fx-background-color:whitesmoke"); }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter