diff --git a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TabsRepresentation.java b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TabsRepresentation.java index 9c35b35f3c..9f8ad27a22 100644 --- a/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TabsRepresentation.java +++ b/app/display/representation-javafx/src/main/java/org/csstudio/display/builder/representation/javafx/widgets/TabsRepresentation.java @@ -55,9 +55,7 @@ public class TabsRepresentation extends JFXBaseRepresentation added) final String name = item.name().getValue(); final Pane content = new Pane(); - // 'Tab's are added with a Label as 'graphic' - // because that label allows setting the font. - - // Quirk: Tabs will not show the label unless there's also a non-empty text - final Tab tab = new Tab(" ", content); - final Label label = new Label(name); - tab.setGraphic(label); + // The title is the tab's own text, with font and color set via the tab's style + // (see updateChanges). It used to be a Label 'graphic' next to a " " text, but the + // menu listing the tabs that do not fit copies only the graphic's text, not its + // color, so those menu entries were invisible until hovered. + final Tab tab = new Tab(name, content); tab.setClosable(false); // !! tab.setUserData(item); @@ -286,17 +282,16 @@ public void updateChanges() if (dirty_layout.checkAndClear()) { - final String style = JFXUtil.shadedStyle(model_widget.propBackgroundColor().getValue()); + // Shading, plus the title font and color, which the tab's label inherits. + // -fx-text-base-color is the color modena.css uses for the tab label text. + final String style = JFXUtil.shadedStyle(model_widget.propBackgroundColor().getValue()) + + JFXUtil.cssFont("-fx-font", tab_font) + + "-fx-text-base-color: black;"; final Background background = new Background(new BackgroundFill(JFXUtil.convert(model_widget.propBackgroundColor().getValue()), null, null)); for (Tab tab : jfx_node.getTabs()) - { // Set the font of the 'graphic' that's used to represent the tab - final Label label = (Label) tab.getGraphic(); - label.setFont(tab_font); - label.setTextFill(Color.BLACK); - - // Set colors + { // Set colors and font tab.setStyle(style); final Pane content = (Pane) tab.getContent();