org.eclipse.swt.widgets.List.computeSize()方法的使用及代码示例

x33g5p2x  于2022-01-23 转载在 其他  
字(10.5k)|赞(0)|评价(0)|浏览(152)

本文整理了Java中org.eclipse.swt.widgets.List.computeSize()方法的一些代码示例,展示了List.computeSize()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。List.computeSize()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.List
类名称:List
方法名:computeSize

List.computeSize介绍

暂无

代码示例

代码示例来源:origin: pentaho/pentaho-kettle

void layout() {
 Composite parent = canvas.getParent();
 Rectangle rect = parent.getClientArea();
 int width = 0;
 String[] items = list.getItems();
 GC gc = new GC( list );
 for ( int i = 0; i < objects.length; i++ ) {
  width = Math.max( width, gc.stringExtent( items[i] ).x );
 }
 gc.dispose();
 Point size1 = start.computeSize( SWT.DEFAULT, SWT.DEFAULT );
 Point size2 = stop.computeSize( SWT.DEFAULT, SWT.DEFAULT );
 Point size3 = check.computeSize( SWT.DEFAULT, SWT.DEFAULT );
 Point size4 = label.computeSize( SWT.DEFAULT, SWT.DEFAULT );
 width = Math.max( size1.x, Math.max( size2.x, Math.max( size3.x, width ) ) );
 width = Math.max( 64, Math.max( size4.x, list.computeSize( width, SWT.DEFAULT ).x ) );
 start.setBounds( 0, 0, width, size1.y );
 stop.setBounds( 0, size1.y, width, size2.y );
 check.setBounds( 0, size1.y + size2.y, width, size3.y );
 label.setBounds( 0, rect.height - size4.y, width, size4.y );
 int height = size1.y + size2.y + size3.y;
 list.setBounds( 0, height, width, rect.height - height - size4.y );
 text.setBounds( width, 0, rect.width - width, rect.height );
 canvas.setBounds( width, 0, rect.width - width, rect.height );
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
 public Point computeSize(int wHint, int hHint, boolean changed) {
   // List widget, at least on Windows, forces the preferred height
   if ( hHint == 0 && !isVisible()){
    return( new Point( 0, 0 ));
  }
   Point pt = super.computeSize(wHint, hHint, changed);
   if (hHint == SWT.DEFAULT) {
    Object ld = getLayoutData();
    if (ld instanceof GridData) {
      if (((GridData)ld).grabExcessVerticalSpace) {
        pt.y = 20;
      }
    }
   }
   return pt;
 }
};

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
 public Point computeSize(int wHint, int hHint, boolean changed) {
   // List widget, at least on Windows, forces the preferred height
   if ( hHint == 0 && !isVisible()){
    return( new Point( 0, 0 ));
  }
   Point pt = super.computeSize(wHint, hHint, changed);
   if (hHint == SWT.DEFAULT) {
    Object ld = getLayoutData();
    if (ld instanceof GridData) {
      if (((GridData)ld).grabExcessVerticalSpace) {
        pt.y = 20;
      }
    }
   }
   return pt;
 }
};

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

