Arthur Clerc-Gherardi
Arthur Clerc-Gherardi

Reputation: 543

Style on ContextMenu and MenuItem in a TableView

I want to apply some style on my ContextMenu and MenuItem in a TableView. It works simply : Right Click on the Row and you have the ContextMenu for this row. However the ContextMenu and MenuItem are built like that :

final ContextMenu menu = new ContextMenu();
MenuItem removeitem = new MenuItem("Remove");

I tried to apply a CSS like that :

.table-view .context-menu .menu-item

and many others but with no results. However It works when I add the style in my code with setStyle but I want to know if we can do it in CSS (I guess yes ...).

Upvotes: 0

Views: 616

Answers (1)

Oliver Jan Krylow
Oliver Jan Krylow

Reputation: 1725

If it is the label inside the MenuItem you are trying to style use

.table-view .context-menu .menu-item .label
{
   -fx-text-fill: red;
}

The MenuItem itself has no (meaningful?) stylable item s itself, at least the documentation does not list any.

Upvotes: 1

Related Questions