Пример #1
0
 private int getTextWidth(final int index) {
   int result = 0;
   String text = getText(index);
   if (text.length() > 0) {
     result = Graphics.stringExtent(parent.getFont(), text).x;
   }
   return result;
 }
Пример #2
0
 /**
  * Returns the font that the receiver will use to paint textual information for this item.
  *
  * @return the receiver's font
  * @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 Font getFont() {
   checkWidget();
   if (!parent.checkData(this, parent.indexOf(this))) {
     error(SWT.ERROR_WIDGET_DISPOSED);
   }
   Font result;
   if (font == null) {
     result = parent.getFont();
   } else {
     result = font;
   }
   return result;
 }