public Point computeSize (int wHint, int hHint, boolean changed) {
 checkWidget ();
 int width = 0, height = 0;
 String[] items = list.getItems ();
 int textWidth = 0;
 GC gc = new GC (text);
 int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
 for (int i = 0; i < items.length; i++) {
  textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
 }
 gc.dispose();
 Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
 // Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
 Point arrowSize = new Point(16, 16);
 Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
 int borderWidth = getBorderWidth ();
 
 height = Math.max (textSize.y, arrowSize.y);
 width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x);
 if (wHint != SWT.DEFAULT) width = wHint;
 if (hHint != SWT.DEFAULT) height = hHint;
 return new Point (width + 2*borderWidth, height + 2*borderWidth);
}
void createPopup(String[] items, int selectionIndex) {

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

@Override
public Point computeSize (int wHint, int hHint, boolean changed) {
  checkWidget ();
  int width = 0, height = 0;
  String[] items = list.getItems ();
  GC gc = new GC (text);
  int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
  int textWidth = gc.stringExtent (text.getText ()).x;
  for (int i = 0; i < items.length; i++) {
    textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
  }
  gc.dispose ();
  Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  int borderWidth = getBorderWidth ();

  height = Math.max (textSize.y, arrowSize.y);
  width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x);
  if (wHint != SWT.DEFAULT) width = wHint;
  if (hHint != SWT.DEFAULT) height = hHint;
  return new Point (width + 2*borderWidth, height + 2*borderWidth);
}
/**

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

public Point computeSize (int wHint, int hHint, boolean changed) {
  checkWidget ();
  int width = 0, height = 0;
  String[] items = list.getItems ();
  GC gc = new GC (text);
  int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
  int textWidth = gc.stringExtent (text.getText ()).x;
  for (int i = 0; i < items.length; i++) {
    textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
  }
  gc.dispose ();
  Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  int borderWidth = getBorderWidth ();
  
  height = Math.max (textSize.y, arrowSize.y);
  width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x);
  if (wHint != SWT.DEFAULT) width = wHint;
  if (hHint != SWT.DEFAULT) height = hHint;
  return new Point (width + 2*borderWidth, height + 2*borderWidth);
}
/**

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

@Override
public Point computeSize (int wHint, int hHint, boolean changed) {
  checkWidget ();
  int width = 0, height = 0;
  String[] items = list.getItems ();
  GC gc = new GC (text);
  int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
  int textWidth = gc.stringExtent (text.getText ()).x;
  for (int i = 0; i < items.length; i++) {
    textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
  }
  gc.dispose ();
  Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  int borderWidth = getBorderWidth ();

  height = Math.max (textSize.y, arrowSize.y);
  width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x);
  if (wHint != SWT.DEFAULT) width = wHint;
  if (hHint != SWT.DEFAULT) height = hHint;
  return new Point (width + 2*borderWidth, height + 2*borderWidth);
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

@Override
public Point computeSize (int wHint, int hHint, boolean changed) {
  checkWidget ();
  int width = 0, height = 0;
  String[] items = list.getItems ();
  GC gc = new GC (text);
  int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
  int textWidth = gc.stringExtent (text.getText ()).x;
  for (int i = 0; i < items.length; i++) {
    textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
  }
  gc.dispose ();
  Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  int borderWidth = getBorderWidth ();

  height = Math.max (textSize.y, arrowSize.y);
  width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x);
  if (wHint != SWT.DEFAULT) width = wHint;
  if (hHint != SWT.DEFAULT) height = hHint;
  return new Point (width + 2*borderWidth, height + 2*borderWidth);
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

@Override
public Point computeSize (int wHint, int hHint, boolean changed) {
  checkWidget ();
  int width = 0, height = 0;
  String[] items = list.getItems ();
  GC gc = new GC (text);
  int spacer = gc.stringExtent (" ").x; //$NON-NLS-1$
  int textWidth = gc.stringExtent (text.getText ()).x;
  for (int i = 0; i < items.length; i++) {
    textWidth = Math.max (gc.stringExtent (items[i]).x, textWidth);
  }
  gc.dispose ();
  Point textSize = text.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  Point arrowSize = arrow.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  Point listSize = list.computeSize (SWT.DEFAULT, SWT.DEFAULT, changed);
  int borderWidth = getBorderWidth ();

  height = Math.max (textSize.y, arrowSize.y);
  width = Math.max (textWidth + 2*spacer + arrowSize.x + 2*borderWidth, listSize.x);
  if (wHint != SWT.DEFAULT) width = wHint;
  if (hHint != SWT.DEFAULT) height = hHint;
  return new Point (width + 2*borderWidth, height + 2*borderWidth);
}
/**

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

Point listSize = list.computeSize (rect.width, SWT.DEFAULT, false);
Rectangle screenSize = shell.getDisplay().getBounds();

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

Point listSize = list.computeSize (rect.width, SWT.DEFAULT, false);
Rectangle screenSize = shell.getDisplay().getBounds();

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

Point listSize = list.computeSize (rect.width, SWT.DEFAULT, false);
Rectangle screenSize = shell.getDisplay().getBounds();

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

Point listSize = list.computeSize (rect.width, SWT.DEFAULT, false);
Rectangle screenSize = shell.getDisplay().getBounds();

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

Point listSize = list.computeSize (rect.width, SWT.DEFAULT, false);
Rectangle screenSize = shell.getDisplay().getBounds();

代码示例来源:origin: org.eclipse/org.eclipse.wst.xsd.ui

itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount);
int itemHeight = list.getItemHeight () * itemCount;
Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false);
list.setBounds (1, 1, Math.max (size.x - 2, listSize.x), listSize.y);

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount);
int itemHeight = list.getItemHeight () * itemCount;
Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false);
Rectangle displayRect = getMonitor ().getClientArea ();
list.setBounds (1, 1, Math.max (comboSize.x - 2, Math.min(listSize.x, displayRect.width - 2)), listSize.y);

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount);
int itemHeight = list.getItemHeight () * itemCount;
Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false);
Rectangle displayRect = getMonitor ().getClientArea ();
list.setBounds (1, 1, Math.max (comboSize.x - 2, Math.min(listSize.x, displayRect.width - 2)), listSize.y);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount);
int itemHeight = list.getItemHeight () * itemCount;
Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false);
Rectangle displayRect = getMonitor ().getClientArea ();
list.setBounds (1, 1, Math.max (comboSize.x - 2, Math.min(listSize.x, displayRect.width - 2)), listSize.y);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount);
int itemHeight = list.getItemHeight () * itemCount;
Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false);
Rectangle displayRect = getMonitor ().getClientArea ();
list.setBounds (1, 1, Math.max (comboSize.x - 2, Math.min(listSize.x, displayRect.width - 2)), listSize.y);

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

itemCount = (itemCount == 0) ? visibleItemCount : Math.min(visibleItemCount, itemCount);
int itemHeight = list.getItemHeight () * itemCount;
Point listSize = list.computeSize (SWT.DEFAULT, itemHeight, false);
Rectangle displayRect = getMonitor ().getClientArea ();
list.setBounds (1, 1, Math.max (comboSize.x - 2, Math.min(listSize.x, displayRect.width - 2)), listSize.y);

相关文章

微信公众号

最新文章

更多

List类方法