1

NatTable セルでの画像の使用について質問があります。私の ConfigLabelAccumulator と構成は次のようになります

public class MyConfigLabelAccumulator implements IConfigLabelAccumulator {
  @Override
  public void accumulateConfigLabels(final LabelStack configLabels, final int columnPosition, final int rowPosition) {
    if (((rowPosition + columnPosition) % 2) == 0) {
      configLabels.addLabel("myLabel");
    }
  }
}

public class MyStyleConfiguration extends DefaultNatTableStyleConfiguration {
  @Override
  public void configureRegistry(final IConfigRegistry configRegistry) {
    super.configureRegistry(configRegistry);
    final Style style = new Style();
    style.setAttributeValue(CellStyleAttributes.IMAGE, GUIHelper.getImage("plus"));
    style.setAttributeValue(CellStyleAttributes.BACKGROUND_COLOR, GUIHelper.COLOR_YELLOW);
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_STYLE, style, DisplayMode.NORMAL, "myLabel");
    configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new CellPainterDecorator(new TextPainter(), CellEdgeEnum.RIGHT, new ImagePainter()), DisplayMode.NORMAL);
  }
}   

そして、私はそれをこのように構成します

dataLayer.setConfigLabelAccumulator(new MyConfigLabelAccumulator());
...
natTable.addConfiguration(new MyStyleConfiguration());
...
natTable.configure();   

テーブルは期待どおりに見えます。背景が黄色のセルと、セル内に「+」のイメージが表示されます。しかし、電話の後

natTable.setTheme(new ModernNatTableThemeConfiguration());

黄色の背景のみが表示され、画像は表示されません。

UPD: 私はこれを使用して解決しましIThemeExtensionたが、別の解決策があるかもしれませんか?

4

1 に答える 1