本文整理了Java中org.eclipse.swt.widgets.Shell.setBounds()
方法的一些代码示例,展示了Shell.setBounds()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.setBounds()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:setBounds
暂无
代码示例来源:origin: pentaho/pentaho-kettle
/**
* Overridden to auto-size the shell according to the selected width.
*/
@Override
protected void constrainShellSize() {
super.constrainShellSize();
try {
// the shell property within the Windows class is private - need to access it via reflection
final Field shellField = Window.class.getDeclaredField( "shell" );
shellField.setAccessible( true );
final Shell thisShell = (Shell) shellField.get( this );
thisShell.pack();
final int height = thisShell.computeSize( width, SWT.DEFAULT ).y;
thisShell.setBounds( thisShell.getBounds().x, thisShell.getBounds().y, width + 4, height + 2 );
} catch ( final Exception e ) {
// nothing to do
}
}
代码示例来源:origin: pentaho/pentaho-kettle
shell.setBounds( rectangle );
shellSize.height = computedSize.y;
shell.setBounds( shellSize );
resizedRect.y = monitorClientArea.y + ( monitorClientArea.height - resizedRect.height ) / 2;
shell.setBounds( resizedRect );
代码示例来源:origin: stackoverflow.com
Text tfNext = new Text(shell, SWT.BORDER);
tfNext.setText("TF without tooltip");
shell.setBounds(50, 50, 300, 200);
shell.open();
while (!shell.isDisposed()) {
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
@Override
public void setBounds( Rectangle bounds ) {
Shell.this.setBounds( bounds, false );
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
public void run() {
if (!shell.isDisposed())
// RAP [bm]: SWT.RIGHT_TO_LEFT missing
// shell.setBounds(bounds.x + ((getDefaultOrientation() == SWT.RIGHT_TO_LEFT) ? trayWidth : 0), bounds.y, bounds.width - trayWidth, bounds.height);
shell.setBounds(bounds.x + 0, bounds.y, bounds.width - trayWidth, bounds.height);
// RAPEND: [bm]
}
});
代码示例来源:origin: org.eclipse/org.eclipse.help.ui
private static void setSafeBounds(Shell s, int x, int y, int width,
int height) {
Rectangle clientArea = s.getDisplay().getClientArea();
width = Math.min(clientArea.width, width);
height = Math.min(clientArea.height, height);
x = Math.min(x + width, clientArea.x + clientArea.width) - width;
y = Math.min(y + height, clientArea.y + clientArea.height) - height;
x = Math.max(x, clientArea.x);
y = Math.max(y, clientArea.y);
s.setBounds(x, y, width, height);
}
public void setLocation(int x, int y) {
代码示例来源:origin: stackoverflow.com
Image image = new Image(display, "c:\\picture.jpeg");
Shell shell = new Shell(SWT.NO_TRIM);
shell.setBounds(10,10,200,200);
shell.setBackgroundImage(image);
shell.setBackgroundMode(SWT.INHERIT_DEFAULT);
Label label = new Label(shell, SWT.NONE);
label.setText("LAbel text here. ");
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
/**
* Initialize the dialog bounds with the bounds saved
* from the settings.
*/
@Override
protected void initializeBounds() {
if (bounds != null) {
getShell().setBounds(bounds);
} else {
super.initializeBounds();
}
}
代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt
public void run() {
clearSizeUpdate();
while (!windowsToUpdate.isEmpty()) {
MWindow window = windowsToUpdate.remove(0);
Shell shell = (Shell) window.getWidget();
if (shell == null || shell.isDisposed())
continue;
shell.setBounds(window.getX(), window.getY(),
window.getWidth(), window.getHeight());
}
}
}
代码示例来源:origin: org.microemu/microemu-javase-swt
protected void initializeBounds()
{
if (resizeListener != null) {
shell.removeListener(SWT.Resize,resizeListener);
}
if (resizeHasOccurred) { // Check if shell size has been set already.
return;
}
Point size = getInitialSize();
Point location = getInitialLocation(size);
shell.setBounds(location.x, location.y, size.x, size.y);
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.jface
/**
* Constrain the shell size to be no larger than the display bounds.
*
* @since 2.0
*/
protected void constrainShellSize() {
// limit the shell size to the display size
Rectangle bounds = shell.getBounds();
Rectangle constrained = getConstrainedShellBounds(bounds);
if (!bounds.equals(constrained)) {
shell.setBounds(constrained);
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface
/**
* Constrain the shell size to be no larger than the display bounds.
*
* @since 1.0
*/
protected void constrainShellSize() {
// limit the shell size to the display size
Rectangle bounds = shell.getBounds();
Rectangle constrained = getConstrainedShellBounds(bounds);
if (!bounds.equals(constrained)) {
shell.setBounds(constrained);
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface
/**
* Constrain the shell size to be no larger than the display bounds.
*
* @since 2.0
*/
protected void constrainShellSize() {
// limit the shell size to the display size
Rectangle bounds = shell.getBounds();
Rectangle constrained = getConstrainedShellBounds(bounds);
if (!bounds.equals(constrained)) {
shell.setBounds(constrained);
}
}
代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt
@Override
protected void prepareOpen() {
determineImageFromStyle();
shell = new Shell( parent, SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL );
shell.setText( title );
createControls();
shell.setBounds( computeShellBounds() );
shell.pack();
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench
/**
* This method should initialize the dialog bounds.
*/
@Override
protected void initializeBounds() {
super.initializeBounds();
refreshDialogSize();
boolean modalitySwitch = getBooleanValue(IStatusDialogConstants.MODALITY_SWITCH);
if (modalitySwitch) {
getShell().setBounds(getShellBounds());
}
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.xml.ui
public int createAndOpen() {
create();
getShell().setText(title);
Rectangle r = getShell().getBounds();
getShell().setBounds(r.x + 80, r.y + 80, r.width, r.height);
setBlockOnOpen(true);
return open();
}
代码示例来源:origin: org.eclipse.scout.sdk.s2e/org.eclipse.scout.sdk.s2e.nls
/**
* @param parent
*/
public TableTextEditor(TableCursor parent, int style) {
m_shell = new Shell(parent.getShell(), SWT.TOOL);
m_shell.setBounds(computeBounds(parent, style));
m_shell.setBackground(parent.getShell().getDisplay().getSystemColor(SWT.COLOR_GREEN));
FillLayout layout = new FillLayout();
layout.marginHeight = BORDER_WIDTH;
layout.marginWidth = BORDER_WIDTH;
m_shell.setLayout(layout);
m_text = new Text(m_shell, style);
m_text.setBackground(m_text.getDisplay().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide
@Override
public void expansionStateChanged(ExpansionEvent e) {
launchData.setShowRecentWorkspaces(((ExpandableComposite) e.getSource()).isExpanded());
Point size = getInitialSize();
Shell shell = getShell();
shell.setBounds(getConstrainedShellBounds(
new Rectangle(shell.getLocation().x, shell.getLocation().y, size.x, size.y)));
}
});
代码示例来源:origin: org.eclipse.e4.ui.workbench.addons/swt
public SplitFeedbackOverlay(Shell dragShell, Rectangle rect, int side, float pct,
boolean enclosed, boolean modified) {
outerRect = rect;
curSide = side;
ratio = pct;
feedbackShell = new Shell(dragShell, SWT.NO_TRIM);
feedbackShell.setBounds(dragShell.getBounds());
MWindow winModel = (MWindow) dragShell.getData(AbstractPartRenderer.OWNING_ME);
stylingEngine = winModel.getContext().get(IStylingEngine.class);
// Show the appropriate feedback rectangles
setFeedback(enclosed, modified);
defineRegion();
}
代码示例来源:origin: be.yildiz-games/module-window-swt
/**
* Make the window use all the screen and remove the title bar.
*/
void setFullScreen() {
this.shell.setFullScreen(true);
this.shell.setFocus();
final Monitor m = Display.getDefault().getPrimaryMonitor();
this.shell.setBounds(-1, -1, m.getBounds().width + 2, m.getBounds().height + 2);
this.screenSize = new ScreenSize(m.getBounds().width, m.getBounds().height);
}
内容来源于网络,如有侵权,请联系作者删除!