SWT Table.setLinesVisible(false) does not seem to work on Windows 7
Our company is trying to move everyone from Window XP to Windows 7, so I'm testing some of the home-grown SWT applications to make sure that they still work on Windows 7. Most of them still do, but there's some weird quirks. I've been able to work out most of them, but the one here I'm having no luck with.
SWT Tables always seem to have an ugly black line between columns. I'开发者_如何学编程ve tried calling setLinesVisible(false), but to no avail. I know this doesn't seem like an important difference, but our users can be quite picky. Has anyone had similar experiences of migrating apps to windows 7 or have any suggestions on what I can try?
Before (in XP - thumbs up):
After (in Windows 7 - thumbs down [Notice the black lines]):
Any suggestions?
Try adding the following listener to your table:
//Assuming your table is named 'table' and 'backgroundColor' is the
//color you're using to paint it's background.
table.addListener(SWT.EraseItem, new Listener() {
@Override
public void handleEvent(Event event) {
event.gc.setBackground(backgroundColor);
event.gc.fillRectangle(event.getBounds());
}
});
This should solve your problems with vertical lines. Here's how it looks on my example table:
Without the listener (notice the vertical lines, they are not black in my case, they're gray..but they're still visible):
And now with the listener added:
精彩评论