title: JFace TableViewer draw a rectangle on cell like Excel
body: <p>I am trying to achieve a Excel like functionality in a <code>TableViewer</code> to draw a rectangle in a highlighted cell. Below is the code snippet doing this work, but it is not working completely as only left and top edges are getting drawn and I am not able to understand why the bottom and right edges are getting missed!</p>
  
  <p>Code snippet : </p>
  
  <pre><code>private void markFocusedCell(Event event, ViewerCell cell) {
          GC gc = event.gc;
  
          event.gc.setAlpha(200);
          event.gc.setForeground(event.display.getSystemColor(SWT.COLOR_RED));
  
          Rectangle rect = cell.getBounds();
  
          gc.drawRectangle(rect.x, rect.y, rect.width, rect.height);
          event.gc.setForeground(event.display.getSystemColor(SWT.COLOR_BLACK));
  
          event.detail &amp;= ~SWT.SELECTED;
      }
  </code></pre>
  
  <p>Output </p>
  
  <p><img src="https://i.stack.imgur.com/nw5lo.png" alt="enter image description here"></p>