本文整理了Java中org.eclipse.swt.widgets.Label.setBounds()
方法的一些代码示例,展示了Label.setBounds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Label.setBounds()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Label
类名称:Label
方法名:setBounds
暂无
代码示例来源:origin: caoxinyu/RedisClient
lblNewLabel.setBounds(0, 0, 55, 15);
lblNewLabel.setText(RedisClient.i18nFile.getText(I18nFile.CHANNEL));
代码示例来源:origin: caoxinyu/RedisClient
btnNewButton_1.setBounds(0, 0, 80, 27);
btnNewButton_1.setImage(scaled050);
代码示例来源: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.e4.ui.workbench.addons/swt
public ActiveRegion(Rectangle rect, Listener listener) {
label = new Label(overlayShell, SWT.NONE);
label.setBounds(rect);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.addons.swt
public ActiveRegion(Rectangle rect, Listener listener) {
label = new Label(overlayShell, SWT.NONE);
label.setBounds(rect);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
public Shell open (Display display) {
Shell shell = new Shell (display);
Label label = new Label (shell, SWT.CENTER);
label.setText (resHello.getString("Hello_world"));
label.setBounds (shell.getClientArea ());
shell.open ();
return shell;
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
@Override
public void layout(Composite editor, boolean force) {
Rectangle bounds = editor.getClientArea();
Point colorSize = colorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT,
force);
Point rgbSize = rgbLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT,
force);
int ty = (bounds.height - rgbSize.y) / 2;
if (ty < 0) {
ty = 0;
}
colorLabel.setBounds(-1, 0, colorSize.x, colorSize.y);
rgbLabel.setBounds(colorSize.x + GAP - 1, ty, bounds.width
- colorSize.x - GAP, bounds.height);
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
@Override
public void layout(Composite editor, boolean force) {
Rectangle bounds = editor.getClientArea();
Point colorSize = colorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT,
force);
Point rgbSize = rgbLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT,
force);
int ty = (bounds.height - rgbSize.y) / 2;
if (ty < 0) {
ty = 0;
}
colorLabel.setBounds(-1, 0, colorSize.x, colorSize.y);
rgbLabel.setBounds(colorSize.x + GAP - 1, ty, bounds.width
- colorSize.x - GAP, bounds.height);
}
}
代码示例来源:origin: biz.aQute/aQute.bnd
lblRepository.setBounds(8, 8, 160, 24);
lblRepository.setText("Repository");
lblBundleSymbolicName.setBounds(8, 40, 160, 24);
lblBundleSymbolicName.setText("Bundle Symbolic Name");
lblVersion.setBounds(8, 72, 160, 24);
lblVersion.setText("Bundle Version");
代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.examples
public Shell open (Display display) {
final Shell shell = new Shell (display);
final Label label = new Label (shell, SWT.CENTER);
label.setText (resHello.getString("Hello_world"));
label.pack();
shell.addControlListener(ControlListener.controlResizedAdapter(e -> label.setBounds (shell.getClientArea ())));
shell.pack();
shell.open ();
return shell;
}
}
代码示例来源:origin: biz.aQute/bnd
lblRepository.setBounds(8, 8, 160, 24);
lblRepository.setText("Repository");
lblBundleSymbolicName.setBounds(8, 40, 160, 24);
lblBundleSymbolicName.setText("Bundle Symbolic Name");
lblVersion.setBounds(8, 72, 160, 24);
lblVersion.setText("Bundle Version");
lblBundleDescription.setBounds(8, 105, 160, 24);
lblBundleDescription.setText("Bundle Description");
代码示例来源:origin: stefanhaustein/flowgrid
void setPosition(int row, int col, int height, int width) {
if (row != this.row || col != this.col || height != this.height || width != this.width) {
int newX = sge.screenX(col);
int newY = sge.screenY(row);
int newW = Math.round(cellSize * width);
int newH = Math.round(cellSize * height);
int oldX = sge.screenX(this.col);
int oldY = sge.screenY(this.row);
int oldW = Math.round(cellSize * this.width);
int oldH = Math.round(cellSize * this.height);
this.row = row;
this.col = col;
this.height = height;
this.width = width;
menuAnchor.setBounds(newX, newY, newW, newH);
System.err.println("bounds: " + menuAnchor.getBounds());
redraw(oldX, oldY, oldW, oldH, true);
redraw(newX, newY, newW, newH, true);
}
}
代码示例来源: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.platform/org.eclipse.swt.examples
void handleResize(ControlEvent event) {
Rectangle rect = shell.getClientArea();
Point cSize = coolBar.computeSize(rect.width, SWT.DEFAULT);
Point sSize = statusBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
int statusMargin = 2;
coolBar.setBounds(rect.x, rect.y, cSize.x, cSize.y);
styledText.setBounds(rect.x, rect.y + cSize.y, rect.width, rect.height - cSize.y - (sSize.y + 2 * statusMargin));
statusBar.setBounds(rect.x + statusMargin, rect.y + rect.height - sSize.y - statusMargin, rect.width - (2 * statusMargin), sSize.y);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt
@Override
protected void layout(Composite composite, boolean flushCache) {
Rectangle bounds = composite.getBounds();
if (composite.getChildren().length == 1) {
composite.getChildren()[0].setBounds(composite
.getBounds());
} else if (composite.getChildren().length == 3) {
Label label = (Label) composite.getChildren()[0];
Label separator = (Label) composite.getChildren()[1];
Control partCtrl = composite.getChildren()[2];
// if the label is empty, give it a zero size
int labelHeight = !label.getText().isEmpty() ? label
.computeSize(bounds.width, SWT.DEFAULT).y : 0;
label.setBounds(0, 0, bounds.width, labelHeight);
int separatorHeight = labelHeight > 0 ? separator
.computeSize(bounds.width, SWT.DEFAULT).y : 0;
separator.setBounds(0, labelHeight, bounds.width,
separatorHeight);
partCtrl.setBounds(0, labelHeight + separatorHeight,
bounds.width, bounds.height - labelHeight
- separatorHeight);
}
}
});
代码示例来源:origin: stefanhaustein/flowgrid
menuAnchor.setBounds(-1, -1, 1, 1);
代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt
@Override
protected void layout(Composite composite, boolean flushCache) {
Rectangle bounds = composite.getBounds();
if (composite.getChildren().length == 1) {
composite.getChildren()[0].setBounds(composite
.getBounds());
} else if (composite.getChildren().length == 3) {
Label label = (Label) composite.getChildren()[0];
Label separator = (Label) composite.getChildren()[1];
Control partCtrl = composite.getChildren()[2];
// if the label is not visible, give it a zero size
int labelHeight = label.isVisible() ? label
.computeSize(bounds.width, SWT.DEFAULT).y : 0;
label.setBounds(0, 0, bounds.width, labelHeight);
int separatorHeight = separator.isVisible() ? separator
.computeSize(bounds.width, SWT.DEFAULT).y : 0;
separator.setBounds(0, labelHeight, bounds.width,
separatorHeight);
partCtrl.setBounds(0, labelHeight + separatorHeight,
bounds.width, bounds.height - labelHeight
- separatorHeight);
}
}
});
代码示例来源:origin: org.eclipse.xtext/ui
public void freeze() {
release();
if (sourceViewer instanceof SourceViewer) {
Control viewerControl = ((SourceViewer) sourceViewer).getControl();
if (viewerControl instanceof Composite) {
Composite composite = (Composite) viewerControl;
Display display = composite.getDisplay();
// Flush pending redraw requests:
while (!display.isDisposed() && display.readAndDispatch()) {
}
// Copy editor area:
GC gc = new GC(composite);
Point size;
try {
size = composite.getSize();
image = new Image(gc.getDevice(), size.x, size.y);
gc.copyArea(image, 0, 0);
} finally {
gc.dispose();
gc = null;
}
// Persist editor area while executing refactoring:
label = new Label(composite, SWT.NONE);
label.setImage(image);
label.setBounds(0, 0, size.x, size.y);
label.moveAbove(null);
}
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
@Override
public IProgressMonitor getBundleProgressMonitor() {
if (monitor == null) {
Composite parent = new Composite(getSplash(), Window.getDefaultOrientation());
Point size = getSplash().getSize();
parent.setBounds(new Rectangle(0,0,size.x,size.y));
monitor = new AbsolutePositionProgressMonitorPart(parent);
monitor.setSize(size);
if (progressRect != null)
monitor.getProgressIndicator().setBounds(progressRect);
else
monitor.getProgressIndicator().setVisible(false);
if (messageRect != null)
monitor.getProgressText().setBounds(messageRect);
else
monitor.getProgressText().setVisible(false);
if (foreground != null)
monitor.getProgressText().setForeground(foreground);
monitor.setBackgroundMode(SWT.INHERIT_FORCE);
monitor.setBackgroundImage(getSplash().getShell()
.getBackgroundImage());
}
return monitor;
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
label.setBounds(0, 0, size.x, size.y);
label.moveAbove(null);
内容来源于网络,如有侵权,请联系作者删除!