Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 16:20 Go to next message
dhruba kumar is currently offline dhruba kumarFriend
Messages: 51
Registered: September 2012
Member
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 34 times)
  • Attachment: custom.PNG
    (Size: 92.21KB, Downloaded 32 times)
Re: background image not showing in column header [message #1817634 is a reply to message #1817615] Wed, 27 November 2019 04:47 Go to previous messageGo to next message
Dirk Fauth is currently offline Dirk FauthFriend
Messages: 2814
Registered: July 2012
Senior Member
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 05:45 Go to previous message
dhruba kumar is currently offline dhruba kumarFriend
Messages: 51
Registered: September 2012
Member
Thanks. Its working
Previous Topic:SWTBot and Nattable: wait until all pending updates are performed
Next Topic:FormulaGrid
Goto Forum:
  


Current Time: Sat Jun 12 12:36:23 GMT 2021

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

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

Back to the top