Skip to main content



      Home
Home » Eclipse Projects » NatTable » background image not showing in column header(background image not showing in column header)
background image not showing in column header [message #1817615] Tue, 26 November 2019 11:20 Go to next message
Eclipse UserFriend
In Sample original _4222_CellPainterExample.java , used background image and TextPainter like below:

private void registerColumnHeaderStyle(IConfigRegistry configRegistry) {

Image bgImage = GUIHelper.getImageByURL("columnHeaderBg",
getClass().getResource("/org/eclipse/nebula/widgets/nattable/examples/resources/column_header_bg.png"));
Image selectedBgImage = GUIHelper.getImageByURL("selectedColumnHeaderBg",
getClass().getResource("/org/eclipse/nebula/widgets/nattable/examples/resources/selected_column_header_bg.png"));

TextPainter txtPainter = new TextPainter(false, false);

ICellPainter bgImagePainter =
new BackgroundImagePainter(txtPainter, bgImage, GUIHelper.getColor(192, 192, 192));

The column headers are not displayed completely (see the figure orig.png).

So to add space if we change TextPainter txtPainter = new TextPainter(false, false); to
TextPainter txtPainter = new TextPainter(false, true, 1, true);

The background image is not showing in column header. please see custom.png.

can you please suggest how to use background image in row header and columnheader so that image shows properly in header and and space in columnheader.




  • Attachment: orig.PNG
    (Size: 72.94KB, Downloaded 109 times)
  • Attachment: custom.PNG
    (Size: 92.21KB, Downloaded 118 times)
Re: background image not showing in column header [message #1817634 is a reply to message #1817615] Tue, 26 November 2019 23:47 Go to previous messageGo to next message
Eclipse UserFriend
The second parameter in the TextPainter constructor is paintBg. In the example that renders a background image this is set to false to avoid that the TextPainter itself renders a background. This way the wrapping BackgroundImagePainter is not overpainted. You set it to true, which is wrong for the use case of rendering a background image in a cell.
Re: background image not showing in column header [message #1817637 is a reply to message #1817634] Wed, 27 November 2019 00:45 Go to previous message
Eclipse UserFriend
Thanks. Its working
Previous Topic:SWTBot and Nattable: wait until all pending updates are performed
Next Topic:FormulaGrid
Goto Forum:
  


Current Time: Sat May 24 10:11:03 EDT 2025

Powered by FUDForum. Page generated in 0.03330 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top