本文整理了Java中org.eclipse.swt.widgets.Shell.setLocation()
方法的一些代码示例,展示了Shell.setLocation()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Shell.setLocation()
方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Shell
类名称:Shell
方法名:setLocation
暂无
代码示例来源:origin: pentaho/pentaho-kettle
protected void setPosition() {
Rectangle shellBounds = getParent().getBounds();
Point dialogSize = dialog.getSize();
dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y
+ ( shellBounds.height - dialogSize.y ) / 2 );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
private void setPosition() {
Rectangle shellBounds = getParent().getBounds();
Point dialogSize = dialog.getSize();
dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2,
shellBounds.y + ( shellBounds.height - dialogSize.y ) / 2 );
}
}
代码示例来源:origin: caoxinyu/RedisClient
protected void setMiddle() {
Rectangle screenSize = shell.getParent().getBounds();
Rectangle shellSize = shell.getBounds();
shell.setLocation(screenSize.x + screenSize.width / 2 - shellSize.width / 2,
screenSize.y + screenSize.height / 2 - shellSize.height / 2);
}
代码示例来源:origin: pentaho/pentaho-kettle
protected void openDialog() {
shell.pack();
// Set the focus on the OK button
wOK.setFocus();
Rectangle shellBounds = getParent().getBounds();
Point dialogSize = shell.getSize();
shell.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y
+ ( shellBounds.height - dialogSize.y ) / 2 );
shell.open();
while ( !shell.isDisposed() ) {
if ( !display.readAndDispatch() ) {
display.sleep();
}
}
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
*
* @param shell
* the shell.
*/
public OlapInputAboutDialog( final Shell shell ) {
this.dialog = new Shell( shell, SWT.BORDER | SWT.CLOSE | SWT.APPLICATION_MODAL | SWT.SHEET );
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
this.dialog.setLayout( gridLayout );
this.dialog.setText( BaseMessages.getString( PKG, "OlapInputDialog.About.Shell.Title" ) );
this.dialog.setImage( shell.getImage() );
this.buildIconCell();
this.buildPluginInfoCell();
this.buildOkButton();
this.dialog.pack();
Rectangle shellBounds = shell.getBounds();
Point dialogSize = this.dialog.getSize();
this.dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y
+ ( shellBounds.height - dialogSize.y ) / 2 );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
*
* @param shell
* the shell.
*/
public SapInputAboutDialog( final Shell shell ) {
this.dialog = new Shell( shell, SWT.BORDER | SWT.CLOSE | SWT.APPLICATION_MODAL | SWT.SHEET );
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
this.dialog.setLayout( gridLayout );
this.dialog.setText( BaseMessages.getString( PKG, "SapInputDialog.About.Shell.Title" ) );
this.dialog.setImage( shell.getImage() );
this.buildIconCell();
this.buildPluginInfoCell();
this.buildOkButton();
this.dialog.pack();
Rectangle shellBounds = shell.getBounds();
Point dialogSize = this.dialog.getSize();
this.dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y
+ ( shellBounds.height - dialogSize.y ) / 2 );
}
代码示例来源:origin: pentaho/pentaho-kettle
/**
*
* @param shell
* the shell.
*/
public TeraFastAboutDialog( final Shell shell ) {
this.dialog = new Shell( shell, SWT.BORDER | SWT.CLOSE | SWT.APPLICATION_MODAL | SWT.SHEET );
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
this.dialog.setLayout( gridLayout );
this.dialog.setText( BaseMessages.getString( PKG, "TeraFastDialog.About.Shell.Title" ) );
this.dialog.setImage( shell.getImage() );
this.buildIconCell();
this.buildPluginInfoCell();
this.buildOkButton();
this.dialog.pack();
Rectangle shellBounds = shell.getBounds();
Point dialogSize = this.dialog.getSize();
this.dialog.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y
+ ( shellBounds.height - dialogSize.y ) / 2 );
}
代码示例来源:origin: pentaho/pentaho-kettle
Point dialogSize = shell.getSize();
shell.setLocation( shellBounds.x + ( shellBounds.width - dialogSize.x ) / 2, shellBounds.y + ( shellBounds.height
- dialogSize.y ) / 2 );
代码示例来源:origin: pentaho/pentaho-kettle
shell.setLocation( ( screenSize.width - shell.getBounds().width ) / 2, ( screenSize.height - shell.getBounds().height ) / 2 );
closeButton.setFocus();
shell.open();
代码示例来源:origin: pentaho/pentaho-kettle
public static void setSize( Shell shell, int minWidth, int minHeight, boolean packIt ) {
PropsUI props = PropsUI.getInstance();
WindowProperty winprop = props.getScreen( shell.getText() );
if ( winprop != null ) {
winprop.setShell( shell, minWidth, minHeight );
} else {
if ( packIt ) {
shell.pack();
} else {
shell.layout();
}
// OK, sometimes this produces dialogs that are waay too big.
// Try to limit this a bit, m'kay?
// Use the same algorithm by cheating :-)
//
winprop = new WindowProperty( shell );
winprop.setShell( shell, minWidth, minHeight );
// Now, as this is the first time it gets opened, try to put it in the middle of the screen...
Rectangle shellBounds = shell.getBounds();
Monitor monitor = shell.getDisplay().getPrimaryMonitor();
if ( shell.getParent() != null ) {
monitor = shell.getParent().getMonitor();
}
Rectangle monitorClientArea = monitor.getClientArea();
int middleX = monitorClientArea.x + ( monitorClientArea.width - shellBounds.width ) / 2;
int middleY = monitorClientArea.y + ( monitorClientArea.height - shellBounds.height ) / 2;
shell.setLocation( middleX, middleY );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
public static void setSize( Shell shell, int prefWidth, int prefHeight ) {
PropsUI props = PropsUI.getInstance();
WindowProperty winprop = props.getScreen( shell.getText() );
if ( winprop != null ) {
winprop.setShell( shell, prefWidth, prefHeight );
} else {
shell.layout();
winprop = new WindowProperty( shell.getText(), false, new Rectangle( 0, 0, prefWidth, prefHeight ) );
winprop.setShell( shell );
// Now, as this is the first time it gets opened, try to put it in the middle of the screen...
Rectangle shellBounds = shell.getBounds();
Monitor monitor = shell.getDisplay().getPrimaryMonitor();
if ( shell.getParent() != null ) {
monitor = shell.getParent().getMonitor();
}
Rectangle monitorClientArea = monitor.getClientArea();
int middleX = monitorClientArea.x + ( monitorClientArea.width - shellBounds.width ) / 2;
int middleY = monitorClientArea.y + ( monitorClientArea.height - shellBounds.height ) / 2;
shell.setLocation( middleX, middleY );
}
}
代码示例来源:origin: pentaho/pentaho-kettle
int middleY = monitorClientArea.y + ( monitorClientArea.height - shellBounds.height ) / 2;
shell.setLocation( middleX, middleY );
代码示例来源:origin: pentaho/pentaho-kettle
splash.setLocation( x, y );
代码示例来源:origin: pentaho/pentaho-kettle
shell.setLocation( location.x, location.y + bounds.height );
shell.setLayout( new FillLayout() );
final List list = new List( shell, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL );
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private void updatePopupLocation(boolean force) {
if (! force && fSnapPosition == SNAP_POSITION_LOWER_RIGHT)
return;
packPopup();
Point loc= computePopupLocation(fSnapPosition);
if (loc != null) {
fPopup.setLocation(loc);
// XXX workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=170774
// fPopup.moveBelow(fEditor.getSite().getShell().getShells()[0]);
}
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.workbench.renderers.swt
public void setLocation(Point location) {
Rectangle trim = fShell.computeTrim(0, 0, 0, 0);
Point textLocation = fComposite.getLocation();
location.x += trim.x - textLocation.x;
location.y += trim.y - textLocation.y;
fShell.setLocation(location);
}
代码示例来源:origin: org.eclipse/org.eclipse.ajdt.ui
public void setLocation(Point location) {
Rectangle trim= fShell.computeTrim(0, 0, 0, 0);
Point textLocation= fText.getLocation();
location.x += trim.x - textLocation.x;
location.y += trim.y - textLocation.y;
fShell.setLocation(location);
}
代码示例来源:origin: openaudible/openaudible
public static void centerShell(Shell shell) {
Rectangle displayBounds = shell.getDisplay().getPrimaryMonitor().getBounds();
Rectangle shellBounds = shell.getBounds();
int x = displayBounds.x + (displayBounds.width - shellBounds.width) >> 1;
int y = displayBounds.y + (displayBounds.height - shellBounds.height) >> 1;
shell.setLocation(x, y);
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private void updatePopupLocation(boolean force) {
if (! force && fSnapPosition == SNAP_POSITION_LOWER_RIGHT)
return;
packPopup();
Point loc= computePopupLocation(fSnapPosition);
if (loc != null && ! loc.equals(fPopup.getLocation())) {
fPopup.setLocation(loc);
// XXX workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=170774
// fPopup.moveBelow(fEditor.getSite().getShell().getShells()[0]);
}
}
代码示例来源:origin: infinitest/infinitest
private void moveToParentDialogCenter(Shell dialog) {
if (dialog.getParent() == null) {
// No parent shell no positioning
return;
}
Point dialogSize = dialog.getSize();
Rectangle parentDialogBounds = dialog.getParent().getBounds();
Point newLocation = computeCenteredLocation(dialogSize, parentDialogBounds);
dialog.setLocation(newLocation);
}
内容来源于网络,如有侵权,请联系作者删除!