简体   繁体   English

更改NatTable中的选定行颜色

[英]Change selected row color in NatTable

How do I change the default row selection color? 如何更改默认的行选择颜色? I do not see where to access this in the code snippet below: 我在下面的代码片段中看不到该位置:

    SelectionLayer selectionLayer = glazedListsGridLayer.getBodyLayerStack()
       .getSelectionLayer();

    selectionLayer.setSelectionModel(new RowSelectionModel<T>(selectionLayer,
            glazedListsGridLayer.getBodyDataProvider(), myRowIdAccessor));

You need to register a style for the DisplayMode.SELECT. 您需要为DisplayMode.SELECT注册样式。 This can be done with a custom style configuration, a theme configuration or CSS if you are in an Eclipse 4 application. 如果您在Eclipse 4应用程序中,则可以使用定制样式配置,主题配置或CSS来完成。

To get a basic understanding of the styling concepts have a look here: https://eclipse.org/nattable/documentation.php?page=styling 要基本了解样式概念,请在此处查看: https : //eclipse.org/nattable/documentation.php?page= styling

To see how the default selection style configuration is configured check the DefaultSelectionStyleConfiguration 若要查看如何配置默认选择样式配置,请检查DefaultSelectionStyleConfiguration

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM