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

x33g5p2x  于2022-01-29 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(122)

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

Text.setBounds介绍

暂无

代码示例

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

public void handleEvent( Event e ) {
  Rectangle rect = composite.getClientArea();
  text.setBounds( rect.x + inset, rect.y + inset, rect.width - inset * 2, rect.height - inset * 2 );
 }
} );

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

public void handleEvent( Event e ) {
  Rectangle rect = composite.getClientArea();
  text.setBounds( rect.x + inset, rect.y + inset, rect.width - inset * 2, rect.height - inset * 2 );
 }
} );

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

public void handleEvent( Event e ) {
  Rectangle rect = composite.getClientArea();
  text.setBounds( rect.x + inset, rect.y + inset, rect.width - inset * 2, rect.height - inset * 2 );
 }
} );

代码示例来源:origin: caoxinyu/RedisClient

channel.setBounds(0, 0, 88, 23);
channel.addControlListener(new ControlAdapter() {
  @Override

代码示例来源:origin: caoxinyu/RedisClient

channel.setBounds(0, 0, 73, 21);
channel.addControlListener(new ControlAdapter() {
  @Override
message.setBounds(0, 0, 73, 21);

代码示例来源: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: org.eclipse/org.eclipse.wst.server.ui

public void handleEvent(Event e) {
    Point textSize = textEditor.computeSize(SWT.DEFAULT,
        SWT.DEFAULT);
    textSize.x += textSize.y; // Add extra space for new
    // characters.
    Point parentSize = textEditorParent.getSize();
    textEditor.setBounds(2, inset, Math.min(textSize.x,
        parentSize.x - 4), parentSize.y - 2 * inset);
    textEditorParent.redraw();
  }
});

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

public void handleEvent(Event e) {
    Point textSize = textEditor.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    textSize.x += textSize.y; // Add extra space for new characters.
    Point parentSize = textEditorParent.getSize();
    textEditor.setBounds(2, 1, Math.min(textSize.x, parentSize.x - 4), parentSize.y - 2);
    textEditorParent.redraw();
  }
});

代码示例来源:origin: openaudible/openaudible

public static Text newShortTextInput(Composite parent, String title, int textLimit, int width) {
  Text t = newInput(parent, title, SWT.BORDER);
  
  t.setTextLimit(textLimit);
  Rectangle r = t.getBounds();
  r.width = width;
  t.setBounds(r);
  t.setSize(width, r.height);
  t.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
  return t;
}

代码示例来源:origin: openaudible/openaudible

public Text newShortTextInput(int textLimit, int width) {
  Text t = newInput(this, null, SWT.BORDER);
  t.setTextLimit(textLimit);
  Rectangle r = t.getBounds();
  r.width = width;
  t.setBounds(r);
  t.setSize(width, r.height);
  t.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
  return t;
}

代码示例来源:origin: atdl4j/atdl4j

void resize() {
  Point pt = computeSize(SWT.DEFAULT, SWT.DEFAULT);
  int textWidth = pt.x - BUTTON_WIDTH;
  int buttonHeight = pt.y / 2;
  text.setBounds(0, 0, textWidth, pt.y);
  up.setBounds(textWidth, -3, BUTTON_WIDTH, buttonHeight);
  down.setBounds(textWidth, pt.y - buttonHeight - 3, BUTTON_WIDTH,
      buttonHeight);
}

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

