Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,7 @@ public class TabsRepresentation extends JFXBaseRepresentation<TabPane, TabsWidge
for (int i=0; i<model_tabs.size(); ++i)
if (model_tabs.get(i).name() == property)
{
final Tab tab = jfx_node.getTabs().get(i);
final Label label = (Label) tab.getGraphic();
label.setText(property.getValue());
jfx_node.getTabs().get(i).setText(property.getValue());
break;
}
};
Expand Down Expand Up @@ -200,13 +198,11 @@ private void addTabs(final List<TabItemProperty> 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);

Expand Down Expand Up @@ -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();
Expand Down
Loading