Exemplo n.º 1
0
 /**
  * Sets the font that the receiver will use to paint textual information for this item to the font
  * specified by the argument, or to the default font for that kind of control if the argument is
  * null.
  *
  * @param font the new font (or null)
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed
  *     </ul>
  *
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 public void setFont(final Font font) {
   checkWidget();
   if (font != null && font.isDisposed()) {
     error(SWT.ERROR_INVALID_ARGUMENT);
   }
   if (!equals(this.font, font)) {
     this.font = font;
     markCached();
     if (parent.getColumnCount() == 0) {
       parent.updateScrollBars();
     }
     parent.redraw();
   }
 }
Exemplo n.º 2
0
 /**
  * Sets the font that the receiver will use to paint textual information for the specified cell in
  * this item to the font specified by the argument, or to the default font for that kind of
  * control if the argument is null.
  *
  * @param index the column index
  * @param font the new font (or null)
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_INVALID_ARGUMENT - if the argument has been disposed
  *     </ul>
  *
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed
  *       <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver
  *     </ul>
  */
 public void setFont(final int index, final Font font) {
   checkWidget();
   if (font != null && font.isDisposed()) {
     error(SWT.ERROR_INVALID_ARGUMENT);
   }
   int count = Math.max(1, parent.getColumnCount());
   if (index >= 0 && index < count) {
     ensureData(index, count);
     if (!equals(font, data[index].font)) {
       data[index].font = font;
       markCached();
       parent.redraw();
     }
   }
 }