void internalLayout (boolean changed) {
 if (isDropped ()) dropDown (false);
 Rectangle rect = getClientArea ();
 int width = rect.width;
 int height = rect.height;
 // Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed);
 // text.setBounds (0, 0, width - arrowSize.x, height);
 text.setBounds (0, 0, width - 16, height);
 // arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
 arrow.setBounds (width - 16, 0, 16, 16);
}
void listEvent (Event event) {

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

void internalLayout (boolean changed) {
  if (isDropped ()) dropDown (false);
  Rectangle rect = getClientArea ();
  int width = rect.width;
  int height = rect.height;
  Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed);
  text.setBounds (0, 0, width - arrowSize.x, height);
  arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
}
void listEvent (Event event) {

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

void internalLayout (boolean changed) {
  if (isDropped ()) dropDown (false);
  Rectangle rect = getClientArea ();
  int width = rect.width;
  int height = rect.height;
  Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed);
  text.setBounds (0, 0, width - arrowSize.x, height);
  arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
}
void listEvent (Event event) {

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

void internalLayout (boolean changed) {
  if (isDropped ()) dropDown (false);
  Rectangle rect = getClientArea ();
  int width = rect.width;
  int height = rect.height;
  Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed);
  text.setBounds (0, 0, width - arrowSize.x, height);
  arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
}
void listEvent (Event event) {

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

void internalLayout (boolean changed) {
  if (isDropped ()) dropDown (false);
  Rectangle rect = getClientArea ();
  int width = rect.width;
  int height = rect.height;
  Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed);
  text.setBounds (0, 0, width - arrowSize.x, height);
  arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
}
void listEvent (Event event) {

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

void internalLayout (boolean changed) {
  if (isDropped ()) dropDown (false);
  Rectangle rect = getClientArea ();
  int width = rect.width;
  int height = rect.height;
  Point arrowSize = arrow.computeSize (SWT.DEFAULT, height, changed);
  text.setBounds (0, 0, width - arrowSize.x, height);
  arrow.setBounds (width - arrowSize.x, 0, arrowSize.x, arrowSize.y);
}
void listEvent (Event event) {

代码示例来源:origin: net.officefloor.eclipse/net.officefloor.ui

@Override
  public void relocate(CellEditor celleditor) {
    // Obtain the location
    IFigure figure = OfficeFloorDirectEditPolicy.this.initialiser
        .getLocationFigure();
    Rectangle rect = figure.getBounds().getCopy();
    figure.translateToAbsolute(rect);
    // Obtain the preferred size
    Text text = (Text) celleditor.getControl();
    Point pref = text.computeSize(SWT.DEFAULT, SWT.DEFAULT);
    // Position the cell editor text box
    text.setBounds(rect.x, rect.y, pref.x, pref.y);
  }
};

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples

/**
 * Layout the list and text widgets according to the new
 * positions of the sashes..events.SelectionEvent
 */
void layout () {
  Rectangle clientArea = sashComp.getClientArea ();
  Rectangle hSashBounds = hSash.getBounds ();
  Rectangle vSashBounds = vSash.getBounds ();
  list1.setBounds (0, 0, vSashBounds.x, hSashBounds.y);
  list2.setBounds (vSashBounds.x + vSashBounds.width, 0, clientArea.width - (vSashBounds.x + vSashBounds.width), hSashBounds.y);
  text.setBounds (0, hSashBounds.y + hSashBounds.height, clientArea.width, clientArea.height - (hSashBounds.y + hSashBounds.height));
  /**
  * If the horizontal sash has been moved then the vertical
  * sash is either too long or too short and its size must
  * be adjusted.
  */
  vSashBounds.height = hSashBounds.y;
  vSash.setBounds (vSashBounds);
}
/**

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

public void relocate(CellEditor celleditor)
 {
  Text text = (Text) celleditor.getControl();

  Label label = namedEditPart.getNameLabelFigure();
  
  if (text.getBounds().x <= 0)
  {
   super.relocate(celleditor);  
  }
  else
  {
   org.eclipse.swt.graphics.Point sel = text.getSelection();
   org.eclipse.swt.graphics.Point pref = text.computeSize(-1, -1);
   Rectangle rect = label.getTextBounds().getCopy();
   label.translateToAbsolute(rect);
   text.setBounds(rect.x, rect.y-1, rect.width, pref.y+1);
   text.setSelection(0);
   text.setSelection(sel); 
  }
 }
}

相关文章

Text类方法