开发者

SWT Table.setLinesVisible(false) does not seem to work on Windows 7

开发者 https://www.devze.com 2023-03-05 23:01 出处:网络
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 t

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):

SWT Table.setLinesVisible(false) does not seem to work on Windows 7

After (in Windows 7 - thumbs down [Notice the black lines]):

SWT Table.setLinesVisible(false) does not seem to work on Windows 7

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):

SWT Table.setLinesVisible(false) does not seem to work on Windows 7

And now with the listener added:

SWT Table.setLinesVisible(false) does not seem to work on Windows 7

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号