コード例 #1
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();
     }
   }
 }
コード例 #2
0
 /**
  * Sets the foreground color at the given column index in the receiver to the color specified by
  * the argument, or to the default system color for the item if the argument is null.
  *
  * @param index the column index
  * @param color the new color (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 setForeground(final int index, final Color color) {
   checkWidget();
   if (color != null && color.isDisposed()) {
     error(SWT.ERROR_INVALID_ARGUMENT);
   }
   int count = Math.max(1, parent.getColumnCount());
   if (index >= 0 && index < count) {
     ensureData(index, count);
     if (!equals(data[index].foreground, color)) {
       data[index].foreground = color;
       markCached();
       parent.redraw();
     }
   }
 }
コード例 #3
0
 /**
  * Sets the receiver's text at a column
  *
  * @param index the column index
  * @param text the new text
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_NULL_ARGUMENT - if the text is null
  *     </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 setText(final int index, final String text) {
   checkWidget();
   if (text == null) {
     SWT.error(SWT.ERROR_NULL_ARGUMENT);
   }
   int count = Math.max(1, parent.getColumnCount());
   if (index >= 0 && index < count) {
     ensureData(index, count);
     if (!text.equals(data[index].text)) {
       data[index].text = text;
       markCached();
       if (parent.getColumnCount() == 0) {
         parent.updateScrollBars();
       }
       parent.redraw();
     }
   }
 }
コード例 #4
0
 /**
  * Sets the receiver's image at a column.
  *
  * @param index the column index
  * @param image the new image
  * @exception IllegalArgumentException
  *     <ul>
  *       <li>ERROR_INVALID_ARGUMENT - if the image 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 setImage(final int index, final Image image) {
   checkWidget();
   if (image != null && image.isDisposed()) {
     error(SWT.ERROR_INVALID_ARGUMENT);
   }
   int count = Math.max(1, parent.getColumnCount());
   if (index >= 0 && index < count) {
     ensureData(index, count);
     if (!equals(data[index].image, image)) {
       parent.updateColumnImageCount(index, data[index].image, image);
       data[index].image = image;
       parent.updateItemImageSize(image);
       markCached();
       if (parent.getColumnCount() == 0) {
         parent.updateScrollBars();
       }
       parent.redraw();
     }
   }
 }